Inte rfacing the 16X2 LCD to the PIC18 •

As per the name the 2x16 has 2 lines with 16 characters on each lines.



It supports all the ASCII characters and is basically used for displaying the alpha numeric characters.



Here each character is displayed in a matrix of 5x7 pixels.



Apart from alpha numeric characters it also provides the provision to display the custom characters by creating the pattern.



Scope of this topic is to show how to display the alpha numeric characters on LCD, Generating and displaying the custom characters.

An LCD screen consists of two lines each containing 16 characters. Each character consists of 5x7 or 5x11 dot matrix. The most commonly used display, i.e. the 5x7 with one space 5x8 character display.

Pin Number

Symbol

Pin Function

1

VSS

Ground

2

VCC

+5v

3

VEE

Contrast adjustment (VO)

4

RS

Register Select---0:Command, 1: Data

5

R/W

Read/Write, R/W=0 Write & R/W=1 Read

6

EN

Enable-Falling edge triggered

7

D0

Data Bit 0 (Not used in 4-bit operation)

8

D1

Data Bit 1 (Not used in 4-bit operation)

9

D2

Data Bit 2 (Not used in 4-bit operation)

10

D3

Data Bit 3 (Not used in 4-bit operation)

11

D4

Data Bit 4

12

D5

Data Bit 5

13

D6

Data Bit 6

14

D7

Data Bit 7/Busy Flag

15

A/LED+

Back- light Anode(+)

16

K/LED-

Back-Light Cathode(-)

Display contrast depends on the power supply voltage and whether messages are displayed. For this reason, varying voltage 0-Vdd is applied on the pin marked as VEE. Trimmer potentiometer is usually used for that purpose.



Apart from the voltage supply connections the important pins from the programming perspective are the data lines(8-bit Data bus),



Register select, Read/Write and Enable pin.

Data Bus: 

As shown in the figure and table, an alpha numeric LCD has a 8-bit data bus referenced as D0-D7.



As it is a 8-bit data bus, we can send the data/command to LCD in bytes.



It also provides the provision to send the the data/command in chunks of 4-bit, which is used when there are limited number of IO lines on the microcontroller.

Register Select (RS): The LCD has two register namely a Data register and Command register. 

Any data that needs to be displayed on the LCD has to be written to the data register of LCD.



Command can be issued to LCD by writing it to Command register of LCD.



This signal is used to differentiate the data/command received by the LCD.



If the RS signal is LOW then the LCD interprets the 8-bit info as Command and writes it Command register and performs the action as per the command.



If the RS signal is HIGH then the LCD interprets the 8-bit info as data and copies it to data register.



After that the LCD decodes the data for generating the 5x7 pattern and finally displays on the LCD.

Read/Write (RW): This signal is used to write the data/cmd to LCD and reads the busy flag of LCD. • •

For write operation the RW should be LOW and for read operation the R/W should be HIGH.

• Enable (EN): This pin is used to send the enable trigger to LCD. • •

After sending the data/cmd, selecting the data/cmd register, Selecting the Write operation. A HIGH-to-LOW pulse has to be send on this enable pin which will latch the info into the LCD register and triggers the LCD to act accordingly. CGROM Memory CGROM memory contains the default character map with all characters that can be displayed on the screen. Each character is assigned to one memory location.

#include #define rs PORTCbits.RC0 #define rw PORTCbits.RC1 #define en PORTCbits.RC2

void void void void

lcddata(unsigned int); lcdcommand(unsigned int); lcdinit(void); MSDelay( int itime);

void MSDelay( int itime) { unsigned int i, j; for(i=0;i
while(1) { lcdinit(); lcdcommand(0X86); lcddata('E'); lcddata('C'); lcddata('E'); MSDelay(500); lcdcommand(0XC1); for(i=0;a[i]!=0;i++) { lcddata (a[i]); } MSDelay(500); } }

Inte rfacing the keyboard to the PIC18

   

At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and columns through ports; therefore, with two 8-bit ports, an 8 x 8 matrix of keys can be connected to a microprocessor. When a key is pressed, a row and a column make a contact; otherwise, there is no connection between rows and columns. In programming for keypad interfacing we must have two processes: (a) key press detection, and (b) key identification.

There are two ways by which the PIC 18 can perform key press detection: (1) the interrupt method, and (2) the scanning method. Scanning method for key press detection







 

Key press detection is by scanning. In this method, to detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, then it reads the columns. If the data read from the columns are equal to nil, no key has been pressed and the process continues until a key press is detected. If one of the column bits has a zero, however, this means that a key press has occurred. After a key press is detected, the microcontroller will go through the process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a LOW to the first row only; then it reads the columns. If the data read is all Is, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, and checks for any zero. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. This should be easy since the microcontroller knows at any time which row and column are being accessed. Figure shows the flowchart for this method.



The program implementation is given below

#include #include #define rs PORTCbits.RC0 #define rw PORTCbits.RC1 #define en PORTCbits.RC2 #define myport PORTC #define row1 PORTBbits.RB0 #define row2 PORTBbits.RB1 #define row3 PORTBbits.RB2 #define row4 PORTBbits.RB3 #define col1 PORTBbits.RB4 #define col2 PORTBbits.RB5 #define col3 PORTBbits.RB6 #define col4 PORTBbits.RB6 void delay(unsigned char t) {

unsigned char i,j; for(i=0;i
while(col2==0); lcddata('1'); } if(col3==0) { while(col3==0); lcddata('2'); } if(col4==0) { while(col4==0); lcddata('3'); } Delay10KTCYx(10); row1=1; row2=0; row3=1; row4=1; if(col1==0) { while(col1==0); lcddata('4'); } if(col2==0) { while(col2==0); lcddata('5'); } if(col3==0) { while(col3==0); lcddata('6'); } if(col4==0) { while(col4==0); lcddata('7'); } Delay10KTCYx(10); row1=1; row2=1; row3=0; row4=1; if(col1==0) { while(col1==0); lcddata('8'); }

if(col2==0) { while(col2==0); lcddata('9'); } if(col3==0) { while(col3==0); lcddata('A'); } if(col4==0) { while(col4==0); lcddata('B'); } Delay10KTCYx(10); row1=1; row2=1; row3=1; row4=0; if(col1==0) { while(col1==0); lcddata('C'); } if(col2==0) { while(col2==0); lcddata('C'); } if(col3==0) { while(col3==0); lcddata('E'); } if(col4==0) { while(col4==0); lcddata('F'); } } void main() { TRISD = 0x00;

TRISC=0x00; TRISB = 0xF0; PORTD=0x00; PORTC=0x00; lcdinit(); while(1) { keypad(); //always in while(1) } }

LCD and KEYPAD .pdf

Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. LCD and KEYPAD .pdf. LCD and KEYPAD .pdf. Open. Extract.

770KB Sizes 0 Downloads 182 Views

Recommend Documents

lcd backlight usb -> uart icsp lcd mcu keypad - GitHub
ADDR = WR:0xC2, RD:0xC3. PCA9530D. ADDR = WR:0xC0, RD:0xC1 ... 9. RA6/OSC2. 10. RC0. 11. RC1/CCP2. 12. RC2/CCP1. 13. RC3/SCK/SCL. 14.

LCD-CCM1620CSLS2.pdf
3、MECHANICAL PARAMETERS. Item Description Unit. LCM Outline Dimension 80.0 x 36.0 x13.0 (MAX) mm. Viewing Area 64.5 x 13.8 mm. Weight About 40.0 ...Missing:

Rims to Valley Keypad Responses - 160209.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Rims to Valley ...

LCD Trainer Kit.pdf
Page 4 of 76. LCD Trainer Kit.pdf. LCD Trainer Kit.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying LCD Trainer Kit.pdf. Page 1 of 76.

Optimized Layout for Keypad Entry System
Department of Computer Science and Engineering. National Institute of ... existing schemes including less-tap, predictive text entry. (on T9), prefix-based ...

PCD8544 (Nokia5110 LCD Driver).pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. PCD8544 ...

Keypad apparatus and method for inputting data and characters for a ...
Mar 29, 2002 - input to a cellular phone or small computer. Pushing the key ..... tion of the contact and the contact pad and the number of key operations by ...

LCD-Products-Training-Manual.pdf
Shot Put 11B Rings 3 & 4. Discus 14B. FINAL SCHEDULE AS OF 07/24/17. Page 3 of 3. LCD-Products-Training-Manual.pdf. LCD-Products-Training-Manual.pdf.

RPi-LCD-User-Manual.pdf
Descriptions: Under the HDMI display mode, you should use an external keyboard or SSH method. for command inputting, since the virtual keyboard is not available. Or you can set a serial port as a. debugging interface for command inputting. Page 3 of

man-31\honeywell-home-alarm-keypad-manual.pdf
man-31\honeywell-home-alarm-keypad-manual.pdf. man-31\honeywell-home-alarm-keypad-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

Optimized Layout for Keypad Entry System
Department of Computer Science and Engineering. National Institute of ... advent and popularity of short messaging service (SMS). There are ..... 365-371, 2001.

LCD-Products-Training-Manual.pdf
innovative mounting system, and additional multimedia content options. 3. Page 3 of 59. LCD-Products-Training-Manual.pdf. LCD-Products-Training-Manual.pdf.

LCD quotation upload Final PDF.pdf
Page 2 of 3. المادة : الرياضيات. المستوى : الثالثة ثانوي إعدادي. زاوية مركزية. نشاط تمهيدي1 : في هذا الشكل الزاوية BÔAرأسها هومركز الدائرة (C). و [OA] Ù

man-5\adt-honeywell-alarm-keypad-manual.pdf
man-5\adt-honeywell-alarm-keypad-manual.pdf. man-5\adt-honeywell-alarm-keypad-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

Improvised layout of keypad entry system for mobile ...
a 14-1-54, NITW Hostels, National Institute of Technology, Warangal, Andhra Pradesh, 506004, India b 14-1-43, NITW ... Since the size of wireless devices is ..... The terminal phase, the Fitt's Law phase, pertains to advanced stage of learning.

RPi-LCD-User-Manual.pdf
Apr 29, 2015 - ... videos (supports multi formats, MP4 and so on). Take photos by touching (up to 17 camera modes). Support software keyboard (system ...

Cheap FEP film for dlp-lcd printer .pdf
Cheap FEP film for dlp-lcd printer .pdf. Cheap FEP film for dlp-lcd printer .pdf. Open. Extract. Open with. Sign In. Main menu.

Cheap Promotion New Huion DWH69 Wireless LCD Screen ...
Cheap Promotion New Huion DWH69 Wireless LCD Scree ... Digital Pen Tablets Professional Pannel Black.pdf. Cheap Promotion New Huion DWH69 Wireless ...

Dual Interface LCD Display Controller BV4618 BV4618 Dual ... - GitHub
This could be monitored by the host. Pin. Function. 1 ... external source and depending on the host ..... This is probably best used with the ACK character as this.

Cheap NEW LCD Display Screen for Panasonic Lumix DMC-GF3 ...
Cheap NEW LCD Display Screen for Panasonic Lumix ... X1 GF3 GX1 Digital Camera Repair Part + Touch.pdf. Cheap NEW LCD Display Screen for Panasonic ...

Cheap 8.5 Inch LCD Writing Drawing Table Handwriting Board ...
Cheap 8.5 Inch LCD Writing Drawing Table Handwritin ... erless Office Memo Board Writeboard White Color.pdf. Cheap 8.5 Inch LCD Writing Drawing Table ...

Cheap Powstro Digital Signal Satellite Meter Ws-6906 3.5'' Lcd ...
Cheap Powstro Digital Signal Satellite Meter Ws-6906 ... Finder For Tv Av Free Shipping & Wholesale Price.pdf. Cheap Powstro Digital Signal Satellite Meter ...

Cheap Coolbaby Rs-20H 2.0Inch Color Lcd Screen Video Games ...
Cheap Coolbaby Rs-20H 2.0Inch Color Lcd Screen Vid ... ouble Handheld Free Shipping & Wholesale Price.pdf. Cheap Coolbaby Rs-20H 2.0Inch Color Lcd ...