#ifndef LCD_H
#define LCD_H

#include <pic.h>

/**	Constants	**/
#define FREQUENCY  20	/* Crystal frequency in MHz*/

/**	Pin Configuration	**/

#define PORTD_DIRECTION	0x00	// LCD data pins
#define PORTE_DIRECTION	0x00	// LCD control pins
#define LCD_DATA		PORTD	
#define LCD_RS			RE0
#define LCD_E			RE1
#define LCD_RW			RE2		// 0 for writing to LCD

#define	NUM_LCD_DIGITS	20	//number of digits on the LCD

//constants for write_char_to_lcd
#define START_LINE_1		0x80	//set cursor at line 1
#define START_LINE_2		0xC0	//set cursor at line 2
#define CLEAR_DISPLAY		0x01	//clear display, return cursor to home


/**	function prototypes	**/
/**
  *	Initilize the LCD
  */
void LCD_init();

/**
  *	Delay loop for 14.80us at 20 Mhz used for LCD initilzation
  */
void wait_15us();

/**
  * Writes a character to the LCD
  * @param register_select 
  *		(0 for command, 1 for data)
  * @param data
  *		The character to be written to the LCD
  */
void write_char_to_LCD(char register_select, char data);

/**
  *	Writes a string to the LCD
  * @param str
  *		A null-terminated string to be written to the LCD
  */
void write_string_to_LCD(const char *);
#endif