| Author |
Message |
mehipour
Joined: 01 Jul 2008 Posts: 20
|
01 Jul 2008 9:05 help on avr programming |
|
|
|
hi folks,
I programming AVR ATmega32 for an embedded web-server. There's this C language Syntax that I have confronted and I don't understand.
(PINB &(1<<PB2)) == 0)
I didn't fully understand the meaning of this syntax. I suppose that PINB is the portb register and PB2 is the third bit of this port which is used as an interrupt.
thanks a lot,
Mehipour
|
|
| Back to top |
|
 |
flanello
Joined: 09 Jan 2008 Posts: 67 Helped: 6
|
01 Jul 2008 11:41 Re: help on avr programming |
|
|
|
Hi,
PINB and PB2:
I think there must be a #define statement thats define PINB and PB2.
|
|
| Back to top |
|
 |
mehipour
Joined: 01 Jul 2008 Posts: 20
|
01 Jul 2008 11:46 Re: help on avr programming |
|
|
|
They are both defined in the header files. Let me rephrase my question. Imagine we know what are PINB and PB2 both are! Now by this assumption what this syntax will do? That's what I need to know please.
Actually the real syntax is
while((PINB &(1<<PB2)) == 0))
{// statement};
I need to when the statement is going to run by the program. What exactly is the condition?
Thanks,
|
|
| Back to top |
|
 |
Eugen_E
Joined: 29 Nov 2004 Posts: 321 Helped: 30
|
02 Jul 2008 17:00 Re: help on avr programming |
|
|
|
PINB has the logic states of PORTB pins.
1<<PB2=0b00000100, is the mask
So while will be executed as long as the PB2 pin of PORTB is 0.
|
|
| Back to top |
|
 |