/*
* PIC 16F886 HD44780 LCD Driver
* Author: solarwind
* Date: 2009-01-31
* Email: x.solarwind.x@gmail.com
* Compiler: Microchip C18 (v3.22)
*
* Pin Configuration:
* The LCD's data 4 - 7 pins should be connected to bits 4 - 7,
* respectively, of any port you wish to use on your PIC.
*
* The E, R/W and RS pins can be connected to any unused port at
* any pin.
*
* My configuration is as follows:
* LCD PIC
* 16 BK-
* 15 BK+
* 14 D7 -> RC7
* 13 D6 -> RC6
* 12 D5 -> RC5
* 11 D4 -> RC4
* 10 D3
* 9 D2
* 8 D1
* 7 D0
* 6 E -> RC0
* 5 R/W -> RC1
* 4 RS -> RC2
* 3 VO
* 2 VDD
* 1 VSS
*
* Note:
* This driver is designed to work with almost any PIC 18. Be sure to
* correctly initialize your PIC, correctly connect your LCD and
* define your connections below.
*
* Note:
* DDRAM Addresses are as follows on 16 x 4 displays:
*
* Line 1: 0x00 -> 0x0F
* Line 2: 0x40 -> 0x4F
* Line 3: 0x10 -> 0x1F
* Line 4: 0x50 -> 0x5F
*
*/
#ifndef LCD_H_
#define LCD_H_
#include "main.h"
//Define your LCD's data PORT here:
#define LCD_PORT PORTC
//Define your LCD's control pins here:
#define LCD_E PORTCbits.RC0 //Enable
#define LCD_RW PORTCbits.RC1 //Read/write
#define LCD_RS PORTCbits.RC2 //Register select
void strobe(void); //Strobes the enable pin of the LCD
void send_nibble(byte b); //Send high nibble of byte b to LCD
void send_byte(byte b); //Send entire byte b to LCD via 4 bit interface
void send_cmd(byte b); //Send command to LCD
void send_data(byte b); //Send data to LCD
void set_cursor(byte row, byte col); //Set cursor position at (row, col)
void cursor_on(void); //Turn on cursor
void cursor_off(void); //Turn off cursor
void cls(void); //Clear screen
void sc_r(void); //Scroll all lines one character right
void sc_l(void); //Scroll all lines one character left
void home(void); //Send cursor to top-left position
byte b2hc(byte data); //Convert lower nibble of byte data to an ascii character
void lcd_init(void); //Initialize LCD
#endif /*LCD_H_*/