I'm trying to catch a pulse on P1.
#define IR_PIN BIT4 //P1.4
I create a structure:
volatile struct
{
unsigned char ToggBit: 1;
unsigned char Value: 1;
}
rc5bits;
and a variable as alternative way:
unsigned char ToggBit;
void Get_IR_Data(void)
{
//now i read the value of IR_PIN
//rc5bits.ToggBit = P1IN&IR_PIN; //doesn't work
ToggBit = P1IN&IR_PIN; //works
if (ToggBit)
{ P5OUT |= BIT1;} //set led
else
{ P5OUT &= ~BIT1;} //clear led
__delay_cycles(10000);
}
if i pass the pin value to rc5bits.ToggBit - it doesn't work , but if i pass it to ToggBit - it work.
What's the problem? Can't grasp it!