Go Down

Topic: Why do I need Wire.send(0x00) before command? (Read 1 time) previous topic - next topic

snoozerman

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: [Select]
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?

retrolefty

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


snoozerman


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy