HD44780 LCD programming From the Hardware Side

Slides:



Advertisements
Similar presentations
EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
Advertisements

Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Lab3 -- Lab 4 Design and implementation details on the way to a valid SPI-LCD interface driver.
Peripherals and their Control An overview of industrially available “peripheral devices” Some ideas for Laboratories and Quiz / Exam questions.
Boot Issues Processor comparison TigerSHARC multi-processor system Blackfin single-core.
If we can just send 1 signal correctly over the MOSI line!!! Design and implementation details on the way to a valid SPI-LCD interface driver.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Blackfin SPI Compatible Interface Design and implementation details on the way to a valid SPI-LCD interface driver.
HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver.
Henry Hexmoor1 Chapter 7 Henry Hexmoor Registers and RTL.
LCD programming Design and implementation details on the way to a valid SPI-LCD interface driver.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Other I/O LCD display Flash ROM Keyboard (PS/2) UART connectors.
Serial Peripheral Interface (SPI)
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
Now we must send the correct signals over the MOSI line!!! Design and implementation details on the way to a valid SPI-LCD interface driver.
Input/Output and Communication
Interface circuits I/O interface consists of the circuitry required to connect an I/O device to a computer bus. Side of the interface which connects to.
Counters and Registers
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
SPI Compatible Devices Design and implementation details on the way to a valid SPI-LCD interface driver.
Overview What kind of LCD Interfacing the LCD Displaying Text and Numbers Common Issues.
Computer Architecture Lecture 08 Fasih ur Rehman.
If we can just send 1 signal correctly over the MOSI line!!! Design and implementation details on the way to a valid SPI-LCD interface driver.
HD44780 LCD programming From the Hardware Side
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
MICROPROCESSOR INPUT/OUTPUT
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
PPI-8255.
Basic LED Interface.
Department of Electronic & Electrical Engineering LCD character display (parallel interface). How to interface a LCD character display to a PIC.
Serial Peripheral Interface SPI I2C (i-squared cee)
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
REGISTER TRANSFER LANGUAGE (RTL) INTRODUCTION TO REGISTER Registers1.
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
Computer Organization
Lab3 -- Lab 4 Design and implementation details on the way to a valid SPI-LCD interface driver.
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Chapter 6 Input/Output Organization
Serial mode of data transfer
REGISTER TRANSFER LANGUAGE (RTL)
Microprocessor or Microcontroller
Input/Output and Communication
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: Internal fault (e.g.. divide by.
ECE 3430 – Intro to Microcomputer Systems
Serial I/O and Data Communication.
OBJECTIVE AND FEATURES:
Lab3 -- Lab 4 Design and implementation details on the way to a valid SPI-LCD interface driver.
Dr. Michael Nasief Lecture 2
Atmega32 Serial Programming Basics
I2C PROTOCOL SPECIFICATION
SPI Compatible Devices
Asynchronous Serial Communications
SPI Compatible Devices
SPI Compatible Devices
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
22 October 3 classes before 2nd exam! Control 1/16/2019
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
HD44780 LCD programming From the Hardware Side
Lab3 -- Lab 4 Review Design and implementation details on the way to a valid SPI-LCD interface driver.
Developing a reliable communication between Blackfin and Slave device
Lab3 -- Lab 4 Design and implementation details on the way to a valid SPI-LCD interface driver.
Registers Today we’ll see some common sequential devices: counters and registers. They’re good examples of sequential analysis and design. They are also.
Costas Foudas, Imperial College, Rm: 508, x47590
Presentation transcript:

HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver

SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada To be tackled today What commands are necessary to control the LCD device -- HD44780? How do you send commands from the Blackfin to a LCD device? How do we get the timing correct? 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

LCD Connection information 13 key connections 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Data Bus Connections for LCD screen From CJ7 connector on Blackfin interface BQ0 BQ1 BQ2 BQ3 BQ4 BQ5 BQ6 BQ7 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Power Connections for LCD screen From LOGIC LAB POWER GROUND +5V 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

LCD operations require certain values on RS, R/W* and DBx lines LCD COMMANDS RS R/W* DATA DB7 to DB0 ClearScreen( ) 0x01 CursorIncrease( ) 0x05 CursorMove( ) 0x10 DisplayOn( ) 0x0B WriteLetter(value) 1 value WriteLetter(‘a’) 0x61 (ascii ‘a’) WriteLetter(‘A’) 0x41 (ascii ‘A’) 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Control Line Connections for LCD screen From CJ8 connector on Blackfin interface BQ8 RS command (0) or data (1) control BQ9 R/W* Read (1) from LCD Write (0) to LCD BQ10 E Enable Normally 1 Transition 1  0 makes the LCD work (accept the command or data information) 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

The “idea” of how to cause the LCD to -- Clear the screen LCD COMMANDS RS R/W* DATA DB7 to DB0 ClearScreen( ) 0x01 That means we must send the following “voltage” signals to the LCD pins RS R/W E DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 // EnableStrobe 0 0 1 0 0 0 0 0 0 0 1 // LCD reads on high to low And we must wait after sending each “signal” for sufficient time for the LCD to work. The LCD probably works 100000 times slower than Blackfin. 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

To cause the “slow” LCD to Clear the screen LCD COMMANDS RS R/W* DATA DB7 to DB0 ClearScreen( ) 0x01 That means we must send the following “voltage” signals to the LCD pins RS R/W E DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 0 0 1 0 0 0 0 0 0 0 1 WasteSomeTimeCPP( ) 0 0 0 0 0 0 0 0 0 0 1 // EnableStobe WasteSomeTimeCPP( ) 0 0 1 0 0 0 0 0 0 0 1 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

LCD Command Instruction set 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Details of what is needed 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

LCD Command Instruction set For some commands the LCD is very slow 1.640 ms For other commands the LCD is faster 0.040 ms = 40 us Remember the Blackfin instruction is around 0.000002 ms = 2 ns 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

To cause the LCD to Clear the screen LCD COMMANDS RS R/W DATA DB7 to DB0 ClearScreen( ) 0x01 That means we must send the following “voltage” signals to the LCD pins RS R/W E DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 0 0 1 0 0 0 0 0 0 0 1 Wait(1.64 ms ) -- Only one of these is really needed this long – Refactor later 0 0 0 0 0 0 0 0 0 0 1 // EnableStobe Wait( 1.64 ms ) -- Only one of these is really needed this long – Refactor later 0 0 1 0 0 0 0 0 0 0 1 Wait( 1.64 ms) -- Only one of these is really needed this long – Refactor later Remember – when shorten down – still must worry about Speed 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

To cause the LCD to write the letter ‘A’ on its screen LCD COMMANDS RS R/W DATA DB7 to DB0 WriteLetter(value) 1 value WriteLetter(‘a’) 0x61 That means we must send the following “voltage” signals to the LCD pins RS R/W E DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 1 0 1 0 1 1 0 0 0 0 1 Wait( 40 us) 1 0 0 0 1 1 0 0 0 0 1 // EnableStobe Wait( 40 us) 1 0 1 0 1 1 0 0 0 0 1 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Bit patterns to send a character Complicated or not? How do the letter bit patterns for the LCD data patterns relate to ASCII bit patterns? standard format used to store characters in a C++ character array? Just copy from an array onto the LCD data pins To cause “A” to appear on LCD screen need bit pattern 01000001 = 0x41 sent to LCD data pins WriteSPI(‘A’); Also send the necessary LCD control signals (EN / RS) 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Alpha-numeric ascii code ‘A’ to ‘Z’, ‘a’ to ‘z’ 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Alpha-numeric ascii code 0 through 9, ( ) etc 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada Problem – we need 22 lines (11 in / 11 out) to control LCD – and we don’t have them on the Blackfin 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Solution – Setup LCD as SLAVE device Master (Blackfin) / Slave (LCD) concept Will not work LCD was set up as a PARALLEL DEVICE – many lines at one time Not capable of MOSI control MOSI --MASTER OUT – SLAVE IN 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada Solution There is a standard chip (Name ?????) that is capable of Receiving (serial) signals from the Blackfin over the MOSI wire Converting those serial signals (16 signals -- received one at a time) into a parallel signal (16 signals -- sent all at once) Sending the PARALLEL voltage signals to the LCD This chip has been designed into the Logic Station Blackfin interface (is not part of the Blackfin itself All we need to do is attach 11 wires from the interface to the LED Attach 4 wires from the interface to the Blackfin MOSI lines Program the Blackfin SPI interface and “GO” 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Lots of stuff has to happen in the correct order Putting data into the Blackfin SPI_TDBR register causes the data to be transmitted over the MOSI line SPI_TDBR means Serial Parallel Interface Transmit Data Buffer Register 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Known facts -- MOSI data starts being transmitted from Blackfin THE MOMENT that ANY data is written to Blackfin SPI_TDBR register SPI_TDBR Blackfin Processor SPI_RXBR SLAVE SELECT PF5 used (PF1 to PF7) SPI CLOCK MOSI MISO SLAVE OUTPUT INTERFACE SLAVE INPUT INTERFACE LOAD Slave to LCD DATA SWITCHES (LOGIC LAB) CONTROL LCD SCREEN CJ7 / CJ8 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Lots of stuff has to happen in the correct order Putting (8-bit parallel) data into the Blackfin SPI_TDBR register causes the (1-bit serial) data to be transmitted over the MOSI line  However the external device will ignore the command unless the slave select line is held low  2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Known facts -- MOSI data is accepted by the SLAVE IF slave-select is active low – set PF5 to low – Master/Slave SPI_TDBR Blackfin Processor SPI_RXBR SLAVE SELECT PF5 used (PF1 to PF7) SPI CLOCK MOSI MISO SLAVE OUTPUT INTERFACE SLAVE INPUT INTERFACE LOAD Slave to LCD DATA SWITCHES (LOGIC LAB) CONTROL LCD SCREEN CJ7 / CJ8 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Lots of stuff has to happen in the correct order Putting data into the Blackfin SPI_TDBR register causes the data to be transmitted over the MOSI line  However the external device will ACCEPT the command if the slave select line PF5 line is AUTOMATICALLY SET LOW by the Blackfin before the transmission is started.  When transmission is ended (16-bits sent) then the slave select line PF5 line is AUTOMATICALLY SET HIGH by the Blackfin  or  ???? 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Known facts – The SLAVE only sends the data to the LCD when the PF5 line goes from low to high – interface design SPI_TDBR Blackfin Processor SPI_RXBR SLAVE SELECT PF5 used (PF1 to PF7) SPI CLOCK MOSI MISO SLAVE OUTPUT INTERFACE SLAVE INPUT INTERFACE LOAD Slave to LCD DATA SWITCHES (LOGIC LAB) CONTROL LCD SCREEN CJ7 / CJ8 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Lots of stuff has to happen in the correct order Putting data into the Blackfin SPI_TDBR register causes the data to be transmitted over the MOSI line  However the external device will ACCEPT the command as the slave select line PF5 line is AUTOMATICALLY SET LOW by the Blackfin before the transmission is started.  When transmission is ended (16-bits sent) then the slave select line PF5 line is AUTOMATICALLY SET HIGH by the Blackfin  As PF5 line goes high the data sent by the Blackfin over the MOSI line to the special interface is transferred to the LCD  Everything in the garden is wonderful!!!!!!!!!!!!!! ALL? we have to do is make it happen!  2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

Blackfin transmits 16 bits with THIS format over the MOSI line DB7, DB6, ………DB1, DB0 E – Enable / Strobe 1  0 – When this line goes from high to the low, then the command is send to (latched into) LCD To make LCD respond to command 0x4F0 Then Blackfin must transmit 0x5F0 ( E High ) 0x4F0 ( E low ) 0x5F0 ( E high ) RS 1 – LCD data 0 – LCD instruction R/W 1 – Read from LCD 0 – Write to LCD 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada Design the controls signals and data signals to ‘Clear the screen’ and then send the char string “415” to LCD Reminder – sequence to sent the letter ‘a” to the screen RS R/W E DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 1 0 1 0 1 1 0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 // EnableStobe 1 0 1 0 1 1 0 0 0 0 1 ClearScreen ‘4’ ‘1’ ‘5’ 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada

SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada Tackled today What commands are necessary to control the LCD device -- HD44780? How do you send commands from the Blackfin to a LCD device? How do we get the timing correct? 2/16/2019 SPI and LCD , Copyright M. Smith, ECE, University of Calgary, Canada