Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Hello from New memeber

Hello from New memeber

2004-12-04 by Sridhar gadda

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]

Re: [lpc2000] Hello from New memeber

2004-12-04 by Alex Holden

Sridhar gadda wrote:
 > 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

No, they're standard C. A statement like "x |= y" means do a logical 
(bitwise) OR of x and y and store the result in x. The & symbol means 
logical AND. 0x01000000 is a number with only bit 24 set. You could also 
(IMO more readably) write it as (1<<24). ~0x1000000 is the same number 
inversed, so every bit _except_ 24 is set. When you logically OR a bit 
with 1 the result is always 1 and when you logically OR a bit with 0 the 
result is unchanged, so the first statement sets bit 24 of ADCR without 
affecting any of the other bits. When you logically AND a bit with 0 the 
result is always 0 and when you logically AND a bit with 1 the result is 
unchanged, so the second statement clears bit 24 of ADCR without 
affecting any of the other bits. The above code toggles bit 24 of ADCR 
high then low and leaves the rest of ADCR unchanged which would not be 
the case if you simply did ADCR=(1<<24);ADCR=0.

I recommend you get hold of a good book on C. The C Programming Language 
by Kernighan and Ritchie is the best IMHO.

-- 
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer

RE: [lpc2000] Hello from New memeber

2004-12-04 by Dan Beadle

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
Show quoted textHide quoted text
-----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 Links

RE: [lpc2000] Hello from New memeber

2004-12-04 by Robert Adsett

At 08:04 AM 12/4/04 -0800, you wrote:

>Finally, ~0x01000000 simply inverts the bits - 1's complement. It is the
>same as   0x10111111.

A simple typo (I hope) ~0x01000000 is 0xFEFFFFFF

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.