Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/31/03 11:06
Read: times


 
#47103 - RE: Grabbing a bit from a byte?
Responding to: ???'s previous message
You could also use macro's to implement the masking approach...
#define TST_BIT_X(addrx,mask) 	(*addrx & mask)
#define SET_BIT_X(addrx,mask)	(*addrx = (*addrx | mask))
#define CLR_BIT_X(addrx,mask) 	(*addrx = (*addrx & ~mask))


or by using a union..

or by using bdata Aliasing ie...
bdata U8 General_flags;

sbit check_menu=General_flags^0;
sbit sound_alarm=General_flags^1;
sbit sound_alarm_ack=General_flags^2;
sbit al_ack=General_flags^3;
sbit UpdateDisplaywithError=General_flags^4;



so you have access at the byte or bit level


Rob.

List of 10 messages in thread
TopicAuthorDate
Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      
      RE: Grabbing a bit from a byte?            01/01/70 00:00      
         RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
         RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      

Back to Subject List