Sie sind auf Seite 1von 21

Character Based Liquid

Crystal Displays

ECET 209 – Lecture 12


Jeffrey J. Richardson
Character LCD’s

ECET 209 Purdue University 2


LCD Connections

ECET 209 Purdue University 3


LCD Connections

ECET 209 Purdue University 4


LCD Connections

ECET 209 Purdue University 5


Micro Control of LCD Backlight
VCC

VCC
2 3 1
14
DB7 VCC VO VSS
13
DB6
12
DB5
11
10
DB4 Character LCD Line1 A

9
DB3
DB2
Character LCD Line2 K

8
DB1
7
DB0 E R/W RS
6 5 4

VCC
Microcontroller

ECET 209 Purdue University 6


Serial LCD’s
Serial LCD’s VCC

VCC
2 3 1
14
DB7 VCC VO VSS
13
Asynchronous 12
DB6
Serial 11
DB5
Character LCD Line1 A
DB4
10
9
DB3
DB2
Character LCD Line2 K

8
DB1
7
Synchronous DB0 E R/W RS
Serial Microcontroller 6 5 4

VCC

Two-wire
Interface

ECET 209 Purdue University 7


Serial LCD Daughterboard

Images are from Sparkfun.com

ECET 209 Purdue University 8


Character LCD’s

ECET 209 Purdue University 9


Liquid Crystal Displays

• Display ASCII characters


– Can also display “special” symbols
• Require information to be written
– Write data
– Write control commands
• Allow data to be read

ECET 209 Purdue University 10


Character LCD’s

• Must write both data and control words to


LCD’s
• Commands:
– Clear the display
– Position the cursor
– Turn the cursor on or off
– Control the style of cursor (line or block)

ECET 209 Purdue University 11


Character LCD’s

• Must write both data and control words to


LCD’s
• Data:
– Strings of ASCII text
– Numbers (also in ASCII)

ECET 209 Purdue University 12


LCD Instructions

ECET 209 Purdue University 13


LCD Instructions – Cursor Location
Code
Instruction Description
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0

Set DD RAM
0 0 1 DD Adress Set the DD RAM Address (position the cursor)
Address

ECET 209 Purdue University 14


LCD Instructions – Cursor Location

ECET 209 Purdue University 15


LCD Instructions – Cursor Location

Character LCD Line1


Character LCD Line2
Character LCD Line3
Character LCD Line4

Address of the first character is 8410


Address of the first character is 2010
Address of the first character is 6410
Address of the first character is 010
ECET 209 Purdue University 16
ECET 209 Purdue University 17
Sending Serial Data

• Printf works with the serial port…all we


need is a connection to the LCD

• Configure USART for 9600, N, 8,1

• printf(”LCD Test Program…”);

ECET 209 Purdue University 18


Actual Serial Connection

ECET 209 Purdue University 19


Sending Serial Commands

• Sending commands is a 2 step process


– First we send 0xFE
– Second we send the actual command value

• Utilize the putchar() function to send single


values to the LCD
– putchar(0xFE); // sending a command…
– putchar(0x01); // clear and home the LCD

ECET 209 Purdue University 20


Questions?

ECET 209 Purdue University 21

Das könnte Ihnen auch gefallen