You are here

BIT addressable variables | Cypress Semiconductor

Support & Community

BIT addressable variables

Last Updated: March 27, 2011

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


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.

Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type