Assembled Serial LCD #115 with Big Numbers with 20X4 LCD (Variable LED Backlight)

Note. This item has been discontinued. Please see my LCD #117 offerings.


The Serial LCD #115 is an assmbled unit featuring;

All of the features of my popular LCD Kit #117 (9600 baud) and LCD Kit #108 (2400 baud) designs.

These include;

The LCD #115 Assembled Serial LCD adds a number of features;

This is not offered in kit form. The LCD #115 PIC processor is code protected and the source code is not provided.

I believe this to be the most versatile serial LCD interface available on the market, with a 64 byte receive buffer, the ability to interface with a variety of LCD geometries, EEPROM storage of the LCD geometry, eight user defined characters, tab size and cursor style, a rich plain language instruction set, a user defined text screen, "big number" format, two general purpose outputs and an interface with a speaker or similar to provide a "beep". All at half the price of lesser units.

Daughter Board

The daughter board is a small unit developed by Oatley Electronics in Australia as a part of their K221 kit which attaches to the back of the LCD using a 16-terminal female SIP connector. Unlike many designs, this permits the user to quickly swap out LCDs without desoldering.

User interface connections are made to the ten terminal SIP male connector. These pins may be accessed on either side of the board.

The processor does not provide for variable contrast. Two fixed resistors, 4.7K and 330, are used to provide nominally 0.3 VDC for contrast.

The processor provides a 64 character buffer. However, certain commands involve writing to EEPROM during which time, the processor is put in a sleep mode for about 20 ms per EEPROM byte. Any characters received during this time will be missed. Thus, in the interfacing program, provide a delay of about 50 ms after sending a command which involves writing to EEPROM.

A source of +5 VDC with a minimum current of 10 mA is required for this design. If the interfacing LCDs LED back light feature is used, the back light current must be limited to less than 200 mA. The design includes a 4.7 Ohm resistor on the board which is suitable for use with +5 VDC. For backlight operation with +12 VDC, use an external 39 Ohm resistor.

LCD Commands.

A partial list of various commands follows. Note that all commands are prefaced with a "?" and the commands are case sensitive.

?a - set cursor to home position.
?b - destructive backspace
?f - clear LCD and leave cursor at home position
?g - beep
?h - backspace
?i - forward cursor
?j - down cursor
?k - up cursor
?l - clear current line and leave cursor at the beginning of the line
?m - carriage return.  Position the cursor at the beginning of the current line.
?n - new line.  Advance to the beginning of the next line and clear this line.
?t - tab.  Advance the cursor one tab.

?? - display the character '?'.

Note that the "?g" causes a 50 ms burst of nominally 500 Hz on a processor output. The LCD #115 design does not include the interfacing audible device.

The cursor may be set to any position using the x and y commands;

Note that the line number, follows the 'y' command and the column number, consisting of two digits, follows the 'x' command.

Thus, outputting the string;

positions the cursor at column 10 of line 1 and then prints "Hello", followed by a newline which also clears the next line.

Note that the line and column numbers begins with 0. Thus, for a 4 X 20 LCD, valid lines are 0 - 3 and valid columns are 00 - 19.

Any of eight user defined characters may be displayed using the digits 0 - 7. Thus;

causes user defined character 5 followed by user character 2 to be displayed on the LCD. Defining the user characters is discussed below.

A user text screen may be displayed at any time using the command;

I ship this with the customized text message as simply all numbers and characters. This may be modified using the ?C command which is discussed below.

Big Number Mode

The LCD #115 design provides both three and four block wide characters. The big number mode is entered;

On receipt of either of the "?>3" or "?>4" commands, the processor will download to the LCD the special required to display the big numbers. These are probably different from any user defined characters which the user may have defined. Thus, don't display your user defined characters when displaying in the "big number" format.

The cursor is then located on the top row of the current column.

In the >3 mode, as each numeric digit is received, it will erase anything appearing in the three column wide by four high space and display the number in the big number format. In addition, it will clear the column to the right of the character. The cursor will then be located at the top row for display of the next digit. Note that for the three block wide mode, this is four columns to the right of the upper left of the previous character. Thus, each digit uses four columns, three for the display of the digit and one for the spacing between digits.

Display of the minus sign, colon and decimal point use two columns, one for the display of the symbol plus one space.

The >4 mode is similar, except that each digit is four wide plus one space.

There is no intelligent "wrapping" provision for the "big number" mode. Thus, if there are only two columns remaining before the end of the LCD and you attempt to display a "7", part of the "7" will appear on the right side of the LCD, and the rest on the beginning of the display.

The big number mode may be exited at any time:


This may be used to display ordinary text along with the "big number" characters. For example, in one of the photos, the message "4X4 Demo" appears. This might be done;

    "?y0?x164X4"  ' row 0, beginning at column 16
    "?y1?x16Demo" ' row 1, beginning at column 16

Note that the "?< command simply exits the "big number" mode. It does not download the user defined characters that might be used for graphics.

If one later wishes to use the user defined characters;

    "?R"  ' restore the user defined characters.
Again, note that the characters associated with the display of the "big number" characters are not compatible with the user defined characters one might use for plotting and thus, "big numbers" and graphics type applications using specially defined characters cannot coexist on the display.

Configuration Commands.

A number of parameters are stored in the processors EEPROM. This includes the geometry of the LCD, the type of cursor, the number of spaces in a tab, the eight user defined characters, defining a custom splash screen of text, selection of the screen which is displayed on boot and the backlight intensity setting.

The default is a 20 X 4 LCD, a tab size of 4, a full blinking cursor (3), eight special characters consisting of a single horizontal line, two horizontal lines, etc., a backlight intensity setting of 00, a text screen consisting lower case letters "a-t", "A-T" and two rows of numbers (see photo). The default screen which is selected for bootup is the configuration screen which displays the geometry, tab size, specially defined characters, the backlight setting and the cursor type.

All of these parameters may be modified. Note that when the modifications are made, the new values are written to the processor's EEPROM and thus need only be modified once.

Note that after sending commands which cause the processor to save data to EEPROM, provide a 100 ms delay prior to sending additional characters. Otherwise the addtional characters may be lost.

Set LCD Geometry

Setting the geometry defines the configuration of the interfacing LCD.

For example;
indicates the LCD is a 4X20 configuration.

Note that appropriate configurations include 2X16, 2X20, 2X24, 2X40, 4X16 and 4X20. Note that the unit is shipped with a 4 X 20 LCD. However, the design provides the capability to interface with these other geometries.

Set Tab

The tab size may be set;

In this case, the tab size is set to five. Valid values of the tab are 1 - 8.

When this command is received by the processor, the new tab size is written to EEPROM and this value is used thereafter when executing the ?t command.

When executing the ?t command, the cursor is advanced, and any characters in its path are overwritten with a space. For example, if the cursor is in column 3 and the tab size is 5, the cursor will advance to column 5. Anything in columns 3 and 4 will be replaced with spaces.

Backlight Intensity

The intensity of an LED backlight on the associated LCD may be adjusted;

Note that the digits following the "B" are two digit hexadecimal, ranging from 00 (back light off) to FF (back light full on). This command causes an output to change duty cycle over the range of 0 to 255/256. The output is used to switch a power transistor which then controls the avarage backlight current.

Set Cursor Style

The style of the cursor may be set using the ?c command.

where the number is in the range of 0-3. A 0 configures as no cursor, a 2 as a non blinking cursor and a 3 as a blinking cursor. As with the set geometry and set tab, the style of the cursor is saved to EEPROM.

User Defined Characters.

User defined characters may be defined using the ?D command;

The number after the 'D' is the number associated with the user defined character, in this case user defined character 3. This is then followed by the eight data bytes expressed in two digit hexadecimal. Note that the hexadecimal letters must be lower case.

In this example, lines 0, 1, 2, 3 and 4 consist of no pixels and lines 5, 6 and 7 consist of all five pixels. Thus, when user defined character 3 is displayed using the command ?3, a character consisting of the lower three lines will be displayed.

Each user defined character is saved in EEPROM.

Custom Text Screen

The customized text screen may be an advertisement which is displayed on boot or a template which may be displayed at any time. It is set using the ?C command, followed by the row, followed by the twenty characters which are to appear on the row. For example, the following sequence defines the custom screen shown in the photo.


Note that this custom screen may be displayed at any time;


Boot Screen Selection

The screen which is displayed on boot may be specified using the ?S command followed by a number, 0, 1 or 2.

   "?S1"  ' display the configuration setting on boot
   "?S0"  ' display no screen on boot.
   "?S2"  ' display the user custom text screen on boot.

Direct Control of the LCD.

Commands may be directly passed to the LCD using the ?! command;

In this example the command 01 is sent directly to the LCD which clears the LCD.

A word of caution. With all other commands the program keeps track of the current cursor position. This is not done with commands sent directly to the LCD using the ?! command. Thus, if the user configures the LCD such that the cursor is located at some point, subsequent line feeds and similar will not work correctly as the program does not know the current cursor location.

Clearly, if the ?! command is used to place the LCD in a mode such that the cursor is decremented with each character or the display itself is scrolled, the subsequent operation of the LCD which assumes an incrementing cursor and a fixed display will give unpredictable results.

General Purpose Outputs

The LCD #115 provides two general purpose TTL outputs. Either of these outputs, 4 and 5, may be brought high or low using the 'H' and 'L' commands.

The above brings output 4 high and output 5 low. Note that outputs 0, 1, 2, 3 and 6 and 7 are not valid.

On power up, all outputs are at a high impedance (configured as inputs). As each output is addressed, it is taken out of the high impedance state. The initial high impedance state permits the user to use either pull up or pull down resistors to avoid "bounce" when the processor is powered.

The current (source or sink) by any output should be limited to 15 mA.

Sample Routine

Most of the features of the LCD #115 are illustrated in the following routine which was written for the PICAXE-18X. Note that the "beep" function may be tested using the test LED on terminal 6 of the PIC. Operation of the 'H' and 'L" output commands may be similarly tested using the test LED.

One important point. Normally, when idle the serial terminal is at a logic one. When a character is sent, the lead is brought low for 1/2400 secs (start bit) followed by the data bits. However, when the PICAXE is booted, the output is initially at a high impedance and is then brought to an output logic zero. Thus, prior to executing the first SerOut instruction, it is important to bring the output to a logic one and pause briefly.

' Illustrates many capabilities of the LCD #115 PICAXE LCD
' Congigures the interfacing LCD for 4X20 geometry.  This need only be done one time as
' this is saved in the LCD #115 EEPROM
' Clears the LCD using the "?f" command.
' Writes some text.  Note the new line function "?n"
' Displays the user defined characters using commands ?0, ?1, etc
' Moves cursor to line 1, col 00 using commands "?y1" and "?x00"
' Clears lines 1, 2 and 3 using "?l" command.  Note "?j" is used for down cursor.
' Positions cursor at line 1 and displays the values of N and Word in decimal and in Hexadecimal.
' Defines new user defined characters consisting of no vertical lines, 1 vertical line,
' etc through 5 vertical lines.
' A bar scaled to 0 through 25 is displayed on line 3.  This might be used to graphically
' display a quantity.
' The PWM duty cycle is then set to 25 steps over the range of 00 to 250 using the ?B command.
' The duty cycle is also displayed on the LCD.
' The program then continually sets the two general purpose outs to 10 and 01 using the ?H and
' ?L commands.
' Peter H Anderson, Baltimore, MD, Feb, '04

   Symbol N = B2
   Symbol OWord = W0
   Symbol OByte = B3

   ' These variables are used in Sub BarDemo
   Symbol NN = B8
   Symbol LeftOver = B9
   Symbol Num_5 = B10
   Symbol J = B11

   ' These variables are used in Sub SerOutByteHex
   Symbol X = B8

   ' Variables used in PWMDemo
   Symbol Duty = B9

   High 0		' Be sure Tx Pin is idle for some time
   Pause 5000		' wait for PICAXE LCD to boot

   SerOut 0, T2400, ("?G420")			' configure LCD as 4 X 20
   SerOut 0, T2400, ("?f")			' clear the LCD and home the cursor

   Pause 100
   SerOut 0, T2400, ( "    PICAXE LCD?n")	' note new line

   SerOut 0, T2400, ("")

   SerOut 0, T2400, ("?0?1?2?3?4?5?6?7?n")		' display special characters

   Pause 2000			' pause to admire

   SerOut 0, T2400, ("?y1?x00")						' position cursor at beginning of row 1

   SerOut 0, T2400, ("?l?j?l?j?l?y1")				' clear lines 1, 2 and 3 and start at line 1
   ' note the use of down cursor command

   OWord = 12345

   For N = 0 to 25
      SerOut 0, T2400, ("?x00?y1")	' locate cursor to beginning of line 1

      SerOut 0, T2400, (#N)		'  display in decimal
      SerOut 0, T2400, ("?t")

      OByte = N
      GoSub SerOutByteHex     		' display in hex
      SerOut 0, T2400, ("?t")

      SerOut 0, T2400, (#OWord, "?t")	' display a word in decimal

      GoSub SerOutWordHex			' and in hex
      SerOut 0, T2400, ("?n")

      OWord = OWord + 1

      SerOut 0, T2400, ("?g")		' beep
      Pause 1000

   SerOut 0, T2400, ("?D00000000000000000")		' define special characters
   Pause 200					' delay to allow EEPROM to program

   SerOut 0, T2400, ("?D11010101010101010")
   Pause 200

   SerOut 0, T2400, ("?D21818181818181818")
   Pause 200

   SerOut 0, T2400, ("?D31c1c1c1c1c1c1c1c")
   Pause 200

   SerOut 0, T2400, ("?D41e1e1e1e1e1e1e1e")
   Pause 200

   SerOut 0, T2400, ("?D51f1f1f1f1f1f1f1f")
   Pause 200

   SerOut 0, T2400, ("?c0")		' no cursor

   SerOut 0, T2400, ("?y3?x00?l")	' cursor to beginning of line 3 and clear line

   GoSub BarDemo

   Pause 200

   GoSub PWMDemo

   Pause 200

AGAIN:   					' continually bring outputs 5 annd 4 high and low
   SerOut 0, T2400, ("?H5?L4")
   SerOut 0, T2400, (".")
   Pause 500
   SerOut 0, T2400, ("?L5?H4")
   SerOut 0, T2400, ("!")
   Pause 500


   For N = 0 to 25				' increasing bar
      SerOut 0, T2400, ("?y3?x00")
      NN = 4 * N
      Num_5 = NN / 5
      LeftOver = NN % 5
      For J = 1 to Num_5
         SerOut 0, T2400, ("?5")
      LeftOver = LeftOver + 48		' convert to a character
      SerOut 0, T2400, ("?", LeftOver)

   For N = 0 to 25			' decreasing bar
      SerOut 0, T2400, ("?y3?x00?l")
      NN = 4 * N
      NN = 100 - NN
      Num_5 = NN / 5
      LeftOver = NN % 5
      For J = 1 to Num_5
         SerOut 0, T2400, ("?5")

      LeftOver = LeftOver + 48		' convert to a character
      SerOut 0, T2400, ("?", LeftOver)


    SerOut 0, T2400, ("?f")	' clear the LCD
    SerOut 0, T2400, ("  PWM Duty Demo?n")
    For N = 0 to 25
       Duty = 10 * N
       SerOut 0, T2400, ("?l")
       OByte = Duty
       GoSub SerOutByteHex	' display the PWM in hex

       SerOut 0, T2400, ("?B")	' backlight control
       GoSub SeroutByteHex
       Pause 200

    SerOut 0, T2400, ("?f")	' clear the LCD
    SerOut 0, T2400, ("?B00")	' set PWM to 0


    X = OByte / 16	' high nibble
    X = X + 48		' add the character '0'

    If X <= 57 Then SerOutByteHex_1
       X = X + 7	' it is alphabetic; A, B, C, D, E, F

    SerOut 0, T2400, (X)

    X = Obyte % 16	' low nibble
    X = X + 48		' add the character '0'

    If X <= 57 Then SerOutByteHex_2
       X = X + 7	' it is alphabetic; A, B, C, D, E, F

    SerOut 0, T2400, (X)



    OByte = OWord / 256
    GoSub SerOutByteHex
    OByte = OWord % 256
    GoSub SerOutByteHex