2001 Microchip Technology Inc. DS39024B-page 37
LCD.C Description
5.5 LCD.C Source Code Listing
//****************************************************
//* LCD.C
//****************************************************
//* Rodger Richey
//* Principal Applications Engineer
//* Microchip Technology Incorporated
//****************************************************
//* 2 December 1998
//* Compiled using MPLAB C17 C Compiler V2.20
//****************************************************
//* This program displays a message on a LCD display
//* that uses the Hitachi HD44780 controller or
//* equivalent. The first line shows Hello... and
//* the second line shows World!.
//****************************************************
//* Uses an oscillator of 16MHz
//****************************************************
#include <p17c756.h>
#include <delays.h>
#include xlcd.h
// Constant string arrays in program memory
const rom char Hello[] = Hello...;
const rom char World[] = World!;
// Delays for ~18 Tcy
void DelayFor18TCY(void)
{
Delay10TCY();
Delay10TCY();
return;
}
// Delays for ~15ms
void DelayPORXLCD(void)
{
Delay1KTCYx(70);
return;
}
// Delays for ~5ms
void DelayXLCD(void)
{
Delay1KTCYx(20);
return;
}
void main(void)
{
// Turn A/D off
ADCON1 = 0x0e;
// Configure the external LCD
OpenXLCD(FOUR_BIT&LINES_5X7);