2001 Microchip Technology Inc.
DS39024B-page 39
LCD.C
Description
5.6
XLCD.H
Source Code Listing
#pragma nolist
/*****************************************************************
* PICmicro C Libraries V2.10
* Written and Tested using MPLABC V2.10
******************************************************************
* Filename:
xlcd.h
* Date:
14 April 1998
* File Version:
2.10
******************************************************************
* Functions:
*
Header file
******************************************************************
* Revision History:
* V1.00 - Beta release of Peripheral Libraries for V1.21
* V2.00 - Release of Peripheral Libraries for V2.00
* V2.10 - Release of Peripheral Libraries for V2.10
* Added putrsXLCD to output strings in ROM to XLCD
******************************************************************
* Notes:
* - ROM usage varies depending on specified device
* - These libraries routines are written to support the
* Hitachi HD44780 LCD controller.
* - The user must define the following items:
*
- The LCD interface type (4- or 8-bits)
*
- If 4-bit mode
*
- whether using the upper or lower nibble
*
- The data port
*
- The tris register for data port
*
- The control signal ports and pins
*
- The control signal port tris and pins
*
- The user must provide three delay routines:
*
- DelayFor18TCY() provides a 18 Tcy delay
*
- DelayPORXLCD() provides at least 15ms delay
*
- DelayXLCD() provides at least 5ms delay
*****************************************************************/
#ifndef __XLCD_H
#define __XLCD_H
// Interface type 8-bit or 4-bit
// For 4-bit operation comment out the #define BIT8
//#define BIT8
// When in 4-bit interface define if the data is in the upper
// or lower nibble. For lower nibble, comment out the #define UPPER
//#define UPPER
// DATA_PORT defines the port on which the LCD
// data lines are connected to
#define DATA_PORT PORTF
#define TRIS_DATA_PORT DDRF
// CTRL_PORT defines the port where the control
// lines are connected
// These are just samples, change to match your application
#define RW_PIN PORTGbits.RG0
// Port for RW
#define TRIS_RW DDRGbits.RG0
// TRIS for RW