Wednesday 3 June 2015

counter--pic

#include<htc.h>
#include"lcdsub.c"
int hr=0,min=0,sec=0;
void main()
{
TRISD=0x00;
TRISC=0x00;
int cnt=0;
lcdint();
lcdstr("...  TIMER  ....");
delay(6500);
while(1)
{

cnt=1;

 if(cnt==1)
{
 sec++;
 cnt=0;
}

if(sec==60)
{
sec=0;
min++;
}

if(min==60)
{
min=0;
hr++;
}

if(hr==12)
{
hr=0;
}
lcddisp2(hr,min,sec);
 delay(25500);
}
}

No comments:

Post a Comment