circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 


Published April 2000

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

SHADOW DISPLAY

Because the clocked-serial interface doesn’t allow the display data to be read, it is important to maintain a shadow copy of the display data on the controller. It is equally important to maintain shadow copies of LCD controller registers so that the correct byte in the shadow display data buffer can be updated. The structure (struct _scrBuffer) contains all the shadowed state information. The functions scrPageAddressSet, scrColumnAddressSet, and scrDisplayDataWrite mimic the LCD macros, but the scr functions also update a struct _scrBuffer structure, in addition to sending commands to the Hantronix HDG12864F-1.

Currently, all scr operations except scrVirtualDisplayWrite send commands to the LCD module to keep the LCD and shadowed state synchronized. For efficiency, however, the reader may extend some of the functions to update only the shadowed state and implement another function to update the entire or part of the actual LCD display data. This is more efficient for drawing a long sequence of graphics primitive operations.

BRUSH TYPES

Instead of overwriting a display pixel, some applications may need to combine new graphics constructs with existing pixels on the LCD. The driver supports four methods (brush types) to combine new pixels with existing pixels. The current brush type is specified by the function scrSetBrush with one of the following constants (newPix is the new pixel, oldPix is the current display pixel value, and pix is the combined pixel value to update the LCD):

• SCR_BRUSH_SET: pix = oldPix | newPix

• SCR_BRUSH_CLR: pix = oldPix & (~newPix)

• SCR_BRUSH_XOR: pix = oldPix ^ newPix

• SCR_BRUSH_OVR: pix = newPix

The brush type is applicable to all drawing primitives.

PREVIOUSNEXT