Arduino LCD Display Protocol
This protocol controls a HD44780 LCD screen connected to the microcontroller.
After the welcome message it has no events, but a huge variety of commands.
How to build a test circuit with a lcd display and an Arduino Mega?
Arduino codes are included.
I. "Welcome" event from microcontroller
Example
c=welcome&id=A47vvH&type=OzLcdController&pos=2&t=3
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"welcome" |
Identifies the welcome message. |
type |
String |
"OzLcdController" |
Determines the type of the device. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
The ID of the device which is chosen by the microcontroller. |
pos |
Byte |
0-255 |
Determines the position of the device on the list of the ID manager of the microcontroller.
Please make sure there are no other devices in the same position. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
II. Commands to microcontroller
"Write" command
If the cursor is set in a position which is on the LCD sceen. Then this command writes out the message to the LCD screen.
Example
c=write&word=test&t=0&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"write" |
Identifies the command. |
word |
String |
Max. 30 chars |
The text itself, which will be displayed on the screen. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=write_resp&row=1&column=4&word=test&id=A47vvH&t=3
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"write_resp" |
Identifies the response. |
row |
Byte |
0-255 |
Number of rows. |
column |
Byte |
0-255 |
Number of columns. |
word |
String |
Max. 30 chars |
The text itself, which will be displayed on the screen. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Set Backlight" command
Changes LCD illumination to a selected value.
Example
c=setbacklight&value=60&t=1&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setbacklight" |
Identifies the command. |
value |
Byte |
0-100 (%) |
Changes the LCD illumination to a selected percentage value. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=setbacklight_resp&value=60&id=A47vvH&t=4
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setdisplay_resp" |
Identifies the response. |
value |
Byte |
0-100 (%) |
Responds the value ordered by the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Set Display" command
Turns on and off the LCD display.
Example
c=setdisplay&state=1&t=2&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setdisplay" |
Identifies the command. |
state |
Bool |
0,1 |
True turns display on, false turns display off. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=setdisplay_resp&state=1&id=A47vvH&t=5
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setdisplay_resp" |
Identifies the response. |
state |
Bool |
0,1 |
Responds the state ordered by the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Clear Display" command
Removes every character from the LCD screen. The ID identifies the screen.
Example
c=cleardisplay&t=3&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"cleardisplay" |
Identifies the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=cleardisplay_resp&id=A47vvH&t=6
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"cleardisplay_resp" |
Identifies the response. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Set Cursor" command
Turns on or off the small cursor. You can only write on the LCD if the cursor is set to one of the visible character positions.
Example
c=setcursor&state=1&t=4&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setcursor" |
Identifies the command. |
state |
Bool |
0,1 |
If true the cursor is set, if false there is no cursor. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=setcursor_resp&state=1&id=A47vvH&t=7
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setcursor_resp" |
Identifies the response. |
state |
Bool |
0,1 |
Responds the state ordered by the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Set Blink" command
Turns on or off the huge flashing cursor.
Example
c=setblink&state=1&t=5&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setblink" |
Identifies the command. |
state |
Bool |
0,1 |
True activates the huge blinking cursor. False deactivates it. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=setblink_resp&state=1&id=A47vvH&t=8
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setblink_resp" |
Identifies the response. |
state |
Bool |
0,1 |
Responds the cursor state ordered by the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Set Position" command
Set the position of the cursor. You can add the rows and the colums where you want start writing.
Example
c=setposition&row=1&column=1&t=6&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setposition" |
Identifies the command. |
row |
Byte |
0-255 |
Row number of the cursor position. |
column |
Byte |
0-255 |
Column number of the cursor position. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=setposition_resp&row=1&column=1&id=A47vvH&t=9
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setposition_resp" |
Identifies the response. |
row |
Byte |
0-255 |
Row number of the cursor position. |
column |
Byte |
0-255 |
Column number of the cursor position. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Autoscroll" command
If Autoscroll is set it and you reach the end of the LCD screen, it pulls up every row by one.
Example
c=setautoscroll&state=1&t=7&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setautoscroll" |
Identifies the command. |
state |
Bool |
0,1 |
True activates autscroll, false deactivates it. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=setautoscroll_resp&state=1&id=A47vvH&t=10
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"setautoscroll_resp" |
Identifies the response. |
state |
Bool |
0,1 |
Responds the state ordered by the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
"Return Home" command
Sets the cursor to the first row's first character.
Example
c=returnhome&t=8&id=A47vvH
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"returnhome" |
Identifies the command. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of commands sent. Counts from 0 to 255 then from 0 again. |
Response
c=returnhome_resp&id=A47vvH&t=11
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"returnhome_resp" |
Identifies the response. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
III. Event from microcontroller
"Display Size" event
After the welcome event the device sends the LCD's size (rows and columns).
Example
c=displaysize&row=4&column=20&id=A47vvH&t=3
Parameters
Parameter |
Type |
Range |
Functionality |
c |
String |
"displaysize" |
Identifies the event. |
row |
Byte |
0-255 |
Number of rows. |
column |
Byte |
0-255 |
Number of columns. |
id |
String |
6 characters (numbers, uppercase and lowercase characters) |
Identifies the device. The ID is never changed during communication. |
t |
Byte |
0-255 |
Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again. |
More information