BIT addressable variables
Anonymous
Not applicable
Mar 27, 2011
05:43 AM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Mar 27, 2011
05:43 AM
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.
Labels
- Tags:
- psoca 1
Rate this article:
Contributors
-
This widget could not be displayed.Anonymous