Copyright © Parallax Inc. Parallax Serial LCDs (#27976, 27977, 27979) v3.1 3/11/2013 Page 4 of 11
{{
Serial_LCD_Demo.spin
For Parallax Serial LCDs 27976, 27977, 27979
}}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
TX_PIN = 0
BAUD = 19_200
OBJ
LCD : "FullDuplexSerial.spin"
PUB Main
LCD.start(TX_PIN, TX_PIN, %1000, 19_200)
waitcnt(clkfreq / 100 + cnt) ' Pause for FullDuplexSerial.spin to initialize
LCD.str(string("Hello, this text will wrap."))
Moving the Cursor
When you send a character to the Serial LCD, it always displays at the current cursor position. There are
a few different ways to move the cursor on the Serial LCD display. After each character you send, the
cursor automatically moves over one position. Along with this, there is a standard set of cursor move
commands including Backspace, Carriage Return, and Line Feed.
The Backspace/Left command (Dec 8) moves the cursor one place to the left and the Right command
(Dec 9) moves the cursor one place to the right. These can be useful for moving the cursor around to
overwrite existing text. These commands wrap to the next line of the display, if necessary. The Line Feed
command (Dec 10) moves the cursor to the next line of the display without changing the horizontal
position of the cursor. The Carriage Return command (Dec 13) also moves the cursor to the next line, but
it moves the cursor to the leftmost position on that line as well. The Form Feed command (Dec 12) clears
the entire display and moves the cursor to the leftmost position on line 0, just like when you first turn on
the display. You will need to pause for 5mS in your code after sending the Form Feed command, to give
the Serial LCD time to clear the display. Except for Form Feed, none of these move commands affects the
characters on the display.
There are also direct move commands that you can use to move the cursor to any position on the display
with a single command. The commands in the range Dec 128 to 143 and Dec 148 to 163 move the cursor
to the 16 different positions on each of the two lines of the model 27976 and 27977 LCDs. The
commands in the range Dec 128 to 207 move the cursor to the 20 different positions on each of the four
lines of the model 27979 LCD.
Controlling the Display
You also have control over the various display modes of the Serial LCD. The display-off command (Dec
21) turns off the display so that all of the characters disappear. The characters aren’t erased from the
display, though, and you can even keep writing new characters to the display when it is turned off. A
trick to make a lot of text show up all at once, even at a slow baud rate, is to turn off the display and
then send all of your text. Then, when you turn the display on again, all of the text appears instantly.
Copyright © Parallax Inc. Parallax Serial LCDs (#27976, 27977, 27979) v3.1 3/11/2013 Page 5 of 11
The display-on commands (Dec 22 to 25) turn the display back on and also control whether you want to
display the cursor and/or make the cursor character blink. The cursor is the short bar that shows up
below the character at the current cursor position. The blink option makes that character blink on and off
repeatedly. You can turn the cursor and blink options on or off, in any combination, as listed in the
command set table. You can change the cursor and blink mode even if the display is already on; you
don’t need to turn it off and then back on again.
With models 27977 and 27979, you can also control the backlight of the display. The backlight lights up
the display so that it is easier to see in the dark. There are commands to turn the backlight on (Dec 17)
and off (Dec 18).
Custom Characters
The Serial LCD has the capability to store up to eight user-defined custom characters. The custom
characters are stored in RAM and so they need to be redefined if you turn off the power. You can display
the custom characters by sending the commands Dec 0 to 7, as shown in the command set table. The
custom character will display at the current cursor position.
The custom characters are five pixels wide by eight pixels high. Each of the characters is stored as a
series of eight data bytes where the low five bits of each byte represent a row of pixels in the character.
The high three bits of each byte are ignored. A bit value of one turns that pixel on (i.e. makes it black).
The bottom row of pixels is often left blank (all zeros) to make it easier to see the cursor.
To define a custom character, you will send a total of 9 bytes to the Serial LCD. The first byte needs to
be a valid define-custom-character command (Dec 248 to 255) and must be followed by eight data bytes
that define the pixels of the character. The Serial LCD will always use the next eight bytes it receives to
set the pixels of the character. The data bytes define the character starting at the topmost row of pixels,
as shown in the example code.
BASIC Stamp 2 Custom Character Example
Define a custom character using the code example below. First, set the baud rate on your Serial LCD to
19,200. Then, load the code below into your BASIC Stamp 2 and run it. You will see a diamond character
appear on the screen.
' {$STAMP BS2}
' {$PBASIC 2.5}
TxPin CON 0
Baud19200 CON 32
HIGH TxPin ' Set pin high to be a serial port
PAUSE 100 ' Pause for Serial LCD to initialize
SEROUT TxPin, Baud19200, [250] ' Define custom character 2
' Now send the eight data bytes
SEROUT TxPin, Baud19200, [%00000] ' %00000 =
SEROUT TxPin, Baud19200, [%00100] ' %00100 = *
SEROUT TxPin, Baud19200, [%01110] ' %01110 = * * *
SEROUT TxPin, Baud19200, [%11111] ' %11111 = * * * * *
SEROUT TxPin, Baud19200, [%01110] ' %01110 = * * *
SEROUT TxPin, Baud19200, [%00100] ' %00100 = *
SEROUT TxPin, Baud19200, [%00000] ' %00000 =
SEROUT TxPin, Baud19200, [%00000] ' %00000 =
SEROUT TxPin, Baud19200, [2] ' Display the new custom character 2
Copyright © Parallax Inc. Parallax Serial LCDs (#27976, 27977, 27979) v3.1 3/11/2013 Page 6 of 11
Propeller™ P8X32A Example Code
Define a custom character using the code example below. First, set the baud rate on your Serial LCD to
19,200. Then, load the code below into your Propeller and load RAM or EEPROM. You will see a diamond
character appear on the screen. Note: the FullDuplexSerial.spin object is included with the Propeller Tool
software.
{{
Serial_LCD_Custom_Character.spin
For Parallax Serial LCDs 27976, 27977, 27979
}}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
TX_PIN = 0
BAUD = 19_200
OBJ
LCD : "FullDuplexSerial.spin"
PUB Main
LCD.start(TX_PIN, TX_PIN, %1000, 19_200)
waitcnt(clkfreq / 100 + cnt) ' Pause for FullDuplexSerial.spin to initialize
LCD.tx(250) ' Define custom character 2
' Now send the eight data bytes
LCD.tx(%00000) ' %00000 =
LCD.tx(%00100) ' %00100 = *
LCD.tx(%01110) ' %01110 = * * *
LCD.tx(%11111) ' %11111 = * * * * *
LCD.tx(%01110) ' %01110 = * * *
LCD.tx(%00100) ' %00100 = *
LCD.tx(%00000) ' %00000 =
LCD.tx(%00000) ' %00000 =
LCD.tx(2) ' Display the new custom character 2
Playing Music
The Serial LCD has a built-in piezoelectric speaker which can play musical notes. The LCD includes a
sophisticated music player enabling users to program songs and tunes. You can play musical notes by
sending three types of note commands (Dec 214 to 232), as shown in the command set table.
Set Length
The “set length” commands (Dec 208 to 214) determines the length of time each note will play for. This
value remains the same until another “set length” command is received. A note’s length can range from
a 1/64
th
note to a whole note. A whole note is 2 seconds long.

27976

Mfr. #:
Manufacturer:
Parallax
Description:
LCD Character Display Modules & Accessories 2x16 Serial LCD Non Backlit Version
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet