/* *************** LCDtest.C ****************************** LCD Display (HD44780) on PortH, PORTJ ground = pin 1 Vss power = pin 2 Vdd +5v 10Kpot = pin 3 Vlc contrast adjust 0 to +5v PJ2 = pin 6 E (enable) PJ1 = pin 5 R/W (1 for read, 0 for write) PJ0 = pin 4 RS (1 for data, 0 for control/status) PH0-7 = pins7-14 DB0-7 (8 bit data) if you don't have a pot, try grounding pin 3 */ // Last modified 1/3/03 by Jonathan W. Valvano // Copyright 2003 by Jonathan W. Valvano, valvano@uts.cc.utexas.edu // You may use, edit, run or distribute this file // as long as the above copyright notice remains #include "HC12.h" #include "LCD12.H" void TimerInit(void){ COPCTL = 0x00; // disable COP DDRT |= 0x40; // PortT bit 6 is output to LED TIOS |= 0x20; // enable OC5 TSCR =0x80; // TEN(enable) } void mswait(unsigned short time){ for(;time>0;time--){ TC5=TCNT+2000; // 1.00ms wait TFLG1 = 0x20; // clear C5F while((TFLG1&0x20)==0){}; } } void main(void){ TimerInit(); // disable COP, enable Port T LCD_Init(); LCD_OutString("Adapt812 "); LCD_OutString(" "); LCD_OutString(" LCD "); LCD_OutString(" "); mswait(2000); // 2 sec wait LCD_Clear(); while(1){ PORTT ^= 0x40; // toggle LED LCD_Clear(); LCD_OutString("ABCDEFGH "); LCD_OutString(" "); LCD_OutString("IJKLMNOP "); LCD_OutString(" "); mswait(1000); // 1 sec wait PORTT ^= 0x40; // toggle LED LCD_Clear(); LCD_OutString("01234567 "); LCD_OutString(" "); LCD_OutString("890,./<> "); LCD_OutString(" "); mswait(1000); // 1 sec wait PORTT ^= 0x40; // toggle LED LCD_Clear(); LCD_OutString("abcdefgh "); LCD_OutString(" "); LCD_OutString("ijklmnop "); LCD_OutString(" "); mswait(1000); // 1 sec wait PORTT ^= 0x40; // toggle LED LCD_Clear(); LCD_OutString("!@#$%^&* "); LCD_OutString(" "); LCD_OutString("()_+-=[] "); LCD_OutString(" "); mswait(1000); // 1 sec wait } } #include "LCD12.C" extern void _start(); #pragma abs_address:0xfffe void (*reset_vector[])() = { _start }; #pragma end_abs_address