> Right now I can't find a good way to test a bit in a variable such > that it is assured to compile down to using the bit test instructions. > All I could find that is close is this but it does not seem to return > the bit's value. Is it returning an address? Do I need to > dereference it in use? > > #define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit)) Yes. It's converting to an address. You can then use that to declare a bit variable at that address. Examples - static volatile bit SR_OE PORT_BIT(PORTC, 2); static volatile bit SR_Strobe PORT_BIT(PORTC, 5); static volatile bit SR_DatPin PORT_BIT(PORTC, 4); static volatile bit SR_ClkPin PORT_BIT(PORTC, 3); Steve. ====================================================== Steve Baldwin Electronic Product Design TLA Microsystems Ltd Microcontroller Specialists PO Box 15-680, New Lynn http://www.tla.co.nz Auckland, New Zealand ph +64 9 820-2221 email: steveb@tla.co.nz fax +64 9 820-1929 ====================================================== -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads