DM&P Text LCM DOS Library Reference

2002/06/18 Version 1.01

Text LCM

We provide a lot of embedded CPU modules. Besides, we provide graphics/text LCM. Release graphic/text LCM library in order to reduce development time for our user. The library is for M6117D CPU only. It's ran on large memory model under DOS. This library is for HD44780 based character LCM. It can support text LCM less than 80X4 (includes 16X2, 20X2, 40X2, 20X4, etc).

If you have any problem, mail to soc@dmp.com.tw please.

Example

Text library is easy to use. The sample code is from demo.c of text library. Compile and run it, you will see "Hello" on LCM.


#include <stdio.h>
#include "textlcm.h"

void main()
{
  char cType;
  int  nLcmType;

  printf("\nDM&P Text LCM Library Demo Program, %s %s.\n\n",__DATE__,__TIME__);
  printf("TextLCM Library Version %s\n\n",TextLcm_Version());

  printf("1. GPIO\n");
  printf("2. Printer Port\n");
  printf("\nYour LCM type: ");
  scanf("%c",&cType);

  switch(cType)
  {
    case '1': nLcmType = LCM_GPIO; break;
    case '2': nLcmType = LCM_PRN;  break;
    default:  printf("Error\n"); return;
  }

  /* Initialize text LCM library */
  if(TextLcm_Init(nLcmType)==0)
  {
    printf("Unable to initialize LCM library.\n");
    return;
  }

  /* Clear LCM. Show text "Hello" */
  TextLcm_ClearScreen();
  TextLcm_SetCursor(1,1);
  TextLcm_printf("Hello");
}

Function Reference



char *TextLcm_Version();

Description: Get library version string.
Arguments:
Return Library version.
Example:

/* Show TextLCM version. */
printf("DM&P TextLCM Library Version %s\n",TextLcm_Version());
	


int TextLcm_Init(int nIoType);

Description: Initialize text LCM and set I/O connection mode.
Arguments:
Return 0 is error, non-zero is okay.
nIoType I/O mode: LCM_GPIO,LCM_PRN.
Example:

if(TextLcm_Init(LCM_GPIO))
  printf("Unable to initialize LCM library\n");
	

void TextLcm_printf(char *szFmt, ...);

Description: Print formated string on LCM.
Arguments:
szFmt Format string, the same as printf().
Example:

TextLcm_printf("<Mity-Mite Module>\nIP:192.168.0.100");
	

void TextLcm_ClearScreen();

Description: Clear LCM.
Arguments: N/A
Example:

TextLcm_ClearScreen();
TextLcm_printf("\nIP:%s",szBuf);
	

void TextLcm_SetCursor(int x,int y);

Description: Set cursor position of LCM. (1,1) is left-top.
Arguments:
x X coordinate.
y Y coordinate.
Example:

TextLcm_SetCursor(1,1);
	

void TextLcm_CursorLeft()

Description: Move cursor left.
Arguments: N/A
Example:

TextLcm_CursorLeft();
	

void TextLcm_CursorRight()

Description: Move cursor right.
Arguments: N/A
Example:

TextLcm_CursorRight();
	

void TextLcm_CursorOn()

Description: Enable cursor.
Arguments: N/A
Example:

TextLcm_CursorOn();
	

void TextLcm_CursorOff()

Description: Disable cursor.
Arguments: N/A
Example:

TextLcm_CursorOff();
	

DMP Electronics Inc. All rights reserved. Email us: info@dmp.com.tw