Example of using AM-SLCD216(Serial LCD module)

AM-SLCD216 (Serial LCD module)
Terminal mode (TM) / Command mode (CM) can be set by configuring the 3Pin jumpers shown in the ollowing picture. Please read the following description regarding Mode and use the appropriately Mode that you need

S-LCD workingmode (Terminal Mode/Command mode)
- Terminal Mode (Configure jumper towards “TM” or remove the Jumper) : The function of Terminal mode is to display ASCII data sent through Serial port to the LCD screen. Data can be printed and seen similar to using PC's Notepad or a terminal program so it can be easily used even by beginners. Similar as in terminal mode, English alphabet, numbers, symbols etc can be printed and seen.
- If the compileroutputs data to serial port using printf then data can be printed using the printf statement. "Carriage Return" (ASCII code 0x0d, represented by '\ r' in printf) is used to move to new line.
EX) printf ( “NEWTC Serial LCD \r ” );
printf ( “Test Data : %d \r ”, data );
- TerminalMode Command
The following operation takes place when the below text commandsare transmitted along with '\r' at the end.
$$CS - Command to clear the screen
$$B0 - Command to Switch OFF the Cursor
$$B1 - Command to Switch ON the Cursor
$$BB - Command to blink the Cursor
$$L0 - Command to Switch OFF the Back light
$$L1 - Command to Switch ON the Back light
EX) printf ( “$$CS\r” ); // Command to clear the screen
printf ( “$$L1\r” ); // Command to Switch ON the Back light
- Command Mode (Configure jumper towards “CM”)
The function of Command mode is to Control the LCS or recognize any command received through the serial port and display that data on the LCD screen.By using Command mode, various features offered by AM-SLCD can be used and can be managed in a more useful manner.
If the compileroutputs data to serial port using printf then data can be printed using the printf statement. Command starts with “$” and ends with “Carriage return” (ASCII code XX, represented by '\ r' in printf) each item is separated using a Comma. Refer the below Command table.
EX) printf ( “$T,NEWTC Serial LCD \r” ); // Print data to LCD screen
printf ( “$T,Test Data : %d \r”, data );
printf ( “$C \r ”, data ); // Clear LCD screen
printf ( “$G,%d,%d \r ”, x,y ); // Move Cursor to x,y location
printf ( “$L,1 \r ”, light ); // Switch ON Back light
printf ( “$L,0 \r ”, light ); // Switch OFF Back light
AM-SLCD Command Table
|
Category |
Command |
Data1 |
Data2 |
End |
Example |
|
Initialization |
$I |
|
|
|
$I |
|
Screen clear |
$C |
|
|
|
$C |
|
Cursor position |
$G |
Row position(1-4) |
Column position (1-20) |
|
$G,1,1 |
|
String output |
$T |
Text |
|
|
$T,Testing… |
|
Cursor (OFF/ON/ Blink) |
$B |
0/1/B |
|
|
$B,1 |
|
Display (On/Off) |
$D |
1/0 |
|
|
$D,1 |
|
Backlight(On/Off) |
$L |
1/0 |
|
|
$L,1 |
|
Display Shift (Left / Right) |
$S |
L/R |
|
|
$S,R |
Command wise Operation.
* Initialization
- Initialize the LCD and place cursor on the 1,1 coordinates.
Example) $I
* Screen Clear
- Clear the screen
Example) $C
* Specify Cursor position
- Row can be specified from1-4 and column from 1-20. (Differs for different LCD Type) .Cursor do not
move if wrong location is set.
Example) $G,1,1 Move cursor to Row 1, Column 1(Origin)
* String output
Outputs the receivedstring to LCD. Prints on the next line if line exceeds the LCD.
If the lastline exceeds the LCD, it is ignored.
Example) $T,Testing… Outputs “Testing…” to current cursor location of LCD.
* Cursor ON/OFF
- Cursor ON when input value is 1and OFF on0.
Example) $B,1 Cursor ON
$B,0 Cursor OFF
$B,B Cursor ON, Blink ON
* Back Light ON/OFF
- Controls the Back Light. ON when value is 1 and OFF when 0.
Example) $L,1 Back Light ON
$L,0 Back Light OFF
Picture of AM-SLCD216 (Serial LCD module)
