Best Practices for Memory Utilization and other ?

I think I know the answer to this but before I use the the method I want to make sure it's the most efficient.

For the sake of discussion lets say I have a project that is going to turn on an LED for 8 different alarms and 8 different shutdowns. 16 LED's total. I wouldn't do this but I can't think of a way to illustrate my point.

Would I be better off bit picking an integer or should I declare each as a boolean and use them that way? It seems like it would be more efficient to use the 16 bits of a word rather than declare them as booleans (1 byte per bool correct?).


Are bits of an int (or dint, etc) numbered 0,1,2,3,4,,, or 15,14,13,12,,,?


To clear all of the bits in the INT back to 0 do I write each one or just write 0 to the INT. If I had any confidence that I understand C programming I probably wouldn't ask this. Coming from the PLC world it's kind of a no brainer to write a 0 to an INT to clear the bits. I suspect that is the case here.

I would only bother with the bit operations, if my application was actually likely to be short of RAM.

For the scenario you describe, the actual computer code to implement the bit operations, would probably be more than they 16 bytes required to hold the device status in a simple form.

I would store it as 2 bytes, then shift them out into shift registers to drive the displays.
TPIC6B595 would be good, use them to sink current from 5V thru the LEDs.

bytes are bits 7-0, ints are bits 15-0