// Global Variables const unsigned char MSG0[20] = "LCD_Demo2.C "; // Subroutine Declarations #include // Subroutines #include "lcd_portd.c" // Main Routine void main(void) { unsigned long int X; unsigned int i, j; unsigned int DIR; unsigned int TIME; TRISA = 0; TRISB = 0; TRISC = 0; TRISD = 0; TRISE = 0; ADCON1 = 0x0F; LCD_Init(); // initialize the LCD LCD_Move(0,0); for (i=0; i<20; i++) LCD_Write(MSG0[i]); X = 1; DIR = 1; TIME = 0; while(1) { X = 1; for(i=0; i<23; i++) { PORTC = X; PORTB = X >> 8; PORTA = X >> 16; PORTE = X >> 21; Wait_ms(22); X = X << 1; } for(i=0; i<23; i++) { PORTC = X; PORTB = X >> 8; PORTA = X >> 16; PORTE = X >> 21; Wait_ms(22); X = X >> 1; } TIME = TIME + 1; LCD_Move(1,0); LCD_Out(TIME,2, 0); } }