ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

Looking Good


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

LOOKING GOOD

Silicon Online Using a Graphics-Based LCD
Module with C

by Bob Perrin and Tak Auyeung

Start ý Software Overview ý The Bottom Layer ý Initializing the LCD Display ý Shadow Display ý Drawing Dots and Lines ý Printing Text ý Extensions ý Sources and PDF

THE BOTTOM LAYER

Before implementing high-level graphics primitives, the driver needs to communicate with the Hantronix HDG12864F-1. Thanks to the serial interface, the LCD requires only four bit-programmable digital I/O lines, although, in this article, the controller has power over all seven signals for experimentation purposes. The chip select (*CS1), write (*WR), and read (*RD) signals can be pulled low, low, and high, respectively. This leaves only four signals to be controlled: serial-input (SI), serial-clock (SCL), address (A0), and reset (*RES).

In serial mode, the Hantronix HDG12864F-1 does not provide status check or return pixel information. The status check is not necessary because the serial interface is slow enough that the LCD controller completes an operation before the next one arrives. Also, for a controller with a lot of RAM, there is no need to return pixel information. The JK Microsystems Flashlite controller has plenty of RAM to shadow store the pixels on the LCD screen. The 128 ý 64 pixel screen needs bytes to keep a copy of the entire LCD screen.

The JK Microsystems Flashlite uses the NEC V25+ processor with on-chip bit-programmable digital I/O ports. These ports are memory-mapped to the memory space available on the V25+. The following Borland C++ definitions define the data port, direction/mode port, and control port, respectively.

ý volatile unsigned char far * const port0 = (unsigned char far *)0xf000ff00L

ý volatile unsigned char far * const port0mode = (unsigned char far *)0xf000ff01L

ý volatile unsigned char far * const port0ctrl = (unsigned char far *)0xf000ff02L

It is important to indicate volatile for the locations pointed to by the pointers. This keyword tells the compiler that the locations pointed to can be accessed in parallel. The FAR keyword is also important to indicate that the addresses are not in the data segment. Note that these are constant pointers. In other words, the pointers themselves cannot be altered.

With these pointers declared, accessing the ports is a simple matter of de-referencing the pointers. Both read and write operations can be performed when accessing a normal memory location via pointers.

The driver configures all bit-addressable I/O pins as general-purpose output signals. When the graphics LCD is initialized, the reset line is toggled to ensure a hardware reset for the COG module. The driver software transmits commands to the graphics LCD by bit-banging the SI and SCL lines.

PREVIOUSNEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.

Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ