260 likes | 947 Views
LCD INTERFACING. LCD OPERATION. LCD replaces LEDs Declining prices Ability to display numbers, characters and graphics Incorporation of a refreshing controller into the LCD Relieves the CPU from refreshing task Ease of programming for characters and graphics. LCD PIN DESCRIPTIONS.
E N D
LCD OPERATION LCD replaces LEDs Declining prices Ability to display numbers, characters and graphics Incorporation of a refreshing controller into the LCD Relieves the CPU from refreshing task Ease of programming for characters and graphics.
LCD PIN DESCRIPTIONS 14 pins 1 – Vss , Ground 2 - Vcc , +5V 3 – VEE, for controlling LCD contrast 4 – RS, Register Select, input pin two important registers inside LCD – Command Register and Data Register. RS pin is used for the selection of these registers RS = 0 to select command register, allows user to send command such as clear display, cursor at home etc. RS = 1 to select data register allows the user to send data to be displayed on the LCD
5 – R/W • Input pin • Allows the user to write information to LCD or read information from it. • R/W = 0 for write, =1 for read 6 – E, I/O, Enable • To latch information presented to its data pins • A high to low pulse must be applied to this pin to latch information. • Minimum duration 450ns.
7 – 14, data pins, DB0 – DB7, I/O • Used to send information to LCD or to read contents of LCD’s internal registers • To display letters and numbers we send ASCII codes for the letters A - Z, a – z, and numbers 0 -9 to these pins while Rs = 1. • Use RS = 0 to check the busy flag to see if LCD is ready to receive information. • Busy flag is D7 and can be read when R/W = 1, RS = 0 • When D7 = 1, LCD is busy and D7 = 0 LCD is ready to receive new information.
SENDING COMMANDS AND DATA TO LCD’S To send any command to LCD make pin RS = 0, for data RS = 1 Send a high to low pulse to E pin P1.0 to P1.7 are connected to LCD data pins P2.0 is connected to RS pin P2.1 is connected to R/W pin P2.2 is connected to E pin
PROGRAMME MOV A,#38H LCD 2 lines , 5x7 matrix ACALL CMTWRT ACALL DELAY MOV A, #0EH Cursor blinking ACALL CMTWRT ACALL DELAY MOV A,#01H Clear LCD ACALL CMTWRT ACALL DELAY MOV A, #’N’ display letter N ACALL DATWRT
ACALL DELAY MOV A, #’O’ Display letter O ACALL DATWRT ACALL DELAY AGAIN: SJMP AGAIN CMTWRT: MOV P1,A CLR P2.0 RS = 0 for command CLR P2.1 R/W =0 for write SETB P2.2 E = 1 for high pulse ACALL DELAY CLR P2.2 E =0 RET
DATAWRT: MOV P1,A SETB P2.0 RS=1 FOR DATA CLR P2.1 R/W = 0 SETB P2.2 E = 1 ACALL DELAY CLR P2.2 RET DELAY: MOV R4,#255 HERE: DJNZ R4, HERE RET END
ADC INTERFACING • ADC – most widely used device for data acquisition • Every physical quantity is in analog form. • It should be converted to digital to be read by the MC. • ADC has n-bit resolution where ‘n’ can be 8,10,12, 16 or 24 bits • Higher resolution provides smaller step size. • Conversion time – time taken by ADC to convert analog into digital. • ADC chips are serial or parallel – one pin for serial and n pins for parallel.
ADC 0804 CHIP • 8 – bit parallel ADC • Works with +5V, resolution – 8bits • PINS 1.CS – chip select, active low , input, activate 0804 2.RD – Read, input, active low, used to get the converted data out of ADC. CS = 0, high to low pulse is applied to RD , 8 – bit o/p at D0 – D7. ADC converts analog to binary and holds it in an internal register