Serial communication
Return of button values
After downloading the program to the display module, switch on the computer and connect the serial port via USB-TTL, press the light-on button of Light1, the serial data returns: A5 5A 06 83 00 26 01 00 A8
Press the button to switch off the light
Serial data return: A5 5A 06 83 00 26 01 00 A9
Description: A5 5A: Frame header
06: instruction byte length, 83 00 26 01 00 A9 6 bytes in total (without data frame header)
83: Read variable memory instruction
00 26: variable memory address
01: Data word length, 00 A9, 1 word length (2 bytes)
00 A9: user data content, depending on the set key value
Write register data
The following instruction indicates that the two data 55 aa are written to address 0x0020 in the data storage area.
0xA5 0x5A 0x05 0x82 0x00 0x20 0x55 0xaa
As we have already set the text display storage address of Light1 to 0x0020, writing data to this address using the serial port is equivalent to changing the contents of the Light1 text display box.
Reading register data
The serial port sends the following command to the display module.
0xA5 0x5A 0x03 0x83 0x00 0x20
This means that the value of the address 0x0020 is read, which in this case means that the switch status of the light is read.