BIT addressable variables

Question: Is it possible to define and use bit addressable variable in C?

 

Answer:

PSoC does not have any bit addressable instructions. So, to operate on bits, bit masks should be used. For example, to set bit 0 of a variable

MyVariable |= 0x01;

To clear bit 0,

MyVariable &= ~0x01;

The above applies to ImageCraft compiler.  In HiTech you can do bit operations using "bit" type variables.  For example:

bit MyBitVariable;

MyVariable = 1;
MyVariable = 0;

HiTech actually translates the above instructions into setting and clearing bits in an 8 bit variable using bit masking.  For details on "bit" type variable refer the HiTech compiler user manual.