#include #include "lcd.h" #include "kernel.h" void lcd_format (unsigned char c) { OUTA &= ~RS; //RS = 0; OUTA &= ~RW; //RW = 0; OUTA &= ~EN; //EN = 0; //LCD = c; OUTA &= 0xFF00FFFF; OUTA |= (c << 16); msleep(1); OUTA |= EN; //EN = 1; OUTA &= ~EN; //EN = 0; OUTA |= RW; //RW = 1; } void lcd_putchar (unsigned char c) { OUTA |= RS; //RS = 1; OUTA &= ~RW; //RW = 0; OUTA &= ~EN; //EN = 0; //LCD = c; OUTA &= 0xFF00FFFF; OUTA |= (c << 16); msleep(1); OUTA |= EN; //EN = 1; OUTA &= ~EN; //EN = 0; OUTA |= RW; //RW = 1; } void lcd_init (void) { DIRA |= (0x7FF << 13); // set P13 ... P23 to Output lcd_format(CLEAR_DISPLAY); msleep(5); lcd_format(0b00000110); lcd_format(0b00001100); lcd_format(0b00010100); lcd_format(0b00111100); } void lcd_puts(const char * string) { char * sptr = string; lcd_format(CURSOR_HOME); while(*sptr) { lcd_putchar((unsigned char) *sptr); sptr++; } }