Download EE 477 Final Report
Transcript
ECE 477 Final Report
Fall 2006
LCD.c
/*
LCD.c
Authors: Brad Sokola, Justin Lanning
This contains the definitions and interface necessary for working
with the LCD. It outputs characters and has a function for updating
the runtime of the device from the seconds to the days.
*/
#include "LCD.h"
/* internal variables, for up-time count */
char global_sec;
char global_ten_sec;
char global_min;
char global_ten_min;
char global_hr;
char global_ten_hr;
char global_day;
void LCD_init(void)
{
int i;
int b;
for(i=0;i<10;i++)
{
for(b=0;b<10000;b++);
}
/*Wait for the LCD to come up*/
/*clearing screen*/
_LATG12 = 0;
_LATG13 = 0;
_LATG14 = 0;
_LATD4 = 0;
_LATD5 = 0;
_LATD6 = 0;
_LATD7 = 0;
_LATD8 = 0;
_LATD9 = 0;
_LATD10 = 0;
_LATD11 = 0;
_TRISG12 = 0;
/*RW pin - Just leave this 0 the whole time*/
_TRISG14 = 0;
/*RS pin*/
_TRISG13 = 0;
/*EN pin*/
/*Write command to data port 0b00111000*/
LCD_cmd(0b00111000);
/*Sets to 8 bit operation
and 2Line 5x8 dot char font*/
/*Write command to data port (0b00001110);*/
LCD_cmd(0b00001100);
/*Turns on display and cursor off,
blinking off*/
/*Write command to data port (0b00000110);*/
LCD_cmd(0b00000110);
/*Sets cursor mode direction
and display shift*/
LCD_cmd(CLEAR_LCD);
for(i=0;i<15000;i++);
/*wait...*/
return;
F-35