ECE 4510/5530 Microcontroller Applications Week 9

Similar documents
The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.

EE 308/MENG 483 Spring 2017

16COM / 80SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

16COM / 40SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

中显液晶 技术资料 中显控制器使用说明书 2009年3月15日 北京市海淀区中关村大街32号和盛大厦811室 电话 86 010 52926620 传真 86 010 52926621 企业网站.zxlcd.com

AN1745. Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas. Introduction

Item Symbol Standard Unit Power voltage VDD-VSS Input voltage VIN VSS - VDD

16COM/40SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

Parallel Display Specifications Revision 1.0

16COM/80SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

LCM NHD-0440CI-YTBL. User s Guide. (Liquid Crystal Display Module) RoHS Compliant. For product support, contact NHD CI- Y- T- B- L-

LCM NHD-0440AZ-FSW -FBW. User s Guide. (Liquid Crystal Display Character Module) RoHS Compliant FEATURES

LMB202DBC LCD Module User Manual

SPECIFICATIONS FOR LCD MODULE

LCD. Configuration and Programming

SPECIFICATIONS FOR LCD MODULE

SPECIFICATIONS FOR LCD MODULE

SPECIFICATIONS FOR LCD MODULE

USER S GUIDE ATM4004A

DOT MATRIX CHARACTER LCD MODULE USER S MANUAL

Crystalfontz America, Inc.

Data Sheet. Tranma Alphanumeric dot matrix liquid crystal displays with backlighting ATTENTION

SPECIFICATION SALES BY APPROVED BY CHECKED BY PREPARED BY. Crystalfontz America, Inc East Saltese Avenue Spokane Valley, WA

LCD Module User Manual

SPECIFICATIONS FOR LCD MODULE

Alphanumeric LCD display module 24 characters by 2 line. General description

unit: mm 3044B - QFP80A unit: mm QFP80D

Dot Matrix LCD Controller Driver

Lab Experiment 9: LCD Display

JUL. 27, 2001 Version 1.0

AZ DISPLAYS, INC. COMPLETE LCD SOLUTIONS SPECIFICATIONS FOR LIQUID CRYSTAL DISPLAY

AZ DISPLAYS, INC. COMPLETE LCD SOLUTIONS SPECIFICATIONS FOR LIQUID CRYSTAL DISPLAY

Number of Characters 20 characters x 4Lines - Module dimension 98.0 x 60.0 x 13.6(MAX) mm. View area 77.0 x 25.2 mm. Active area 70.4 x 20.

AZ DISPLAYS, INC. COMPLETE LCD SOLUTIONS SPECIFICATIONS FOR LIQUID CRYSTAL DISPLAY

Crystalfontz America, Inc.

DM1620. Parameter Dimension Unit

SSD1803. Product Preview. 100 x 34 STN LCD Segment / Common Mono Driver with Controller

DISPLAYTRONIC A DIVISION OF ZE XIAMEN SPECIFICATIONS FOR LIQUID CRYSTAL DISPLAY

LCD Module User Manual

The MC9S12 Input Capture Function

EE 308 Spring Exam 1 Feb. 27

RW1062 INTRODUCTION FUNCTIONS FEATURES. Crystalfontz. Thiscontrolerdatasheetwasdownloadedfrom htp:/

LCD MODULE DEM SBH-PW-N

Item Dimension Unit Number of Characters 16 characters x 2 Lines -

LCD MODULE DEM SBH-PW-N

The MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function

SPECIFICATIONS FOR LIQUID CRYSTAL DISPLAY

34COM/60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

Capturing the Time of an External Event Input Capture Subsystem

Newhaven Display International, Inc Galvin Ct. Elgin IL, Ph: Fax:

Revision No. Date Description Item Page

LCD Module User Manual

LCD MODULE DEM TGH

SC162A VER2.1 CONTENT. 1. General description

Newhaven Display International, Inc Galvin Ct. Elgin IL, Ph: Fax:

NT7651. LCD controller/driver 16Cx2 characters icons PRELIMINARY. Features. General Description

LCM SPECIFICATIONS. LCM MODE: CHARACTER PRODUCTION CODE: LCM2002A REVISION: ver1.1 DATE: 2004/9/6. (using) LCM 2002A Sep 6th, 2004

MICROCONTROLLER SYSTEM CONTROL DESIGN JON PRITCHARD SCOTT VON THUN

LCD MODULE DEM FGH-LR

LCDs. Embedded Systems Interfacing. 20 September 2011

Sitronix. ST7038i FEATURES GENERAL DESCRIPTION. Dot Matrix LCD Controller/Driver

Product Information. Features. Table of Contents EA DIP162 DN3LW EA DIP162 DHNLED EA DIP162 DNLED EA DIP162J DN3LW

LCD MODULE DEP Y

Newhaven Display International, Inc Galvin Ct. Elgin IL, Ph: Fax:

M0120SD 201MDB1 1. Vacuum Fluorescent Display Module

LCD MODULE DEM SYH

Newhaven Display International, Inc Galvin Ct. Elgin IL, Ph: Fax:

DISPLAY DEVICES 20T202DA1J (Tentative) Page - 1 / 18 VACUUM FLUORESCENT DISPLAY MODULE

Newhaven Display International, Inc Technology Drive, Suite 101 Elgin IL, Ph: Fax:

CONTENT. 1. General description

INTEGRATED CIRCUITS DATA SHEET. PCF2119x-2 LCD controllers/drivers. Product specification File under Integrated Circuits, IC12

M0121LB 222LHAR2 I1. Vacuum Fluorescent Display Module

FEATURES DESCRIPTION APPLICATIONS BLOCK DIAGRAM. PT6314 Dot Character VFD Controller/Driver IC

NHD 0216KZW AB5. OLED Display Module

Using Input Capture on the 9S12

Application Note. Interfacing to a Graphics LCD from PSoC. Summary This Application Note describes how to control a graphic LCD in a PSoC application.

INTEGRATED CIRCUITS DATA SHEET. PCF2119X LCD controllers/drivers. Product specification Supersedes data of 2002 Jan 16.

Dragon12 LCD Displays Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) Dragon12 LCD Display. The Dragon12 board has a 16 character x 2 line display

Specification of Vacuum Fluorescent Display NORITAKE ITRON CORPORATION Sheet 1/19 DS25404

ALL SHORE INDUSTRIES, INC.

COG (Chip-on-Glass) Liquid Crystal Display Module

VACUUM FLUORESCENT DISPLAY MODULE SPECIFICATION SPECIFICATION NO. : DS DATE OF ISSUE : Apr., 5, R E V I S I O N : May, 18, 2007

EE4390 Microprocessors

8. SED1565 Series. (Rev. 1.2)

ECE3120: Computer Systems Chapter 8: Timer Module

FPGA Interfacing of HD44780 Based LCD Using Delayed Finite State Machine (FSM)

Embedded Systems and Software. LCD Displays

SSD1800. Advance Information. 80x Icon line LCD Segment / Common Driver with Controller for Character Display System

Dragon12 LCD Displays Huang Sections 7.8 Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) ATD_10B8C Block User Guide. Dragon12 LCD Display

TL0313. LCD driver IC. Apr VER 0.0. lsi. ( 5.5V Specification ) 65COM / 132SEG DRIVER & CONTROLLER FOR STN LCD. TOMATO LSI Inc.

DATA SHEET. PCF2113x LCD controller/driver INTEGRATED CIRCUITS Apr 04

LCD Module Specification

Lab 3 LCD Mar

What happens when an HC12 gets in unmasked interrupt:

NHD-C0216CZ-FSW-FBW-3V3

Application Note. Connecting standard LCD modules to. the MB90670/5 series. History 01 th Feb. 97 MM V1.0 started 28 th June 00 TKa V1.

6.1. EE 109 Unit 6. LCD Interfacing

JE-AN ELECTRONICS CO.,LTD. Spec. No: WG240128A

HD (132 x 168-dot Graphics LCD Controller/Driver with Bit-operation Functions) Preliminary. Rev 0.1 Oct 15, Description.

LCM SPECIFICATIONS. Vatronix Holdings Limited. Approved By Checked By Prepared By. Approved By Customer: Date: Customer : DRAWING NO.

Transcription:

ECE 45/553 Microcontroller Applications Week 9 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences

Lab 7 & 8 Elements & Project 2 Midterm Exam LCD Display for Calculator SPI, ADC/DAC and Temperature Measurement SPI and ADC ECE 25 2

ECE 45/553 3

Problem See Lab 5, Task 2 midterm example problem This waveform is designed to support a stepper motor full stepping driving operation, so the phases must be sequential and exactly equal to /2 of the total period. Assume that you are using a 24 MHz Eclock and that the PWM signal frequencies should all be 5 khz. Hints : If the period count were a perfect multiple of 2 or 4, such as 4, each channel would be turned on for a count of 2 to create a perfect 2/4 duty cycle. Hint 2: While PWM. and PWM.5 are left aligned, does PWM.3 and PWM.7 look like they might be center aligned on a count of 2? If so, how do the period and duty cycle values differ? ECE 4 45/553

Midterm Example Problem PWMPRCLK = x44; // Prescale A and B by 6 (.5 MHz) PWMCLK = x; // Select A and B clocks PWMCTL = PSWAI PFRZ; // All 8 bit registers, stop clocks for W or F PWMCAE = CAE2; // PWM.2 is center aligned PWMCAE &= ~(CAE4 CAE); // PWM. and PWM.4 are left aligned PWMPOL = PPOL; // PWM. is positive polarity PWMPOL &= ~(PPOL2 PPOL4); // PWM.2 and PWM.4 are negative polarity PWMPER = 5; // Left aligned 5 count period ( khz) PWMPER2 = 75; // Center aligned 2 x 75 count period ( khz) PWMPER4 = 5; // Left aligned 5 count period ( khz) PWMDTY = 5; // Positive 5/5 duty cycle PWMDTY2 = 5; // Centered Negative (755)/75 duty cycle PWMDTY4 = ; // Negative (5)/5 duty cycle PWME = (PWME PWME2 PWME4); //Enable channel, 2 and 4 ECE 45/553 5

Problem 2 See Lab 4, Task 4 for a single output compare operations. See Example 8.4 in the textbook and notes (Week5_) for a single output. The repeat period is to be 2 msec or 5 Hz with the sequential on times of 5 usec each. Compose the main() C program to initialize the ECT so that the sequence can be achieved and then wait in an infinite while loop. Four similar interrupt service routines are to be used to generate each of the on times for the four output compare timer channels. ECE 45/553 6

Example 8.4 Modified # include "mc9s2dp52.h" #define HiCnt 2 #define LoCnt 8 char HiorLo; void main (void) { asm( sei"); // disable interrupt globally timer_init(); asm("cli"); // enable interrupt globally timer5_start(); void timer_init(void) { TSCR = x9; // enable TCNT and fast timer flag clear TSCR2 = x3; // disable TCNT interrupt, set prescaler to 8 } TIOS = OC5; TFLG = xff; // enable OC5 function // clear all CxF flags while(); { asm( nop ); asm( nop ); } } interrupt void timer5_isr (void) { if(hiorlo){ TC5 += HiCnt; HiorLo = ; } else{ TC5 += LoCnt; HiorLo = ; } } void timer5_start(void) { extern char HiorLo; TCTL = xc; // set OC5 action to be pull high CFORC = x2; // Force pin action to high TFLG = xx2; // clear all C5F flags TCTL = x4; // set OC5 pin action to toggle TC5 = TCNT + HiCnt; // start an new OC5 operation HiorLo = ; // add LoCnt for the next OC5 operation TIE = x2; // enable OC5 interrupt locally } 7

Problem 3 (a) Initialization function: Use port H (PTH) for the control signals and port P (PTP) for the data signals. Provide a function call that sets data direction for all control signals and assumes that the data bus will be an input. Note: for bidirectional data buses, signals are not driven by any connected device until required. Therefore, at initialization the data bus should be an input. (b) Write LCD function: Based on the data write timing diagram, compose a Ccode function that pass an 8bit value to the function and execute a write. (c) Read LCD function: Based on the data read timing diagram, compose a Ccode function that reads an 8bit value and provide it as the return value for the function. ECE 45/553 8

LCD Read and Write Data Write Timing Table of Min/Max Required Times Time Item Symbol Min Max Unit Enable Cycle t CYCLE nsec Enable Pulse Width High Level t PWEH 45 nsec Enable Pulse Width Low Level t PWEL 35 nsec Address Setup Time (RS,R/Wn) t AS nsec Address Hold Time (RS,R/Wn) t AH nsec Data Setup Time t DSW nsec Data Hold Time t DHR 2 nsec Data Read Delay Time t DDR 9 nsec Data Read Timing ECE 45/553 9

LCD Operation The interface consists of three control signals and 8 parallel data bits. The control signals are register_select (RS), selecting control (low) or memory (high) registers, read/write_not (R/Wn), read or write operation select, and enable (E), the controller positive enable. The timing diagrams to perform a write and a read follow with times shown in the diagrams and table. Control: Port H (PTH), 3 pins RS Register Select = control=memory R/Wn Read/Write not = write =read E Enable = not enabled = enabled Data: Port P (PTP), 8 pins for 8 parallel bits ECE 45/553

LCD Initialization Port H has 3 outputs DDRH for 3 outputs. DDRP =? Initial condition of outputs. PTH =? RS don t care Read/Write not always in read when inactive Enable always when inactive DDRP for 8 bidirectional data lines Should be inputs whenever not actively requiring an output signal DDRP =? Is there anything else? ECE 45/553

Prototype Time Delays: Write ECE 45/553 t AS nsec min. 3 Eclock cycles t PWEH 45 nsec min Eclock cycles t AH nsec min. Eclock cycles t DSW nsec nom. 3 Eclock cycles t DHR 2 nsec min. Eclock cycles t DDR 9 nsec nom. 5 Eclock cycles t PWEL 35 nsec min 9Eclock cycles t CYCLE nsec min. 24 Eclock cycles ) RS & Wn 2) 3 nop 3) E Enable 4) 7 nop 5) DDRP, Data 6) 3 nop 7) E Disable 8) nop 9) all to steady state 2 (DDRP and R/Wn)

Prototype Time Delays: Read ECE 45/553 t AS nsec min. 3 Eclock cycles t PWEH 45 nsec min Eclock cycles t AH nsec min. Eclock cycles t DSW nsec nom. 3 Eclock cycles t DHR 2 nsec min. Eclock cycles t DDR 9 nsec nom. 5 Eclock cycles t PWEL 35 nsec min 9Eclock cycles t CYCLE nsec min. 24 Eclock cycles ) RS & read 2) 3 nop 3) E Enable 4) nop 5) PTP input 6) E Disable 7) nop 8) all to steady state 3

LCD INTERFACE ECE 45/553 4

LCD Display SSC2F6DLNW See Data Sheet Mechanical Electrical Timing Initialization sequence Controller IC Hitachi HD4478U Note: code in textbook is setup for a 4bit data, write only interface. Used on the Dragon demo board. p. 322338. Textbook notes follow. ECE 45/553 5

A HD4478Based LCD Kit ( of 3) Display capability: 4 x 2 Uses the HD4478 as the controller as shown in Figure 7.35. Pins DB7~DB are used to exchange data with the CPU. E input should be connected to one of the address decoder output or I/O pin. The RS signal selects instruction register () or data register (). The VEE signal allows the user to adjust the LCD contrast. The HD4478 can be configured to display line, 2line, and 4line information. The pin assignment for characterbased LCD module with less than and more than 8 characters are shown in Table 7.7 and 7.8. DB7 COM 6 LCDP (FRD769) DB E R/W RS V EE V CC V SS CONTROLLER LSI HD4478 SEG 4 4 SEG 6 SEGMENT DRIVER x 4 Figure 7.35 Block diagram of a HD4478based LCD kit

A HD4478Based LCD Kit (2 of 3) Table 7.7 Pin assignment for displays with less than 8 characters Pin No. symbol I/O Function 2 3 4 5 6 7 8 9 2 3 4 VSS VCC VEE RS R/W E DB DB DB2 DB3 DB4 DB5 DB6 DB7 I I I I/O I/O I/O I/O I/O I/O I/O I/O Power supply (GND) Power supply (+5V) Contrast adjust = instruction input, = data input = write to LCD, = read from LCD enable signal data bus line data bus line data bus line 2 data bus line 3 data bus line 4 data bus line 5 data bus line 6 data bus line 7

Interfacing the HD4478 with the HCS2 One can treat the LCD kit as an I/O device and use an I/O port and several other I/O pins as control signals. The interface can be 4 bits or 8 bits. To read or write the LCD successfully, one must satisfy the timing requirements of the LCD. The timing diagrams for read and write are shown in Figure 7.37 and 7.38. HCS2 MCU PK6 PK5 PK4 E R/W RS HD4478Ubased LCD Module V CC 5V 5V HCS2 MCU PK PK RS E HD4478Ubased LCD Module R/W V CC 5V 5V V EE V EE PH7...PH DB7..DB PK5...PK2 DB7..DB4 GND GND Figure 7.36a LCD interface example (8bit bus, used in SSE256) Figure 7.36b LCD interface example (4bit bus, used in Dragon2)

HD4478 Timing ( of 2) RS t AS t AH R/W PW EH t Ef E t Er t DDR t DHR DBDB7 Valid data t CYCLE Figure 7.37 HD4478U LCD controller read timing diagram RS t AS t AH R/W PW EH t Ef E t Er t DSW t H DBDB7 Valid data t CYCLE Figure 7.38 HD4478U LCD controller write timing diagram

HD4478 Timing ( of 2) Table 7.5 HD4478U bus timing parameters (2 MHz operation) Symbol Meaning Min Typ Max. Unit t CYCLE PW EH t Er, t Ef t AS t DDR t DSW t H t DHR t AH Enable cycle time Enable pulse width (high level) Enable rise and decay time Address setup time, RS, R/W, E Data delay time Data setup time Data hold time (write) Data hold time (read) Address hold time Procedure to send a command to the IR register Step Pull the RS and the E signals to low. Step 2 Pull the R/W signal to low. Step 3 Pull the E signal to high. Step 4 Output data to the output port attached to the LCD data bus. One needs to configure the I/O Port for output before writing data to the LCD kit. Step 5 Pull the E signal to low and make sure that the internal operation is complete. 5 23 4 8 5 2 6 ns ns ns ns ns ns ns ns ns

Registers of HD4478 The HD4478 has two 8bit user accessible registers: instruction register (IR) and data register (DR). To write data into display data RAM or character generator RAM, the MCU writes into the DR register. The address of the data RAM should be set up with a previous instruction. The DR register is also used for data storage when reading data from DDRAM or CGRAM. The HD4478 has a busy flag that is output from the DB7 pin. The HD4478 uses a 7bit address counter to keep track of the address of the next DDRAM or CGRAM location to be accessed. Table 7.2 Register selection RS R/W Operation IR write as an internal operation (display clear, etc) Read busy flag (DB7) and address counter (DB to DB6) DR write as an internal operation (DR to DDRAM or CGRAM) DR read as an internal operation (DDRAM or CGRAM to DR)

HD4478 Commands ( of 4) Table 7.9 HD4478U instruction set Code Instruction RS R/W B7 B6 B5 B4 B3 B2 B B Description Execution time Clear display Cursor home Entry mode set Display on/off control Cursor /display shift Function set Set CGRAM address Set DDRAM address Read busy flag and address counter Write CGRAM or DDRAM Read from CGRAM or DDRAM BF S/C R/L * DL N D F C * * I/D S B CGRAM address DDRAM address CGRAM/DDRAM address write data read data * * Clears display and returns cursor to the home position (address ). Returns cursor to home position (address ). Also returns display being shifted to the original position. DDRAM contents remain unchanged. Set cursor move direction (I/D), specifies to shift the display (S). These operations are performed during data read/write. Sets on/off of all display (D), cursor on/ off (C) and blink of cursor position character (B). Sets cursormove or display(s/c), shift direction (R/L). DDRAM contents remains unchanged. Sets interface data length (DL), number of display line (N) and character font (F). Sets the CGRAM address. CGRAM data is sent and received after this setting. Sets the DDRAM address. DDRAM data is sent and received after this setting. Reads busy flag (BF) indicating internal operation is being performed and reads CGRAM or DDRAM address counter contents (depending on previous instruction). Writes data to CGRAM or DDRAM. Reads data from CGRAM or DDRAM..64 ms.64 ms 4 s 4 s 4 s 4 s 4 s 4 s s 4 s 4 s

HD4478 Commands (2 of 4) Table 7. LCD instruction bit names Bit name I/D S D C B S/C R/L DL N F BF = decrement cursor position. = no display shift. = display off = cursor off = cursor blink off = move cursor = shift left = 4bit interface = /8 or / duty ( line) = 5x8 dots = can accept instruction Settings = increment cursor position = display shift = display on = cursor on = cursor blink on = shift display = shift right = 8bit interface = /6 duty (2 lines) = 5 x dots = internal operation in progress

HD4478 Commands (3 of 4) The HD4478 has a display data RAM (DDRAM) to store data to be displayed on the LCD. The address range of DDRAM for line, 2line, and 4line LCDs are shown in Table 7.a, 7.b, and 7.c. The HD4478 has a character generator ROM that can generates 5 8 or 5 character patterns from a 8bit code. The user can rewrite character patterns into the character generator RAM (CGRAM). Up to eight 5 8 patterns or four 5 patterns can be programmed. Table 7.a DDRAM address usage for a line LCD Display size Visible character positions DDRAM addresses * 8 * 6 * 2 * 24 * 32 * 4..7..5..9..23..3..39 x..x7 x..xf x..x3 x..x7 x..xf x..x27

HD4478 Commands (4 of 4) Table 7.b DDRAM address usage for a 2line LCD Display size 2 * 6 2 * 2 2 * 24 2 * 32 2 * 4 Visible character positions DDRAM addresses..5..9..23..3..39 x..xf + x4..x4f x..x3 + x4..x53 x..x7 + x4..x57 x..xf + x4..x5f x..x27 + x4..x67 Table 7.c DDRAM address usage for a 4line LCD Display size 4 * 6 4 * 2 4 * 4 Visible character positions..5..9..39 on st controller and..39 on 2nd controller DDRAM addresses x..xf + x4..x4f + x4..x23 + x54..x63 x..x3 + x4..x53 + x4..x27 + x54..x67 x..x27 + x4..x67 on st controller and x..x27 + x4..x67 on 2nd controller

HD4478 Data Sheet This data sheet reads rather well to describe registers and the initialization procedure. ECE 45/553 26