How do I access bits

LEH

Member
I need to determine if bits of a byte are high or low. So I have symbol ADDR = b2. I can't use ADDR.bit7, and I have tried various commands such as if ADDR & this, also if ADDR AND this, where this is a variable or DCDn. I can't seem to use any variation of if ADDR & or if ADDR AND as I get a syntax error.
 

hippy

Technical Support
Staff member
The bits which make up b2 are bit23-bit16 (msb-lsb), so you can define ...

Symbol ADDR = b2

Symbol ADDR.bit0 = bit16
Symbol ADDR.bit1 = bit17
:
Symbol ADDR.bit6 = bit22
Symbol ADDR.bit7 = bit23
 

LEH

Member
Thanks for your help. Was able to get if ADDR BIT n SET then to be accepted. I thought I was going to have to use if ADDR >= 128 then; blah; ADDR = ADDR - 128; endif etc.
 
Top