I recently purchased (https://www.topwaydisplay.com/product/smart-lcd/smart-lcd-module-HKT050ATA-C) HKT050ATA-C topway display LCD. I am trying to interface it with Arduino using UART protocol. I used the same connections as shown in their manual (check the attached screenshot). I used RS232 converter to TTL level to connect the LCD with the Arduino Uno. They mentioned that there are only 3 pins needed to be connected which are(Tx, Rx, GND) and I connected them to their respective pins in the DB9 connector. I tried it with this configurations and it didn't work. I also tried including the RTS(request to send) pin and it still didn't work.
I used the same code found in their YouTube tutorial.(TOPWAY Smart LCD - interface with Arduino UNO - YouTube)
NOTE: Their software (RGtools V1.70) for some reason doesn't include my LCD model(HKT050ATA-C) as shown in the attached screenshot.
My problem now is that I can't communicate between the LCD and the Arduino. I created 2 variables on the smart LCD. The Arduino requests to read one of them(by targeting it's specific address) that I change with simple mathematical operations (as shown in attached screenshot). Then the Arduino is supposed to send the same value again to the LCD and place it in the other variable to confirm that the Arduino read the first variable and sent it and updated the second variable. As shown in the screenshot, the variable on the LCD is changed but the variable that is controlled by the Arduino is not which means there's a communication problem surely but I don't know why.
Thanks in advance
int temp_h=0;
int temp_1=0;
int writeback_h=0;
int writeback_1=0;
int packet_0K=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while(!Serial){;}//wait for serial port to connect.Needed for native USB port only
}
void loop() {
// put your main code here, to run repeatedly:
Serial.write(0xaa);//packet head
Serial.write(0x3e);// VP_N16 read command
Serial.write(0x00);// VP_N16 address
Serial.write(0x08);
Serial.write(0x00);
Serial.write(0x00);
Serial.write(0xcc);//packet tail
Serial.write(0x33);//packet tail
Serial.write(0xc3);//packet tail
Serial.write(0x3c);//packet tail
while(!Serial.available()){}
if(Serial.read()==0xaa){ // packet head
packet_0K=1;
Serial.println("Packet head received");
while(!Serial.available()){}
if(Serial.read()==0x3e){ // packet command
while(!Serial.available()){}
temp_h=Serial.read(); // read back value high byte
while(!Serial.available()){}
temp_1=Serial.read(); // read back value low byte
while(!Serial.available()){}
if(!(Serial.read()==0xcc)){packet_0K=0;} //packet tail
while(!Serial.available()){}
if(!(Serial.read()==0x33)){packet_0K=0;} //packet tail
while(!Serial.available()){}
if(!(Serial.read()==0xc3)){packet_0K=0;} //packet tail
while(!Serial.available()){}
if(!(Serial.read()==0x3c)){packet_0K=0;} //packet tail
}
else
{packet_0K=0;}
}
else
{packet_0K=0;}
if (packet_0K){
writeback_h=temp_h;
writeback_1=temp_1;
Serial.write(0xaa);//packet head
Serial.write(0x3d);// VP_N16 write command
Serial.write(0x00);// VP_N16 address
Serial.write(0x08);
Serial.write(0x00);
Serial.write(0x02);
Serial.write(writeback_h); // VP_N16 data high byte
Serial.write(writeback_1); // VP_N16 data low byte
Serial.write(0xcc);//packet tail
Serial.write(0x33);//packet tail
Serial.write(0xc3);//packet tail
Serial.write(0x3c);//packet tail
}
for(int i=0; i <= 20; i++){delayMicroseconds(1000);}
}