Pages: [1]   Go Down
Author Topic: Why do I need Wire.send(0x00) before command?  (Read 986 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I'am just trying to learn the Arduion together with an LCD with I2C bus. (LCD see http://www.robot-electronics.co.uk/htm/Lcd03tech.htm). I use the Arduino Wire library rather than any LCD library just to learn what's going on "behind the scene".

Anyhow, I have seen that I (always?) need to use "Wire.send(0x00)" before any command e.g. Wire.send(0x13). For example to switch on the backlight I need to do this;

Code:
Wire.beginTransmission(0x63);  // The 7 bit LCD adress is 0x63
Wire.send(0x00);  // Why is this row needed?
Wire.send(0x13);  // Backlight on
Wire.endTransmission();

Why do I need to send "0x00" first?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why do I need to send "0x00" first?

That is telling the I2C device what register number you want the next byte sent to be written to. That is most likely a 'command' register in the device that setups various options.

Lefty

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Aha, thanks! Yes that makes sense.
Logged

Pages: [1]   Go Up
Jump to: