Content originally posted in LPCWare by magicdim on Thu Jan 24 06:19:51 MST 2013
Quote: Zero
No, you are ANDing 0b10000000000000000000000 ;) Result is either (1<<22) or (0<<22) :eek:
LPC_GPIO0->FIOPIN is an uint32_t (see LPC17xx.h), what's not clear there?
Yes, I agree, this one wasn't my main issue, I was disturbed by the following...
Quote: Zero
No, you are right shifting (4 bits) a 32bit register, the result is still a 32 bit register :p
Ok, I think I understand... shifting 4 bits to FIOPIN register (LPC_GPIO0->FIOPIN >> 4) results in pushing its bit number 3 at the end (number 0), and ANDing this result with 0x01 gives the state of this bit number 3 (pin P0.4 in this case)
Am I right??
P.S: sorry for my inaccurate writings...