Notifications
Clear all

Bit Bashing for Noobs

3 Posts
3 Users
0 Reactions
2,462 Views
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

Recently, Bill put up an EEPROM video with a sketch that included these two lines of cryptic code.

 // Send memory address as two 8-bit bytes
Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB

So, I thought for the benefit of those not so proficient at C++, I would post the graphic below to help explain what is actually happening. I used this a couple of years ago to help me understand the bit bashing involved.

bit bashing

I hope this can be of help to someone!


   
Quote
hstaam
(@hstaam)
Mr.
Joined: 5 years ago
Posts: 61
 

@pugwash

Thank you for sharing this. It is very helpful!

hj

hj


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@pugwash

There is a good introduction here: BitMath

Btw... I think 8 times should be 8 positions 🙂

 


   
ReplyQuote