Hi,
I’m trying to get a Winstar1602B, VATN, I2C LCD up and running. I believe it’s wired correctly (including a potentiometer for dimming), I’ve used the I2C scanner and have the address (ox3c), and I’ve tried to read a lot about how I2C works.
I’ve tried the Liquid Crystal I2C library, but it hasn’t worked. I haven’t seen much information on Winstar displays being used with arduino/particle, so I’m wondering if the library would need to be modified to work with this display. Even if the library does work, I also would like to understand I2C better than just using a library.
I’ve used I2C libraries a lot, but have never used the Wire library to do my own I2C programming. I’ve learned through Arduino and Particle, don’t know C, and know a little C++.
My main question: Can someone help me understand how to interpret the following instructions table and/or the following demo code from the application note?
For example, in the instructions table - what would the code equivalent be to turn the display on/off? I think once I have an example, I can figure out the rest of the commands.
Alternatively, if I’m just repeating questions, is there an I2C resource that explains what I’m asking elsewhere? I haven’t found something that helps me interpret this instructions table yet.
Thanks!
I2C Demo Code:
// I/O define
#define I2CSA0
#define I2CSA1
sbit RS
sbit CSB
sbit SA0
sbit SA1
sbit SCL
sbit SDA
// IIC write command
void WRITE_CODE(unsigned char I2C_CONTROL, unsigned char I2C_data){
unsigned char adds = 0x78; START_CON();
Write_control(adds + I2CSA0 + I2CSA1)
Write_control(I2C_CONTROL);
Write_data(I2C_data) ;
STOP_CON();
}
void START_CON(){
SDA = 1;
SCL = 1;
SDA = 0;
SCL = 0;
}
void Write_data(unsigned char data1){
unsigned char count=0;
for(count=0;count<8;count++){
if(data1&0x80)
SDA=1;
else
SDA=0;
data1 <<= 1;
SCL=1;
SCL=0;
}
Ack_Check();
}
void Write_control(unsigned char C_CONTROL){
unsigned char count=0;
for(count=0;count<8;count++){
if(C_CONTROL&0x80)
SDA=1;
else
SDA=0;
C_CONTROL<<=1;
SCL=1;
SCL=0;
}
Ack_Check();
}
void STOP_CON(){
SCL = 1;
SDA = 1;
}
void Ack_Check(){
SDA = 1;
SCL = 1;
do{
SDA = 0;
SCL = 0;
}while(SDA);
//INITIALIZE
void Initial_1063(){
RS = 0;
CSB = 0;
SA0 = I2CSA0;
SA1 = I2CSA1;
SCL = 1;
SDA = 1;
WRITE_CODE(0x00,0x38); //SET 2 LINE,5*8 FONT
CGRAM();
WRITE_CODE(0x00,0x08); //Display off
WRITE_CODE(0x00,0x06); //Entry mode set
WRITE_CODE(0x00,0x01); //CLEAR DISPLAY
delay(1);
WRITE_CODE(0x00,0x0c); //DISPLAY ON,Cursor OFF,Cursor Blink OFF
}