-
Notifications
You must be signed in to change notification settings - Fork 17
Home
Todo:
JST connections: https://www.sparkfun.com/tutorials/246 current draw at various on/off configurations
##1 Overview
The SerLCD v2.5 is a simple and cost effective solution for interfacing to Liquid Crystal Displays (LCDs) based on the HD44780 controller. The SerLCD module takes incoming 9600bps TTL level signals and displays those characters on the LCD screen. Only three wires - 5V, GND, and Signal - are needed to interface to the LCD.
Please report typos, inaccuracies, and especially unclear explanations to us at spark@sparkfun.com. Suggestions for improvements are welcome and greatly valued.
###1.1 Features in Version 2.5
SerLCD v2.5 has some new features that make the SerLCD even more powerful and economical:
- New PIC 16F688 utilizes onboard UART for greater communication accuracy
- Adjustable baud rates of 2400, 4800, 9600 (default), 14400, 19200, and 38400
- Operational backspace
- Greater process speed at 10MHz
- Incoming buffer stores up to 80 characters
- Backlight transistor can handle up to 1 amp
- Pulse width modulation of backlight allows direct control of backlight brightness and current consumption
- All surface mount design allows a backpack that is half the size of the original
- Faster boot-up time
- User definable splash screen
- Boot-up display can be turned on/off via firmware
##2 Interface Specifications
Default communications occur at 9600 bps with 8 bits of data, 1 start bit, 1 stop bit, and no parity.
The SerLCD is controlled using actual ASCII characters. This means that if you pass the ASCII character 'r' to the module an 'r' will be display on the LCD at the next cursor position. There are only two exceptions to this. These are the command characters decimal 254 (0xFE) and 124 (0x7C).
##3 Configuration
All setting are stored on onboard EEPROM and loaded during power up.
###3.1 Backlight
The SerLCD v2.5 pulse width modulates the backlight via a 1A BJT transistor. This allows the user to set 1 of 30 different brightness settings.
Backlight Brightness | Value |
---|---|
Off | 128 |
40% On | 140 |
73% On | 150 |
Fully On | 157 |
Not Valid | 158 |
By sending the special command character 0x7C (decimal 124) followed by a number 128 to 157 the backlight PWM value will be set. This is handy when power consumption of the unit must be minimized. By reducing the brightness the overall backlight current consumption is reduced.
###3.2 LCD Type Setup
The SerLCD v2.5 firwamre includes settings to interface to the following types of LCDs: 2x16, 2x20, 4x16, 4x20. See also the Command Set or the SparkFun Hookup Guide.
If you purchase the SerLCD soldered to an LCD it has already been configured to work with that specific LCD. You should not have to configure anything.
LCD Type | Value |
---|---|
20 Characters Wide | 3 |
16 Characters Wide | 4 |
4 Lines | 5 |
2 Lines | 6 |
If you purchased the SerLCD module by itself you will have to tell the module what type of LCD it is going to be or is currently attached to.
To control what type of LCD the SerLCD module is attached to transmit the special command - 124 (0x7C). Follow this command with either 3, 4, 5, or 6. These commands set the LCD character width and number of lines. These settings are used to correctly wrap the cursor to keep it within the viewable screen. The type of LCD is saved to EEPROM after each change.
###3.3 Extended LCD Commands
The HD44780 LCD controller is very common. The extended commands for this chip include but are not limited to following:
HD44780 Command | Value (HEX) |
---|---|
Clear Display | 0x01 |
Move cursor right one | 0x14 |
Move cursor left one | 0x10 |
Scroll right | 0x1C |
Scroll left | 0x18 |
Turn visual display on | 0x0C |
Turn visual display off | 0x08 |
Underline cursor on | 0x0E |
Underline cursor off | 0x0C |
Blinking box cursor on | 0x0D |
Blinking box cursor off | 0x0C |
Set cursor position | 0x80 + number |
Please refer to the HD44780 datasheet for more information.
Clear display and set cursor position are the two commands that affect the SerLCD the most. By sending these commands to the SerLCD the cursor position gets changed. This change is tracked by the firmware and cursor wrapping is performed normally. A cursor move to outside the viewable area is possible and the cursor position variable will be updated accurately.
The viewable area cursor positions are as follows for almost all HD44780 based LCDs:
16 Character Displays:
Line Number | Viewable Cursor Positions |
---|---|
1 | 0-15 |
2 | 64-79 |
3 | 16-30 |
4 | 80-95 |
20 Character Displays:
Line Number | Viewable Cursor Positions |
---|---|
1 | 0-19 |
2 | 64-83 |
3 | 20-39 |
4 | 84-103 |
To perform a cursor move a series of steps must occur:
-
You will need to determine the correct decimal position to move to. For example, the viewable position three on the second line of a 16 character display is 66.
-
Set bit 7 (the highest bit) of that decimal number to '1'. Position 66 + 128 = 194.
-
Now transmit the special character 254 to tell the SerLCD you want to send a command.
-
Finally, transmit the number 194. The cursor is now sitting in the third position of the second line.
###3.4 Splash Screen
The SerLCD v2.5 displays a splash screen by default. The splash screen ('SparkFun.com SerLCD v2') verifies that the unit is powered, working correctly, and that the connection to the LCD is correct.
The splash screen is displayed for 500ms during boot-up and may be turned off if desired.
A new addition to the v2.5 firmware is the ability for the user to set their own splash scree (2 lines). To do this just set up the top 2 lines as you would like them to appear, then send the special character 124 (0x7C) followed by decimal 10 (0x0A) to save it to memory. To test just cycle power.
To display the splash screen send special character 124 (0x7C) to the unit followed by decimal 9. Every time this command is sent to the unit the Splash Screen Display option will toggle. That is, if the splash screen is currently being displayed, sending the 0x7C 0x09 commend will disable the splash screen during the next boot. Sending the 0x7C 0x09 command again will enable the splash screen.
###3.4 Changing the Baud Rate
The SerLCD v2.5 defaults to 9600 baud but can be set to a variety of baud rates. To change the baud rate first enter the command character 124 then:
- 2400 baud enter 11 (0x0B)
- 4800 baud enter 12 (0x0C)
- 9600 baud enter 13 (0x0D)
- 14400 baud enter 14 (0x0E)
- 19200 baud enter 15 (0x0F)
- 38400 baud enter 16 (0x10)
If the SerLCD gets into an unknown state or you otherwise can't communicate with it enter 18 (0x12) at 9600 baud while the splash screen is active and the unit will reset to 9600 baud.
##4 Hardware
###4.1 VCC and Current Draw
The SerLCD v2.5 should only be powered by 5V DC. Higher than 5.5V will cause damaged to the PIC, LCD, and backlight (if attached).
###4.2 Contrast Control
Ther SerLCD v2.5 comes equipped with a 10k potentiometer to control the contrast of the LCD. This is set during assembly and testing but may need adjustment for your specific LCD module. Temperature and supply voltage can effect the contrast of the LCD.
###4.3 Hi-Current Control Pin
The SerLCD v2.5 uses a general purpose 1000mA PNP transistor to control the backlight. If you purchased the SerLCD module you may use this pin as a general purpose, high power control pin. If you issue the backlight on/off command to the SerLCD pin 15 (next to the last pin) will source VCC on/off. Pin 16 (last pin above 'www.sparkfun.com') is connected to ground.
##5 Revisions
###Version 3
Version 3.0 of SerLCD utilized the Atmel ATmega328P and ran at 10MHz. This version was first produced in April of 2015.
###Version 2.5
Version 2.5 of SerLCD utilized the PIC 16LF88 and ran at 10MHz. This version was in production from July of 2006 through September of 2015.
###Version 2
Version 2 of SerLCD utilized the PIC 16F688 and ran at 8MHz. This version was in production prior to June of 2006.