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

Similar documents
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

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

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.

LCDs. Embedded Systems Interfacing. 20 September 2011

LCD. Configuration and Programming

Dallas Semiconductor DS1307 Real Time Clock. The DS 1307 is a real-time clock with 56 bytes of NV (nonvolatile)

EMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

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

If the display shift operation is used on a 20 x 4 display, the addressing is shifted as follows:

Comparison of C and Assembly How to compile a C program using CodeWarrior

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

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

Parallel Display Specifications Revision 1.0

Comparison of C and Assembly How to compile a C program using CodeWarrior

Input/Output Devices. Lecturer: Sri Parameswaran Notes by: Annie Guo

LCD Display. Other I/O. LCD display Flash ROM SPI EPROM Keyboard (PS/2) UART connectors DAC ADC. 2-line, 16 character LCD display

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

Lab Experiment 9: LCD Display

6.1. EE 109 Unit 6. LCD Interfacing

Microprocessors & Interfacing

DOT MATRIX CHARACTER LCD MODULE USER S MANUAL

Introduction to the MC9S12 Hardware Subsystems

Embedded Systems and Software. LCD Displays

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

// sets the position of cursor in row and column

ECE 4510/5530 Microcontroller Applications Week 9

Hitachi Europe Ltd. ISSUE : app026/1.0 APPLICATION NOTE DATE : 20/9/94

Engineer-to-Engineer Note

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

Chapter 4. Address. data. Input / Output Programming. Simplified Z80 System Architecture. Memory. program. data. Z80 I/O Programming

BV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9

The EE 109 LCD Shield

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

Lab 5: LCD and A/D: Digital Voltmeter

Parallel Display Specifications Revision 1.1

Page 1 of 7. Samtron/Samsung 20S204DA2

Character Based LCD Module Interface.

The EE 109 LCD Shield

JUL. 27, 2001 Version 1.0

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.

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

LMB202DBC LCD Module User Manual

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

Character LCD Interface for ez80acclaim! MCUs

Interfacing Z8 Encore! XP MCUs with an I 2 C-Based Character LCD

SC1602LC 16x2 Large Characters RS232 LCD Module. User s Manual. Large Viewing Area 99mm x 24mm. Large Character Size. 4.84mm x 9.66mm.

Lab 3 LCD Mar

LCD03 - I2C/Serial LCD Technical Documentation

M0120SD 201MDB1 1. Vacuum Fluorescent Display Module

EDA482/487: Machine- Oriented Programming

MCU (or similar advanced microcontrollers) MCU

LCD MODULE 1x mm INCL. CONTROLLER HD 44780

SLCD1-IC Serial LCD Processor

CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral)

EE 308 Spring Lab on IIC Bus

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-2 LCD controllers/drivers. Product specification File under Integrated Circuits, IC12

The MC9S12 Timer Input Capture Function

LCD board. EB005

LCD03 - I2C/Serial LCD Technical Documentation

unit: mm 3044B - QFP80A unit: mm QFP80D

LM240128TCW LCD Module User Manual

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

ELCT501 Digital System Design Winter Tutorial #11 FPGA Complete Design Flow with LCD Example

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

COMP2121: Microprocessors and Interfacing. I/O Devices (II)

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.

OLED DISPLAY MODULE. Application Notes. DD-12833YW-1A with EVK board PRODUCT NUMBER

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

Capturing the Time of an External Event Input Capture Subsystem

Lab 5: LCD and A/D: Digital Voltmeter

DOT MATRIX CHARACTER LCD MODULE USER S MANUAL

LCD AND KEYBOARD INTERFACING

LCD MODULE 4x mm INCL. CONTROLLER SSD1803

Demystifying Character Based LCDs

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

LCD05 datasheet 1.0

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

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

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

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

Agenda. PicoBlaze Hello World project using the PicoBlaze. Class 9 Copyright 2011 Greg Tumbush Ver 1.0 1

melabs Serial LCD Firmware Version 1.0 2/7/07

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

RA8875 Custom Font By: Jason Lopez aka AtomSoft Web:

Verilog LCD Module Simulator Design Requirements. ECE 4890: Senior Seminar; Spring May 2010 Robert Ewing Steven Wilson

melabs Serial LCD Firmware Version 1.1 3/5/07

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

TN-192. Bar Graph shows analog trends on a dot-matrix character LCD module. Introduction. LCD Module Basics. Custom Characters

Laboratory 3 Working with the LCD shield and the interrupt system

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

Objectives : 1) To study the typical design of a LCD module 2) To interface the digital display unit through parallel printer port using C# program.

CS2351 Data Structures. Lecture 7: A Brief Review of Pointers in C

MBCF24204B03 技术手册 ( 完整版 ) DoYoung.net 原创技术资料 实物照片 机械参数表.

LCD Module User Manual

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

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

Transcription:

Dragon12 LCD Displays Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) o Using the Dragon12 LCD display Dragon12 LCD Display The Dragon12 board has a 16 character x 2 line display Each character is a 5x7 bit matrix A controller chip (Hitachi HD44780) converts ASCII characters to 5x7 bit image The controller chip is connected to Port K of the MC9S12 Bit 0 of Port K (PK0) selects command (0) or data (1) Bit 1 of Port K (PK1) enables the data transfer Bits 5 through 2 Port K (PK5-2) contain the data Bit 7 of Port K (PK7) can be used to select read or write. The LCD on the Dragon12 board is set up for write only; you need to cut a trace to be able to read from the LCD. Use of the display is discussed in the Hatronix_LCD2.pdf datasheet which is on the CD-ROM which came with the Dragon12 board.

Port K Signal LCD pin Pin function 0 RS 4 Reg select: 0=instruction, 1=data 1 Transfer 6 Enable data transfer 2 DB4 11 Data bus 3 DB5 12 Data bus 4 DB6 13 Data bus 5 DB7 14 Data bus 6 - - Not used 7 Write - Select read/write

You can send commands or data to the controller chip to control the LCD display. These commands and data are detailed in the Hatronix_LCD2.pdf datasheet. The commands are: Clear display and return cursor to home (upper left) Cursor home (don t clear display) Entry mode (move cursor left or write) Display on/off turns display on or off, cursor on or off, cursor blink Cursor/display shift move cursor or shift display, which direction Function set bus data width (8 or 4), number of display lines (1 or 2), font size 6x8 or 5x7) Set CG RAM address set address of CG (Character Generation) RAM to generate your own characters Set DD RAM Address set address of DD (Data Display) RAM to display characters Read busy flag and address (we can t use) Write data to DD RAM or CG RAM Read data from DD RAM or CG RAM (we can t use)

Dragon12 LCD Display The LCD display can use either 8-bit or 4-bit data bus. The Dragon12 board uses a 4-bit bus, so it takes two transfers to send one command The Dragon12 board is set so that you cannot read from the display; you can only write to it. When you write a command, you need to wait until the command has been executed by the LCD controller. The Busy Flag (from Read Busy Flag command) tells when the command is done. We cannot read Busy Flag, so we have to wait specified time before proceeding. To write to the controller, we need to: 1. Set RS (PK0) to 0 for command, 1 for data 2. Set R/Ŵ (On Dragon12, R/Ŵ tied low for write only) 3. Put 4 MSB on Port K bits 5-2 4. Bring E (PK1) high for at least 230 ns 5. Bring E (PK1) low 6. Put 4 LSB on Port K bits 5-2 7. Bring E (PK1) high for at least 230 ns 8. Bring E (PK1) low 9. Wait specified amount of time for execution to complete

To use LCD display Dragon12 LCD Display 1. Give command 0x28: Tell controller our display uses 4- bit data, 2-line display, 5x7 font 2. Give command 0x0F: Turn on display, use cursor, blink cursor 3. Give command 0x06: Move cursor to right after writing a character 4. Give command 0x01: Clear screen, move cursor to home (upper left character) 5. Wait for at least 1.64 ms After display is set up, you can write characters to display Handling LCD s & LCD Modules Do not touch display are with bare hands Do not touch exposed polarizer with hard objects Do not expose the CMOS IC s to static electricity Avoid exposing the module to excessive shock or pressure Do not allow the storage temperature to exceed the specified range

File lcd.h: #define LCD_DAT PORTK /*Port K drives LCD data pins, E, and RS #define LCD_DIR DDRK /*Direction of LCD port #define LCD_E 0x02 /*LCD E signal #define LCD_RS 0x01 /*LCD Register Select signal #define CMD 0 /*Command type for put2lcd #define DATA 1 /*Data type for put2lcd /* Prototypes for functions in lcd.c void openlcd(void); /* Initialize LCD display void put2lcd(char c, char type); /*Write command or data to LCD void puts2lcd (char *ptr); /* Write a string to the LCD display void delay_50us(int n); /* Delay n 50 microsecond intervals void delay_1ms(int n) ; /* Delay n 1 millisecond intervals

File lcd.c: #include "derivative.h" #include "lcd.h" void openlcd(void) LCD_DIR = 0xFF; /* configure LCD_DAT port for output delay_1ms(100); /* Wait for LCD to be ready put2lcd(0x28,cmd); /* set 4-bit data, 2-line display, 5x7 font put2lcd(0x0f,cmd); /* turn on display, cursor, blinking put2lcd(0x06,cmd); /* move cursor right put2lcd(0x01,cmd) /* clear screen, move cursor to home delay_1ms(2); /* wait until "clear display" command /* complete void puts2lcd (char *ptr) while (*ptr) /* While character to send put2lcd(*ptr,data); /* Write data to LCD delay_50us(1); /* Wait for data to be written ptr++; /* Go to next character void put2lcd(char c, char type) char c_lo, c_hi; c_hi = (c & 0xF0) >> 2; /* Upper 4 bits of c c_lo = (c & 0x0F) << 2; /* Lower 4 bits of c if (type == DATA) LCD_DAT = LCD_RS; /* select LCD data /*register

else LCD_DAT &= (~LCD_RS); /* select LCD command /* register if (type == DATA) LCD_DAT = c_hi LCD_E LCD_RS; /* output upper 4 bits, /* E, RS high else LCD_DAT = c_hi LCD_E; /* output upper 4 bits, E, /* RS low LCD_DAT = LCD_E; /* pull E signal to high asm(nop); /* Lengthen E asm(nop); asm(nop); LCD_DAT &= (~LCD_E); /* pull E to low if (type == DATA) LCD_DAT = c_lo LCD_E LCD_RS; /* output lower 4 bits, E, RS high else LCD_DAT = c_lo LCD_E; /* output lower 4 bits, E, RS low * LCD_DAT = LCD_E; /* pull E to high asm(nop); /* Lengthen E asm(nop); asm(nop); LCD_DAT &= (~LCD_E); /* pull E to low * delay_50us(1); /* Wait for command to /* execute #define D50US 133 /* Inner loop takes 9 cycles; void delay_50us(int n) /* need 50x24 = 1200 cycles volatile int c; for (;n>0;n--) for (c=d50us;c>0;c--) ;

void delay_1ms(int n) for (;n>0;n--) delay_50us(200); File main.c: #include <hidef.h> /* common defines and macros #include "derivative.h" /* derivative-specific definitions #include "lcd.h" void main(void) char *msg1 = "Hello, World!"; char *msg2 = "From Bill"; openlcd(); // Initialize LCD display puts2lcd(msg1); // Send first line put2lcd(0xc0,cmd); // move cursor to 2nd row, 1st column puts2lcd(msg2); // Send second line asm(swi);

Code to convert integer to character (courtesy of Riley Myers): int main(void) int value, data; unsigned char i, j; char msg[8] = 0;... value = hex2bcd(data); /* This will place the number in value in the first 4 characters of the * character buffer msg for (i = 0, j = 3; j >= 0; i++, j--) /* This takes the jth nybble of value, ands it with 0xf to * isolate it, and then converts it to ascii by adding 0x30, the * ascii value of zero. It then stores this in the ith element * of msg. msg[i] = 0x30 + ((value >> (4 * j)) & 0x0f);

* @file lcd.c * @author Hector Erives; Revisions By Kelsey J. Harvey. * @date April 8, 2017. * @brief Functions used for outputting to the LCD display of the MC9S12 * Micro-Controller. * @bugs None Yet Discovered. #include "lcd.h" * Initialises the necessary bits and ports for LCD output * @param None (void). * @return None (void). void open_lcd(void) MOV_BYTE(LCD_DIRECTION, 0xFF); /* configure LCD_DAT port for output delay_1ms(100); /* Wait for LCD to be ready put_to_lcd(0x28, COMMAND); /* set 4-bit data, 2-line display, 5x7 font put_to_lcd(0x0f, COMMAND); /* turn on display, cursor, blinking put_to_lcd(0x06, COMMAND); /* move cursor right put_to_lcd(0x01, COMMAND); /* clear screen, move cursor to home delay_1ms(2); /* wait until "clear display" command complete * Sends either character data or command data to the LCD Display. * @param entry, The data to be sent to the LCD Display. * @param type, The type of data being sent (character or command). * @return None, (void). void put_to_lcd(char entry, char data_type) char entry_hon = (entry & 0xF0) >> 2; The Higher-Order Nyble of 'entry'. * char entry_lon = (entry & 0x0F) << 2; The Lower-Order Nyble of 'entry'. * Determines if the High-Order Nyble is a Command or Character. * LCD_ENTRY = data_type? entry_hon LCD_SEND_CHARACTER : entry_hon LCD_SEND_COMMAND; delay_230ns(); Delay for 230 nano-seconds. * CLR_BITS(LCD_ENTRY, LCD_ENABLE_TRANSFER); Clear Port K for new data. * Determines if the Low-Order Nyble is a Command or Character. * LCD_ENTRY = data_type? entry_lon LCD_SEND_CHARACTER : entry_lon LCD_SEND_COMMAND; delay_230ns(); Delay for 230 nano-seconds. * CLR_BITS(LCD_ENTRY, LCD_ENABLE_TRANSFER); Clear Port K for new data. * delay_50us(1); Delay for 50 micro-seconds. * * Sends a string to the LCD Display. * @param output_str, The character string to be outputted to the display. * @return None, (void). void puts_to_lcd (char *output_str) while (*output_str) /* While not at end of the string. put_to_lcd(*output_str, CHARACTER); /* Write character to LCD Display. delay_50us(1); /* Wait for said data to be written.

output_str++; /* Go to the next character with Pointer Arithmetic. * Delays for 50 micro-seconds. * @param n, The number of 50 us increments to delay for. * @return None, (void). void delay_50us(int n) /* need 50x24 = 1200 cycles volatile int c; while (n--)c = D50US; while (c--); * Delays for 1 milli-second. * @param n, The number of milli-seconds to delay for. * @return None, (void). void delay_1ms(int n) while (n--) delay_50us(200); * Delays for 230 nano-seconds. * @param None, (void). * @return None, (void). void delay_230ns(void) _asm(nop); _asm(nop); _asm(nop);

* @file lcd.h * @author Hector Erives ; Revisions By Kelsey J. Harvey. * @date April 8, 2017. * @brief Function Prototypes for functions defined in lcd.c and Macro Definitions for user utilization. * @bugs None Yet Discovered. #define LCD_ENTRY *(volatile unsigned char*)(0x32) Port K Redefinition * #define LCD_DIRECTION *(volatile unsigned char*)(0x33) DDRK Redefinition * #define LCD_ENABLE_TRANSFER 0x02 Enable the transfer of Character/Command data when used on Port K. * #define LCD_SEND_COMMAND 0x02 Set Port K so as to send Command Data. * #define LCD_SEND_CHARACTER 0x03 Set PORT K so as to send Character Data. * #define COMMAND 0 #define CHARACTER 1 #define SET_BITS(BYTE, MASK) #define CLR_BITS(BYTE, MASK) #define MOV_BYTE(BYTE, VALU) BYTE = MASK BYTE &= ~MASK BYTE = VALU #define D50US 133 /* Inner loop takes 9 cycles; void open_lcd(void); void put_to_lcd(char c, char type); void puts2lcd (char *ptr); void delay_50us(int n); void delay_1ms(int n) ; void delay_230ns(void);