Jul 12, 2013 #1 A arun_9998 Banned Joined Aug 25, 2008 Messages 53 Helped 11 Reputation 22 Reaction score 10 Trophy points 1,288 Location india Visit site Activity points 0 can we do like this in keil Code: unsigned char a; sbit b=a^0;
Jul 12, 2013 #2 #MAAM# Full Member level 2 Joined Nov 21, 2009 Messages 131 Helped 29 Reputation 58 Reaction score 27 Trophy points 1,308 Location Egypt Visit site Activity points 1,920 you can do this but using this formula Code: unsigned char a; sbit b=P1^0; in case of using 8051 micro-controller
you can do this but using this formula Code: unsigned char a; sbit b=P1^0; in case of using 8051 micro-controller
Jul 12, 2013 #3 andre_luis Super Moderator Staff member Joined Nov 7, 2006 Messages 9,654 Helped 1,191 Reputation 2,401 Reaction score 1,219 Trophy points 1,403 Location Brazil www.linkedin.com Activity points 56,009 I prefer perform this test by MARCO comand, this way : Code: #define a_BIT0 ( a & 0x01 ) ; declaration #define SET_a_BIT0 ( a |= 0x01 ) ; declaration #define CLR_a_BIT0 ( a &= 0x01 ) ; declaration if ( a_BIT0 ) { do_somethig } ; evaluation This implementation allows further compatibility with other compilers which doesn´t suport C language non-standard sbit comand . +++ Last edited: Jul 12, 2013
I prefer perform this test by MARCO comand, this way : Code: #define a_BIT0 ( a & 0x01 ) ; declaration #define SET_a_BIT0 ( a |= 0x01 ) ; declaration #define CLR_a_BIT0 ( a &= 0x01 ) ; declaration if ( a_BIT0 ) { do_somethig } ; evaluation This implementation allows further compatibility with other compilers which doesn´t suport C language non-standard sbit comand . +++