How do I read one bit in a byte in PCM 4.037? For this specific example I am reading a byte from a register over SPI and only care about bits 7, 3, 2, and 1. The rest are don't care. I can read the byte just fine, but, I'm stuck figuring out to to only look at the bits I care about.
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
Posted: Sat Jan 02, 2010 10:13 pm
To mask off bits you can use the bitwise AND (&).
See #bit in the CCS manual for how to assign variables to individual bits in a variable.
You can also use bit_test() to test the state of bits in a variable.
PCM, Thanks for catching my error in the mask info and letting me know! (now corrected) _________________ Google and Forum Search are some of your best tools!!!!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum