Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

varible bit handilling

Status
Not open for further replies.
you can do this but using this formula

Code:
unsigned char a;
sbit b=P1^0;

in case of using 8051 micro-controller
 

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:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top