Академический Документы
Профессиональный Документы
Культура Документы
Part list:
1. 2. 3.
Functions:1.
Void DisplayRow (int row, char *str):pass pointer to 16 character string displays the message on line1 or line2 of LCD, depending on whether row is 1 or 2.
2.
LcdInit( );
LCD Commands for Initialization HD44780 instruction set Code R/ W RS DB 7 0 0 Executio n Time**
Instruction
DB6
Description
Clear display
Clear display and returns cursor to the 1.64mS home position (address 0) Returns cursor to home position (address 0). Also returns 1.64mS display
Cursor home
0 0
0 0 0
I/D
0 0 0
0 0 0
S/C
R/L
being shifted to original position. DDRAM contents remains unchanged. Sets cursor move direction (I/D), specifies to shift the display (S). 40uS These operations are performed during data read/write. Sets On/Off of all display (D), cursor On/Off (C) 40uS and blink of cursor position character (B). Sets cursormove or displayshift(S/C), shift Direction 40uS (R/L). DDRAM contents remains unchanged. Sets interface data length (DL), 40uS number of
Function set
DL
address
0 0
CGRAM
0 1
1 BF
Data is sent 40uS or received after this setting. Sets the DDRAM address. data is sent 40uS or received after this setting. Reads Busyflag(BF) indicating internal operation is being 0uS performed and reads address counter contents Writes data to CGRAM 40uS or DDRAM. Reads data from CGRAM or DDRAM
40uS
Notes:
DDRAM = Display Data RAM. CGRAM = Character Generator RAM. DDRAM address corresponds to cursor position. Address Counter is used for both DDRAM and CGRAM.
Settings 0 = Decrement cursor position 0 = No display shift 0 = Display off 0 = Cursor off 0 = Cursor blink off 0 = Move cursor 0 = Shift left 0 = 4-bit interface 0 = 1/8 or 1/11 Duty ( 1 line ) 0 = 5 * 7 dots 0 = Can accept instruction 1= Increment cursor position 1 = Display shift 1 = Display on 1 = Cursor on 1 = Cursor blink on 1 = Shift display 1 = Shift right 1 = 8-bit interface 1 = 1/16 Duty (2 lines) 1 = 5 * 10 dots 1 = Internal operation in progress
Algorithm:
1. 2. 3. 4.
Initialize LCD Display SPJ Embedded on first line and Technologies on second line. Enter into infinite loop Check if sw1 key is pressed
a. b.
If yes, display sw1 pressed. If no, go to next step. If yes, display sw2 pressed. If no, go to next step.
5.
6.
If yes, display sw3 pressed. If no, go to next step. If yes, display sw4 pressed. If no, go to next step. If yes, display sw5 pressed. If no, go to next step. If yes, display sw6 pressed. If no, go to next step. If yes, display sw7 pressed. If no, go to next step. If yes, display sw8 pressed. If no, go to 3rd step.
7.
8.
9.
10.
11.
Conclusion:
Thus we have studied interfacing of keyboard and LCD with micro controller, LPC2148.