prefect
Home Engineering Audio Biking Publications Photo Gallery Personal Info
DACS: Alphanumeric LCD Driver Code, stdlcd.c
 
  next up previous contents
Next: Control Board Up: Firmware Library, dacslib Previous: Alphanumeric LCD Driver Header,   Contents

Alphanumeric LCD Driver Code, stdlcd.c

/*****************************************************************************
 * DACS : Distributed Audio Control System
 *============================================================================
 *         File: stdlcd.c
 *       Author: Stephen S. Richardson
 * Date Created: 04.14.97
 *  Environment: ICC11 v4.0, 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
 *****************************************************************************/
 * Source code control:
 *
 * $Id: stdlcd.c,v 1.1 1997/07/23 22:33:29 prefect Exp prefect $
 *
 *****************************************************************************/

#include <hc11.h>
#include "stdlcd.h"
#include "lcddefn.h"

/*****************************************************************************
 * stdlcd_writecmd
 *
 * write a command byte to a standard lcd
 *****************************************************************************/
void stdlcd_writecmd (unsigned char idx, unsigned char d)
{
  unsigned char *o;

  while ((STDLCD_CMD+(idx*STDLCD_OFFSET))&0x80);
  o=&STDLCD_CMD+(idx*STDLCD_OFFSET);
  *o=d;
}

/*****************************************************************************
 * stdlcd_writechar
 *
 * write a data byte to a standard lcd
 *****************************************************************************/
void stdlcd_writechar (unsigned char idx, unsigned char d)
{
  unsigned char *o;

  while ((STDLCD_CMD+(idx*STDLCD_OFFSET))&0x80);
  o=&STDLCD_DATA+(idx*STDLCD_OFFSET);
  *o=d;
}

/*****************************************************************************
 * stdlcd_out
 *
 * write a string of data to a standard lcd
 *****************************************************************************/
void stdlcd_out (unsigned char idx, char *s)
{
  unsigned char *o;

  while (*s) {
    while ((STDLCD_CMD+(idx*STDLCD_OFFSET))&0x80);
    o=&STDLCD_DATA+(idx*STDLCD_OFFSET);
    *o=(unsigned char) *s;
    s++;
  }
}


/*****************************************************************************
 * stdlcd_init
 *
 * initialize a standard lcd
 *****************************************************************************/
void stdlcd_init (unsigned char idx, int *s)
{
  unsigned char *o;

  while (*s!=-1) {
    while ((STDLCD_CMD+(idx*STDLCD_OFFSET))&0x80);
    o=&STDLCD_CMD+(idx*STDLCD_OFFSET);
    *o=(unsigned char) *s;
    s++;
  }
}


/*****************************************************************************
 * stdlcd_clrhome
 *
 * clears standard lcd screen, homes cursor.
 *****************************************************************************/
void stdlcd_clrhome (unsigned char idx)
{
  stdlcd_writecmd(idx, 0x01);
  stdlcd_writecmd(idx, 0x00);
}

/*****************************************************************************
 * stdlcd_clrhome
 *
 * places the cursor on a standard lcd
 *****************************************************************************/
void stdlcd_goto (unsigned char idx, unsigned char pos)
{
  stdlcd_writecmd(idx, pos|0x80);
}


/*****************************************************************************
 * stdlcd_bar
 *
 * draws a percentage type bar graph on a standard lcd
 *****************************************************************************/
void stdlcd_bar (unsigned char idx, unsigned char pos, unsigned char *part,
                 unsigned char total)
{
  char txt[41], i;
  
  stdlcd_goto (idx, pos);

  for (i=0;i<total;i++) {
    if (i+1<part) txt[i]=0xDB; 
    else txt[i]=' ';
  }

  txt[total]=0;

  stdlcd_out (idx, txt);

}


Steve Richardson 2000-07-06
Table of Contents

[PDF] [Whole document in PDF 1.9MB]

[more photos and information]

 
Page last modified:
Copyright © 1993-2000 prefect - All Rights Reserved.