NHD‐0420CW‐AB3 I2C Interface
I don't understand exactly how to send data and/or control bytes to the NHD-0420CW-AB3 display (US2066 driver).
Please verify if this is correct. In each case the start condition and slave address have been sent to the display.
1. To send data only: Send a control byte with both Co and D/C# set to zero (0x00). Any subsequent bytes will be interpreted as data.
2. To send a command: Send a control byte with Co set to one and D/C# set to zero (0x80). The following byte will be interpreted as a command. Repeat for each command (i.e. always send both a control and a command byte).
3. Alternatively, data can also be sent by sending a control byte with Co set to one and D/C# set to one (0xC0). The following byte will be interpreted as data. Repeat for each data byte (i.e. always send both a control and a data byte).
-
Perhaps the below code snippets will better assist you:
const char slave2w = 0x3C;
void send_packet(unsigned char x)
{
unsigned char ix;
Wire.beginTransmission(slave2w);
for(ix=0;ix<x;ix++)
{
Wire.write(tx_packet[ix]);
}
Wire.endTransmission();
}
void command(unsigned char c)
{
tx_packet[0] = 0x00;
tx_packet[1] = c;
send_packet(2);
}
void data(unsigned char d)
{
tx_packet[0] = 0x40;
tx_packet[1] = d;
send_packet(2);
}0
Please sign in to leave a comment.
Comments
1 comment