Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ks0108.h

Go to the documentation of this file.
00001 /*! \file ks0108.h \brief Graphic LCD driver for HD61202/KS0108 displays. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'ks0108.h'
00005 // Title        : Graphic LCD driver for HD61202/KS0108 displays
00006 // Author       : Pascal Stang - Copyright (C) 2001-2003
00007 // Date         : 10/19/2002
00008 // Revised      : 5/1/2003
00009 // Version      : 0.5
00010 // Target MCU   : Atmel AVR
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: This code is currently below version 1.0, and therefore is considered
00014 // to be lacking in some functionality or documentation, or may not be fully
00015 // tested.  Nonetheless, you can expect most functions to work.
00016 //
00017 /// \ingroup driver_hw
00018 /// \defgroup ks0108 Graphic LCD Driver for HD61202/KS0108-based Displays (ks0108.c)
00019 /// \code #include "ks0108.h" \endcode
00020 /// \par Overview
00021 ///     This display driver performs the basic functions necessary to access
00022 /// any graphic LCD based on the KS0108 or HD61202 controller chip.  For more
00023 /// advanced functions, use this driver in conjunction with glcd.c.
00024 /// KS0108/HD61202 displays typically range in size from 64x32 pixels to
00025 /// 128x128 pixels and up to 3" square.  To determine whether a display is
00026 /// compatible, you should look for the above controller chips to be mounted
00027 /// on the PC board attached to the display glass.  The controller chips are
00028 /// about 1/2" x 3/4" and have 80+ pins. On larger displays, you may also see
00029 /// slave LCD driver chips with the numbers KS0107 or HD61203.  The display
00030 /// will likely have an 18 or 20-pin interface.  The interface from the LCD
00031 /// to an AVR processor does not require any additional hardware.  If you can
00032 /// locate a datasheet for your display, that plus the information in the
00033 /// ks0108conf.h file should be all you need to get hooked up.
00034 //
00035 // This code is distributed under the GNU Public License
00036 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00037 //
00038 //*****************************************************************************
00039 
00040 
00041 #ifndef KS0108_H
00042 #define KS0108_H
00043 
00044 #include "global.h"
00045 
00046 #include "ks0108conf.h"
00047 
00048 // HD61202/KS0108 command set
00049 #define GLCD_ON_CTRL        0x3E    // 0011111X: lcd on/off control
00050 #define GLCD_ON_DISPLAY     0x01    //      DB0: turn display on
00051 
00052 #define GLCD_START_LINE     0xC0    // 11XXXXXX: set lcd start line
00053 
00054 #define GLCD_SET_PAGE       0xB8    // 10111XXX: set lcd page (X) address
00055 #define GLCD_SET_Y_ADDR     0x40    // 01YYYYYY: set lcd Y address
00056 
00057 #define GLCD_STATUS_BUSY    0x80    // (1)->LCD IS BUSY
00058 #define GLCD_STATUS_ONOFF   0x20    // (0)->LCD IS ON
00059 #define GLCD_STATUS_RESET   0x10    // (1)->LCD IS RESET
00060 
00061 // determine the number of controllers
00062 // (make sure we round up for partial use of more than one controller)
00063 #define GLCD_NUM_CONTROLLERS    ((GLCD_XPIXELS+GLCD_CONTROLLER_XPIXELS-1)/GLCD_CONTROLLER_XPIXELS)
00064 
00065 // typedefs/structures
00066 typedef struct struct_GrLcdCtrlrStateType
00067 {
00068     unsigned char xAddr;
00069     unsigned char yAddr;
00070 } GrLcdCtrlrStateType;
00071 
00072 typedef struct struct_GrLcdStateType
00073 {
00074     unsigned char lcdXAddr;
00075     unsigned char lcdYAddr;
00076     GrLcdCtrlrStateType ctrlr[GLCD_NUM_CONTROLLERS];
00077 } GrLcdStateType;
00078 
00079 // function prototypes
00080 void glcdInitHW(void);
00081 void glcdBusyWait(u08 controller);
00082 void glcdControlWrite(u08 controller, u08 data);
00083 u08  glcdControlRead(u08 controller);
00084 void glcdDataWrite(u08 data);
00085 u08  glcdDataRead(void);
00086 void glcdSetXAddress(u08 xAddr);
00087 void glcdSetYAddress(u08 yAddr);
00088 
00089 
00090 //! Initialize the display, clear it, and prepare it for access
00091 void glcdInit(void);
00092 //! Clear the display
00093 void glcdClearScreen(void);
00094 //! Set display memory access point back to upper,left corner
00095 void glcdHome(void);
00096 //! Set display memory access point to row [line] and column [col] assuming 5x7 font
00097 void glcdGotoChar(u08 line, u08 col);
00098 //! Set display memory access point to [x] horizontal pixel and [y] vertical line
00099 void glcdSetAddress(u08 x, u08 yLine);
00100 //! Set display memory access point to row [line] and column [col] assuming 5x7 font
00101 void glcdStartLine(u08 start);
00102 //! Generic delay routine for timed glcd access
00103 void glcdDelay(u16 p);
00104 #endif

Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by  doxygen 1.4.2