i m working in C using Keil 3.55a
how can i define a one bit variable
and how can i compare two bits using if
how can i set or clear Bit
and how can i get the compliment of one byte or one bit, like in ASM CPL A or CPL c
1.how can i define a one bit variable A:
Use #define
#define glcd_SCK 4 #define glcd_SDIN 3 #define glcd_DC 2 #define glcd_SCE 1 #define glcd_RST 0
2.How can i compare two bits using if A:
if(bit1 operator bit2)
3.How can i set or clear Bit A:
bit=0; // for clearing bit=1; // for setting
4.How can i get the compliment of one byte or one bit, like in ASM CPL A or CPL c A: Use ^ operator.
byte^=(1<<bit_pos); // complements the bit in the "bit_pos" bit position. bit=(~bit); // complements the bit
Incorrect! That does not define one-bit variables!
It does not, in fact, define any variables at all!
Neil,
Sorry for wrong post, In my next post I have tried to regret that.
View all questions in Keil forum