#include <p18f4550.h>
#include <delays.h>
#include <string.h>
#include <stdlib.h>
#include <xlcd.h>
#pragma config FOSC = XT_XT
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config MCLRE = ON
#pragma config PBADEN = OFF
#pragma config LVP = OFF
#pragma config USBDIV = 1
#define CLEAR_DISPLAY 0b00000001 /* Clear Display */
void main( void )
{
int subsecond=0;
int second=0;
char string1[8];
char string2[2];
char dot[]=".";
int i;
init();
LCD_init();
while(1)
{
Delay10KTCYx(10); // Delay of 0.1sec
if (subsecond<9) {
subsecond+=1;
}
else {
second+=1;
subsecond=0;
}
WriteCmdXLCD(CLEAR_DISPLAY);
itoa(second,string1);
strcat(string1,dot);
itoa(subsecond,string2);
strcat(string1,string2);
putsXLCD(string1);
}
}