Andrei Chichak and Alvaro Prieto (@alvaroprieto) join us to talk about bits and how to manipulate them.
Andrei wrote about bit manipulation as part of Embedded Wednesdays on Embedded.fm: Logic in C, part II. Andrei recommends using ISO646.h to reduce confusion around bit manipulation. Also, his suggested calculator is the SwissMicros DM16L
Elecia wrote an introduction to binary and hex.
For more information about programming and binary, see How to Count by Steven Frank
For advanced bit twiddling, check out:
- Bit Twiddling Hacks website
- Hacker's Delight book by Henry S. Warren Jr (1st Ed is also available and they have a website)
Listener Prashant pointed out an error that goes to shows that we really should have been writing these numbers down and agreed on the zero base to start with:
In Episode 241 @36:45 when Elecia talks about turning on GPIO3, and GPIO3 is the 3rd bit (I am assuming starting at index 0), you write 8. However when Andrei starts explaining he talks of the mask as 100, which has a value 4. I guess he assumed that the 3rd bit meant 3rd starting from index 1.