This is a basic feature of the C language.
'|' is the bit-wise OR operator;
'&' is the bit-wise AND operator.
The dest <op>= arg format is equivalent to
Dest = Dest <op> arg.
So ADRC |= 0x01000000;
Is the same as
ADRC = ACRC | 0x01000000;
It may be somewhat simpler for some compilers to use the compound notation
|= to generate the most efficient code. On most c translators, this would
take place of any "atomic" or instructions.
Finally, ~0x01000000 simply inverts the bits - 1's complement. It is the
same as 0x10111111.
So ADRC |= 0x01000000 sets bit 24.
ADRC &= ~0x01000000 clears bit 24.
You will see this notation a lot in c code that manipulates registers.
Enjoy.
Dan
-----Original Message-----
From: Sridhar gadda [mailto:sridhargadda@...]
Sent: Saturday, December 04, 2004 12:18 AM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Hello from New memeber
Hello to everyone in this group.
I like to congratulates for setting up this group for
LPC2000 family users. I am using lpc2129 and keil's µvision3 for my
applications. Its a first experience for me. I have one question and I would
apprerciate to get answers for it.
I have seen an example program in which the statement ADCR |=
0x01000000 which starts ADC conversion and ADCR &= ~0x01000000 stops ADC
conversion. The '|' and '&' symbol are compiler specific or lpc2129...in
gernal why these symbols are used to start and stop ADC conversion. Cannot
we start and stop by setting registers in this µc for example ADCR =
0x01000000 (start) and ADCR = ~0x01000000 (stop).
Any help would be appreciated.
regards,
Sridhar
---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! Try it today!
[Non-text portions of this message have been removed]
Yahoo! Groups LinksMessage
RE: [lpc2000] Hello from New memeber
2004-12-04 by Dan Beadle
Attachments
- No local attachments were found for this message.