| |
Datasheet Home \ Datasheet Details
Download
PDF Abstract Text:
Order this document by AN1287 / D
AN1287
Freescale Semiconductor, Inc.
Order this document by AN1287 / D
Motorola Semiconductor Application Note
AN1287
Freescale Semiconductor, Inc..
MC68HC708LN56 LCD Utilities
By Rick Cramer CSIC Product Engineering Austin, Texas
Introduction
A set of software utilities that causes the LCD module on the MC68HC708LN56 to function is described in this application note. Information about LCD software subroutines that, with minimal effort, can be called to write text to the display also is included here. Additionally, this information can be used as a basis to develop more complex graphical subroutines.
LCD Hardware General Information
The LCD module has of group of frontplanes and backplanes that intersect on the display to form pixels. The 40 frontplanes and 32 backplanes form 40 x 32 (or 1280) pixels. By implementing the LCD hardware in different configurations, these pixels can be arranged to form any type of display. When the hardware is arranged in a twodimensional array, the pixels form a display of 40 x 32 dots. By turning on these pixels in a specific pattern, alphabet characters or special symbols can be formed. All the characters on a typical computer keyboard can be displayed by an array of pixels seven pixels high by five pixels wide, which enables the MC68HC708LN56 to display an 8 x 4
AN1287
For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
LCD Hardware General Information
Freescale Semiconductor, Inc..
Figure 1. LCD Display Representation The MC68HC708LN56 associates one RAM byte (8 bits) for each column in a character. So, a 5 x 7 character actually takes up 5 x 8 bits of RAM. Each column of every LCD character has a specific memory address associated with it. By writing to these addresses, as shown in Figure 2, the display can be made to exhibit information.
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note LCD Hardware General Information
Data Plane Address
BP0 Bit 0
Freescale Semiconductor, Inc..
BP1 Bit 1 BP2 Bit 2 BP3 Bit 3 BP4 Bit 4 BP5 Bit 5 BP6 Bit 6
Figure 2. LCD Character Representation
FP4 FP0
BP0 BP8 BP0-31 BP24 BP31
Figure 3. LCD Panel Dot Matrix Example
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Subroutine Descriptions
Freescale Semiconductor, Inc..
General Description
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Subroutine Descriptions
Freescale Semiconductor, Inc..
The main code section is designed as an example of what is needed to enable the LCD and to call the subroutines. The main code clears the display, writes text to the screen, then loops through memory, updating only sections of the screen and displaying the current address and the data contained at that address. The loop repeats after cycling through memory.
RAM Subroutines
The RAM subroutines are designed to be called by other subroutines. They are modified by the calling subroutine before they are called. The RAM subroutines contain this assembled data:
NOTE:
Care must be taken not to overwrite the two opcodes, LDA and RTS. If these locations are accidentally changed, the MCU could get hopelessly lost executing code that is invalid.
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Subroutine Descriptions
AN1287
Freescale Semiconductor, Inc..
BINTOASC
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Subroutine Descriptions
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
WRITEIT Tables
WRITEIT2
Freescale Semiconductor, Inc..
Tables
The LCD utilities use several tables which contain information that the subroutines use for positioning the characters on the LCD display.
LCDLOC
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Tables
LCDBACK
The LCDBACK table is used to indicate if the writeit subroutine is to write a specific character on the LCD screen backward. This is necessary because of circuit board layout restrictions that may require some of the frontplanes to be wired in reverse order. This will enable the use of the same character table no matter how the display is wired.
CHARROM
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note Code Listings
Code Listings
Freescale Semiconductor, Inc..
RESET and Interrupt Vectors For any interrupts used, the ORG and FDB statement given below must be placed in the routine using the interrupt. org RESET fdb BEGIN
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
Freescale Semiconductor, Inc..
Current Position in String Space for controller generated
Freescale Semiconductor, Inc. Application Note
Code Listings
lda sta lda sta
Store A Extended Opcode RTS OpCode
Freescale Semiconductor, Inc..
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Code Listings
Freescale Semiconductor, Inc..
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Code Listings
Freescale Semiconductor, Inc..
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Code Listings
find first data byte of lda HI+1 add OFFSET+1 sta OFFSET+1 lda HI adc OFFSET sta OFFSET ldhx OFFSET sthx HI clrh clrx
the current char to write Get base address of char rom Add the offset To find the first data byte of single character to write
Freescale Semiconductor, Inc..
BYTE 3
BYTE 4
BYTE 5
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
WriteIt2 subroutine takes beginning data byte and the next four and writes it onto the LCD screen, but it does it backward. WRITEIT2 jsr jsr jsr jsr INLOC2 INLOC2 INLOC2 INLOC2 OPCD INVERT OPCD3 INLOC DECLOC2 OPCD INVERT OPCD3 INLOC DECLOC2 OPCD INVERT OPCD3 INLOC DECLOC2 OPCD INVERT OPCD3 INLOC DECLOC2 OPCD INVERT OPCD3 increment 4 positions in the character table beacuse it will be writen backward
Freescale Semiconductor, Inc..
jsr eor jsr jsr jsr jsr eor jsr jsr jsr jsr eor jsr jsr jsr jsr eor jsr jsr jsr jsr eor jsr RTS
BYTE 3
BYTE 4
BYTE 5
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Code Listings
Freescale Semiconductor, Inc..
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB FDB
Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos Pos
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Code Listings
Freescale Semiconductor, Inc..
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB AN1287 MOTOROLA
Freescale Semiconductor, Inc..
For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Code Listings
FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB
Freescale Semiconductor, Inc..
~ y (Batwing) (Batwing) (Batwing) (Batwing) (Batwing) (Batwing) M -TOP M -BOT O O T T R R AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Code Listings
FCB FCB FCB FCB ENDLOC:
Freescale Semiconductor, Inc..
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note Flow Chart
Flow Chart
BEGIN
Freescale Semiconductor, Inc..
TURN OFF COP
CLEAR VARIABLES
INITIALIZE VARR LOOP
SETUP RAM SUBROUTINE
WRITE DATA TO DISPLAY
CLEAR DISPLAY INCREMENT VARR LOOP TURN LCD ON
WRITE INITIAL DISPLAY TEXT
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Flow Chart
BINTOASC SUBROUTINE
STORE DATA IN RAM BUFFER MSG
STORE DATA AND LOCATION IN RAM
Freescale Semiconductor, Inc..
STORE DELIMITER CHARACTER IN RAM MESSAGE BUFFER (MSG+1)
CONVERT LOWER NIBBLE OF DATA FROM BINARY TO ASCII
STORE LOWER NIBBLE IN RAM BUFFER (MSG+1)
CONVERT UPPER NIBBLE OF DATA FROM BINARY TO ASCII
STORE DELIMITER CHARACTER IN RAM MESSAGE BUFFER (MSG+2)
STORE UPPER NIBBLE TO RAM (MSG)
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Flow Chart
STORE DATA AND LOCATION IN RAM
CLEAR POINTER
STRPOS
Freescale Semiconductor, Inc..
COPY STRING POINTER TO RAM SUBROUTINE
CHANGE RAM SUBROUTINE FOR INDEXED ADDRESSING
GET CHARACTER FROM STRING
YES RTS
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Flow Chart
CLS SUBROUTINE
CLEAR X REGISTER
Freescale Semiconductor, Inc..
CLEAR LCD BANK1, X
CLEAR LCD BANK2, X
CLEAR LCD BANK4, X
CLEAR LCD BANK3, X
INCREMENT X REGISTER
YES RTS
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note
Flow Chart
INV SUBROUTINE
CLEAR X REGISTER
Freescale Semiconductor, Inc..
COMPLIMENT LCD BANK1, X
COMPLIMENT LCD BANK2, X
COMPLIMENT LCD BANK4, X
COMPLIMENT LCD BANK3, X
INCREMENT X REGISTER
AN1287
MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc.
Application Note Flow Chart
WRITE POSITION SUBROUTINE
STORE DATA AND LOCATION IN RAM GET BACKWARD DATA FROM TABLE
SETUP RAM SUBROUTINE FOR EXTENDED ADDRESSING
Freescale Semiconductor, Inc..
STORE BACKWARD DATA IN "BACK" LOOKUP LCD MEMORY LOCATION IN TABLE
STORE LCD LOCATION IN RAM SUBROUTINE
AN1287 MOTOROLA For More Information On This Product, Go to: www.freescale.com
Freescale Semiconductor, Inc. Application Note R E Q U I R E D N O N - D I S C L O S U R E
Freescale Semiconductor, Inc..
How to reach us: USA / EUROPE / Locations Not Listed: MOTOROLA LITERATURE DISTRIBUTION: P.O. Box 20912 Phoenix, Arizona 85036.1-800-441-2447 or 602-303-5454 MFAX: RMFAX0@email.sps.mot.com - TOUCHTONE (602) 244-6609 INTERNET: http://Design-NET.com JAPAN: Nippon Motorola Ltd. Tatsumi-SPD-JLDC, 6F Seibu-Butsuryu-Center, 3-14-2 Tatsumi Koto-Ku, Tokyo 135, Japan. 03-81-3521-8315 ASIA / PACIFIC: Motorola Semiconductors H.K. Ltd. 8B Tai Ping Industrial Park, 51 Ting Kok Road, Tai Po, N.T., Hong Kong. 852-26629298
For More Information On This Product, Go to: www.freescale.com
AN1287 / D
|