> I'm trying to do a bit array in Hi-Tech C, and could not get to a way > of doing so. I use this in HiTech C typedef struct Port_s { unsigned bit0 :1; unsigned bit1 :1; unsigned bit2 :1; unsigned bit3 :1; unsigned bit4 :1; unsigned bit5 :1; unsigned bit6 :1; unsigned bit7 :1; } Port_t; union { unsigned char Byte; Port_t Bits; } PortA, PortB, PortC; and use it like this if (!PortB.Bits.bit5) PortA.Byte = 0xAA; The compiler understands it and generates good code. The only difference that I can see is that you have an array of char, which may be one level of indirection too many. That's just a guess though. 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: steve@tla.co.nz fax +64 9 820-1929 ========================================= -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics