Respectable colleagues, how to read a value of a BIT from value of a BYTE variable in Keil C ? For example: X=(Byte1.Bit7*4)+(Byte1.Bit6*2) Thanks in advance. With best regards, Dragan Kujovic
Don't forget those <pre> and </pre> tags when posting code: // main.h
#define OUTPUT 1 #define INPUT 0 #define HIGH 1 #define LOW 0 sfrbit P_TEST _atbit(P2,10); sfrbit DP_TEST _atbit(DP2,10);
void main( void ) { DP_TEST = OUTPUT; P_TEST = HIGH; _nop(); P_TEST = LOW; DP_TEST = INPUT; if (P_TEST == HIGH) { /* do stuff */ } }