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
So you've decided to give up on Assembler?
http://www.keil.com/forum/18966/
So now you need to learn the 'C' programming language, and the specific extensions for the 8051 provided by Keil's C51 implementation.
'C' is a very widely-used and long-established languages - there's a vast wealth of books, sites, and training courses available to help you to learn the language; eg,
http://www.keil.com/books/
http://www.keil.com/events/
publications.gbdirect.co.uk/.../
www.eskimo.com/.../
For Details of Keil products - including full manuals - see: http://www.keil.com/support/
sorry for wrong answer, The answer for the 1st one should be the following:
sbit lcd_SCK=P0^4; sbit lcd_SDIN=P0^3; sbit lcd_DC=P0^2; sbit lcd_SCE=P0^1; sbit lcd_RST=P0^0;
sbit is for single bit declaration.
regards, yateesh k
I agree with Neil.
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.