|   | 
          
            
  
  
  
   
 
 Next: Alphanumeric and Graphics LCD
 Up: Control Board
 Previous: Graphics LCD Driver Header,
     Contents 
 
 
/*****************************************************************************
 * DACS : Distributed Audio Control System
 *============================================================================
 *         File: gfxlcd.c
 *       Author: Stephen S. Richardson
 * Date Created: 04.14.97
 *  Environment: ICC11 v3.6, 68HC11 target
 *        Build: library, not standalone
 *============================================================================
 * The code, executables, documentation, firmware images, and all related
 * material of DACS are  
 * Copyright (C) 1997 Stephen S. Richardson - ALL RIGHTS RESERVED
 *****************************************************************************/
#include <hc11.h>
#include "gfxlcd.h"
#include "lcddefn.h"
/*****************************************************************************
 * gfxlcd_writecmd
 *
 * write a command byte to a graphics lcd
 *****************************************************************************/
void gfxlcd_writecmd (unsigned char d)
{
  while (!(GFXLCD_CMD & GFXLCD_RDY));
  GFXLCD_CMD=d;
}
/*****************************************************************************
 * gfxlcd_writedata
 *
 * write a data byte to a graphics lcd
 *****************************************************************************/
void gfxlcd_writedata (unsigned char d)
{
  while (!(GFXLCD_CMD & GFXLCD_RDY));
  GFXLCD_DATA=d;
}
/*****************************************************************************
 * gfxlcd_cleartext
 *
 * clears the text area of a graphics lcd
 *****************************************************************************/
void gfxlcd_cleartext (void)
{
  int i;
  gfxlcd_writedata (0x00);
  gfxlcd_writedata (0x10);
  gfxlcd_writecmd (0x24);     /* text home address cmd */
  
  for (i=0;i<320;i++) {
    gfxlcd_writedata (0);
    gfxlcd_writecmd (0xC0);
  }
}
/*****************************************************************************
 * gfxlcd_textxy
 *
 * positions the cursor in the text area of a graphics lcd
 *****************************************************************************/
void gfxlcd_textxy (unsigned char x, unsigned char y)
{
  unsigned int i;
  unsigned char hi, lo;
  i=(y*40)+x;
  hi=((i&0xFF00)>>8);
  lo=(i&0x00FF);
  gfxlcd_writedata (lo);
  gfxlcd_writedata (0x10+hi);
  gfxlcd_writecmd (0x24);     /* text home address cmd */
}
/*****************************************************************************
 * gfxlcd_textout
 *
 * output a string of text to the text area of a graphics lcd
 *****************************************************************************/
void gfxlcd_textout (char *s)
{
  while (*s) {
    gfxlcd_writedata ((unsigned char) *s - 32);
    gfxlcd_writecmd (0xC0);
    s++;
  }
}
/*****************************************************************************
 * gfxlcd_btmbar
 *
 * make a graphics-mode bar graph at the bottom of the display
 * (looks like a fader knob)
 *****************************************************************************/
void gfxlcd_btmbar (unsigned char pos, unsigned char height)
{
  unsigned char ystop,hi,lo;
  unsigned int y;
  unsigned int a;
  gfxlcd_writecmd (0x9C);
  ystop=53-height;
  for (y=53;y>0;y--) {
      a=(y*40)+pos;
      hi=((a&0xFF00)>>8);
      lo=(a&0x00FF);
  
      gfxlcd_writedata (lo);
      gfxlcd_writedata (hi);
      gfxlcd_writecmd (0x24);
      
      if ((y==ystop)||(y==ystop-1)) {
	gfxlcd_writedata (0x1F);
      } else {
	gfxlcd_writedata (0x04);
      }
      gfxlcd_writecmd (0xC0);
  }
}
/*****************************************************************************
 * gfxlcd_init
 *
 * initialize the Toshiba TLX-711A graphics LCD
 *****************************************************************************/
void gfxlcd_init (void)
{
  int i;
  gfxlcd_writecmd (0x80);  /* OR mode */
  
  gfxlcd_writedata (0x00);
  gfxlcd_writedata (0x00);
  gfxlcd_writecmd (0x42);
  
  gfxlcd_writedata (0x28);
  gfxlcd_writedata (0x00);
  gfxlcd_writecmd (0x43);
  
  gfxlcd_writedata (0x00);
  gfxlcd_writedata (0x10);  /* text home address set */
  gfxlcd_writecmd (0x40);
  
  gfxlcd_writedata (0x28);
  gfxlcd_writedata (0x00);  /* number of text areas set */
  gfxlcd_writecmd (0x41);
  
  gfxlcd_writecmd (0x9C);
  
  gfxlcd_writedata (0x00);
  gfxlcd_writedata (0x00);  /* graphic home address set */
  gfxlcd_writecmd (0x42);
  
  gfxlcd_writedata (0x00);
  gfxlcd_writedata (0x00);  /* address pointer set */
  gfxlcd_writecmd (0x24);
  
  for (i=0;i<2560;i++) {
    gfxlcd_writedata (0x00);
    gfxlcd_writecmd (0xC0);  /* write data */
  }
  
  gfxlcd_cleartext();
  gfxlcd_textxy (25,0);
  gfxlcd_textout ("DACS model 112");
  gfxlcd_textxy (0,7);
  gfxlcd_textout ("0123456789ABCDEF");
  gfxlcd_writecmd (0x9C);
}
  
Steve Richardson
2000-07-06
 | 
Table of Contents
 
 
[Whole document in PDF 1.9MB]
 
 
[more photos and information]
 
 |