LCD and Keyboard Interface: Pin Descriptions, Command Codes, Connections

chapter 3 n.w
1 / 15
Embed
Share

Explore pin descriptions for LCD interfacing, common command codes, microcontroller connections, addressing commands, cursor addresses for various LCDs, and write/read timing specifics. Gain insights into interfacing LCDs and keyboards efficiently.

  • LCD interface
  • Keyboard interfacing
  • Pin descriptions
  • Command codes
  • Microcontroller connections

Uploaded on | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Chapter 3 LCD and Keyboard Interfacing 1

  2. Pin Descriptions for LCD Pin 1 2 3 4 Symbol VSS VCC VEE RS I/O -- -- -- I Description Ground +5V power supply Power supply to control contrast RS = 0 to select command register, RS = 1 to select data register R/W = 0 for write, R/W = 1 for read Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 4/8-bit data bus The 4/8-bit data bus The 4/8-bit data bus The 4/8-bit data bus 5 R/W I 6 7 8 9 10 11 12 13 14 E I DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 I/O I/O I/O I/O I/O I/O I/O I/O 2

  3. Pin Positions for Various LCDs from Optrex 3

  4. Some commonly used LCD Command Codes Code (Hex) Command to LCD Instruction Register 1 Clear display screen 2 Return cursor home 6 Increment cursor (shift cursor to right) F Display on, cursor blinking 80 Force cursor to beginning of 1st line C0 Force cursor to beginning of 2nd line 38 2 lines and 5x7 character (8-bit data, D0 to D7) 28 2 lines and 5x7 character (4-bit data, D4 to D7) 4

  5. LCD Connection to Microcontroller 5

  6. LCD Connection for 4-bit Data 6

  7. LCD Addressing Commands DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Line 1 (min) 1 0 0 0 0 0 0 0 Line 1 (max) 1 0 1 0 0 1 1 1 Line 2 (min) 1 1 0 0 0 0 0 0 Line 2 (max) 1 1 1 0 0 1 1 1 7

  8. Cursor Addresses for Some LCDs 16x2 LCD 20x4 LCD 80 81 82 83 84 8F C0 C1 C2 C3 C4 CF 80 81 82 83 84 93 C0 C1 C2 C3 C4 D3 94 95 96 97 98 A7 D4 D5 D6 D7 D8 E7 20x1 LCD 80 81 82 83 84 93 20x2 LCD 40x2 LCD 80 81 82 83 84 93 C0 C1 C2 C3 C4 D3 80 81 82 83 84 A7 C0 C1 C2 C3 C4 E7 8

  9. LCD Write Timing 9

  10. LCD Read Timing 10

  11. List of LCD Instructions DB 2 1 B0 0 0 1 Clears entire display and sets DD RAM address 0 in address counter Sets DD RAM address to 0 as address counter. Also returns display being shifted to original positions. DD RAM contents remain unchanged. Sets cursor move direction and specifies shift of display. These operations are performed during data write and read. Execution Time (Max) 1.64 ms R S 0 R/ W 0 D B7 0 D B6 0 D B5 0 DB 4 0 DB 3 0 DB D Instruction Description Clear display Return Home 0 0 0 0 0 0 0 0 1 - 1.64 ms Entry Mode Set 0 0 0 0 0 0 0 1 I/D S 40 s Display On/Off Control Cursor or Display shift Function Set Set CG RAM Address Set DD RAM Address Read Busy Flag & Address Write Data CG or DD RAM Read Data CG or DD RAM 0 0 0 0 0 0 1 D C B Sets On/Off of entire display (D), cursor On/Off (C), and blink of cursor position character (B). 40 s S/ C R/ L F 0 0 0 0 0 1 - - Moves cursor and shifts display without changing DD RAM contents. 40 s 0 0 0 0 1 DL N - - Sets interface data length (DL), number of display lines (L), and character font (F) 40 s 0 0 0 1 AGC Sets CG RAM address. CG RAM data is sent and received after this setting. 40 s 0 0 1 ADD Sets DD RAM address. DD RAM data is sent and received after this setting. 40 s B F 0 1 AC Reads Busy flag (BF) indicating internal operation is being performed and reads address counter contents. 40 s 1 0 Write Data Writes data into DD or CG RAM. 40 s 1 1 Read Data Reads data from DD or CG RAM. 40 s 11

  12. List of LCD Instructions (Abbreviations) DD RAM: Display data RAM CG RAM: Character generator RAM AGC: CG RAM address ADD: DD RAM address, corresponds to cursor address AC: address counter used for both DD and CG RAM addresses I/D: 1 = Increment, 0: Decrement S =1: Accompanies display shift S/C: 1 = Display shift, 0: Cursor move R/L: 1: Shift to the right, 0: Shift to the left DL: 1 = 8 bits, 0 = 4 bits N: 1 = 2-line, 0 = 1-line F: 1 = 5 x 10 dots, 0 = 5 x 7 dots BF: 1 = Internal operation, 0 = Can accept instruction 12

  13. Matrix Keyboard Connection to Ports 13

  14. The Flowchart for Key Press Detection and Identification 14

  15. Switch contact bounces 15

More Related Content