Embedded Systems 7763B Mt Druitt College of TAFE Electrical Engineering Lesson 2 LCD Display Interfacing.

Slides:



Advertisements
Similar presentations
EET 2261 Unit 12 Controlling LCD and Keypad
Advertisements

PROGRAMMABLE PERIPHERAL INTERFACE -8255
Programmable Interval Timer
Programmable Keyboard/ Display Interface: 8279
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
kashanu.ac.ir Microprocessors 6-1 I/O Devices Switches, LED, LCD Lec note 6.
Input/Output (I/O) Ports and Interfacing
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
COMP3221: Microprocessors and Embedded Systems--Lecture 7 1 COMP3221: Microprocessors and Embedded Systems Lecture 7: Arithmetic and logic Instructions.
HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver.
COMP3221: Microprocessors and Embedded Systems--Lecture 8 1 COMP3221: Microprocessors and Embedded Systems Lecture 8: Program Control Instructions
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
COMP3221: Microprocessors and Embedded Systems--Lecture 9 1 COMP3221: Microprocessors and Embedded Systems Lecture 9: Data Transfer Instructions
Embedded Programming and Robotics Lesson 9 Keypad and LCD Display 1.
Overview What kind of LCD Interfacing the LCD Displaying Text and Numbers Common Issues.
Digital Outputs LCD Display
HD44780 LCD programming From the Hardware Side
Embedded Systems 7763B Mt Druitt College of TAFE
1 4-Integrating Peripherals in Embedded Systems (cont.)
Input/Output Ports and Interfacing
By, Prof. Tambe S. S. S.N.D. College of Engineering and Research Center Department of Electrical Engineering.
Single Chip Microcontrollers 7765J Mount Druitt College of TAFE Lesson 2.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
Microcode Source: Digital Computer Electronics (Malvino and Brown)
UniMAP 1 Interfacing Peripherals. UniMAP 2 Interfacing devices on Embedded Linux In general, to interface to a device connected to an embedded Linux platform.
8279 KEYBOARD AND DISPLAY INTERFACING
EE 316 Computer Engineering Junior Lab Serial Ports, LCD Displays & PROMs.
© Mike Stacey 2008 Single Chip Microcontrollers 7765J Mount Druitt College of TAFE Lesson 3 Arrays in ASM, Bubble Sort algorithm.
Programmable Peripheral Interface Parallel port Interface 8255
Embedded Systems 7763B Mt Druitt College of TAFE Electrical Engineering Lesson 2 LCD Display Interfacing.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
PPI-8255.
8279 KEYBOARD AND DISPLAY INTERFACING
Department of Electronic & Electrical Engineering LCD character display (parallel interface). How to interface a LCD character display to a PIC.
BRANCHES SUBROUTINES AND MEMORY USAGE AVR Assembler M. Neil - Microprocessor Course 1.
© Mike Stacey 2008 Single Chip Microcontrollers 7765J Mount Druitt College of TAFE Lesson 6 Instruction Timing and Control Loops.
I/O Devices Switches, LED, LCD
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
KEYBOARD/DISPLAY CONTROLLER - INTEL Features of 8279 The important features of 8279 are, Simultaneous keyboard and display operations. Scanned keyboard.
Interfacing of Input/Output devices with AVR Microcontroller Enrolment No. : Name of the student: SOMAIYA ISHA.
8 085Microprocessor Temp Reg (8) Accumulator (A reg) Flag flip flops(8) Instruction Register (8) Arithmetic Logic Unit ALU Instruction Decoder and Machine.
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
“ INSTRUCTIONS SET OF AVR MICROCONTROLLER ” SIGMA INSTITUTE OF ENGINEERING Prepared By: SR.NO NAME OF STUDENT ENROLLMENT 1 Abhishek Lakhara
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
Interfacing the HC(S)12 microcontroller to a Hitachi/Optrex LCD Display Panel The LCD display panel contains its own microcontroller (Hitachi HD44780)
Overview of Architecture Assembly Programming Concepts
LCD and Keyboard Interfacing
GANDHINAGAR INSTITUTE OF TECHNOLOGY
COMP2121: Microprocessors and Interfacing
Programmable Interval Timer
Subroutines and the Stack
COMP2121: Microprocessors and Interfacing
ATmega103 Timer0 and Interrupts
EET 2261 Unit 11 Controlling LCD and Keypad
LCD and Keyboard Interfacing
Figure Pin Positions for Various LCDs from Optrex
EET 2261 Unit 11 Controlling LCD and Keypad
LCD and Keyboard Interfacing
Addressing Modes Register Direct, with 1 and 2 registers I/O Direct
Tim Sumner, Imperial College, Rm: 1009, x47552
LCD and Keyboard Interfacing
LCD and Keyboard Sepehr Naimi
Advanced Assembly Chapter 6
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
8279 – Programmable Keyboard/Display Interface
LCD and Keyboard Interfacing
COMP3221: Microprocessors and Embedded Systems
The Programmable Peripheral Interface (8255A)
Presentation transcript:

Embedded Systems 7763B Mt Druitt College of TAFE Electrical Engineering Lesson 2 LCD Display Interfacing

Mike Stacey Hardware Connections Only 4 bits of data used: DB4 – DB7 DB1 = Register Select, DB2 = R/W, DB3 = Enable Others: BL- = GND and BL+ = optional backlight

Mike Stacey Driving an LCD Initialisation: the LCD must be initialised using the routine supplied in the data sheets. 4 bits only: we are using only 4 bits but ASCII characters are 8 bits so we have to do 2 writes to the LCD for one character. Initialisation allows us to: –set LCD to operate in 4 bit mode –set the number of lines –set the font (5 x 10 dots or 5 x 7 dots) –set cursor move direction –set cursor to 1 st position –clear display See page 4 of LCD datasheet for full list of instructions

Mike Stacey Operation High nibble 1 st then low nibble Parallel data interface RS selects whether data or instruction is being written Enable is active high R/W: write active low

Mike Stacey Code [1].equ RS = pc1; port c bit 1.equ r_w = pc2; port c bit 2.equ E = pc3; port c bit 3

Mike Stacey Code [2] lcd_send_char:; writes a single char to LCD clr temp mov temp, output_data; create a backup copy andi temp, 0b ; get upper nibble ori temp, 0b ; and set RS out portc, temp; send data rcall strobe; pulse enable clr temp mov temp, output_data; create copy swap temp; swap nibbles andi temp, 0b ; then get upper (lower) nibble ori temp, 0b ; set RS bit out portc, temp; and send it rcall strobe; pulse enable ret

Mike Stacey Code [3] strobe: cbi portC,r_w; reset r_w cbi portC,E; reset enable sbi portC,E; set enable nop; keep high for pulse time nop cbi portC,E; reset enable rcall wait1ms; wait ret

Mike Stacey Initialisation [page 4 datasheets] lcdInit: cbi portC,E cbi portC,r_w cbi portC,rs rcall wait10ms ldi temp,0b out portC,temp rcall strobe rcall wait10ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms write 0x30 (function set) wait > 4.1mS wait > 100uS write 0x30 (function set) clear RS for writing instructions

Mike Stacey Initialisation [2] ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms write 0x20 (function set-4 bit) No. lines = 2 (bit 7), matrix size (font - bit 6) display off

Mike Stacey Initialisation [3] ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms ldi temp,0b out portC,temp rcall strobe rcall wait1ms sbi portC, rs ret display clear Enter mode set, cursor move direction (bit 5) set RS for writing data to LCD

Mike Stacey Write String from Memory text1:.db "LCD Test Message",0 ; strores msg string as bytes The Z register comprises R30 & R31 and can be used as a memory pointer. If you execute a load operation (lpm) the location pointed at by Z register will be loaded into destination register. You can also automatically increment the pointer after the load if you wish. ldi ZL,low(text1*2) ; load low byte address of string into Z reg (R30) ldi ZH,high(text1*2); load high byte address of string into Z reg (R31)

Mike Stacey Write String from Memory [2] message: ldi temp,0 mov zero,temp ; just for a zero reference send1: lpm; move the contents of the memory location ; pointed to by the Z register to R0 (R0 = text) cpse text,zero ; check for end of text zero, if zero skip next rjmp send2; instruction sendend: ret send2: rcall lcd_send_char ; output text character inc ZL; get ready for next character rjmp send1

Mike Stacey Samples See –LCD-PrintOneChar.asm –LCD-PrintString.asm

Mike Stacey What to do? Project check 1 is due this week Assignment 1a and 1b are due this week Assignment 2 is due next week

Mike Stacey Assignment 1a The program only accepts keys zero to nine It displays the value of the key pressed to Port A LEDs The program then waits until the clear key is pressed (S12 –’C’). When it is pressed, the program goes back to the start. See flowchart ZeroToNineZeroToNine

Mike Stacey Assignment 1a [2] ZeroToNine: rcall GetKey cpi keyval, 'A' breq ZeroToNine cpi keyval, 'B' breq ZeroToNine cpi keyval, 'C' breq ZeroToNine cpi keyval, 'D' breq ZeroToNine ; etc - check for other 'not allowed' keys out PortA, keyval Clear:; look for clear key to continue rcall GetKey cpi keyval, 'C' brne Clear rjmp ZeroToNine GetKey is the code which was provided – it includes key debouncing and everything required for correctly returning a key from the keypad. Use it every time you need to scan the keypad but change the last line to RET. Don’t just use KeyScan – it wont work on the hardware.

Mike Stacey Assignment 1b [1] Program accepts a 4 digit pin number Initially, the program displays $AA to Port A LEDs When the correct pin has been entered, the display changes to $55 and then waits for the Clear key (S12) to be pressed. When Clear is pressed, program goes back to start If an incorrect pin is entered, the program displays $66 (error code) and waits for Clear key. See flowchart GetPinGetPin

Mike Stacey Assignment 1b Code Organisation GetPin: rcall DisplayReady; subroutine for displaying $AA rcall GetKey cpi keyval, ‘D’ brne DisplayError ; subroutine for displaying $66 cpi keyval, ‘9’ brne DisplayError cpi keyval, ‘5’ brne DisplayError cpi keyval, ‘1’ brne DisplayError rcall DisplayPinOK ; subroutine for displaying $55 rjmp GetPin Clear:; look for clear key to continue rcall GetKey cpi keyval, ‘C’ brne Clear rjmp GetPin

Mike Stacey Assignment 1b Code Organisation DisplayError: ; DisplayError sub-routine ldi temp, $66 out PortA, temp rjmp Clear ; wait for ‘Clear’ then restart DisplayPinOK: ; DisplayPinOK sub-routine ldi temp, $55 out PortA, temp rjmp Clear ; wait for ‘Clear’ then restart