Here is a program written in c for the digital clock
program:
void main()
{
int a,b,c;
c=b=0;
a=1;
TRISC = 0;
TRISA = 0;
TRISB = 128;
while(1)
{
if((b & 128)==128 )
{
while(1)
{
TRISA = 31;
TRISB = 255;
TRISC = 255;
a=PORTA;
b=PORTB;
c=PORTC;
if ((b & 128)==128)
continue;
else
{
break;
}
}
}
PORTA = a;
PORTB = b;
PORTC = c;
c++;
if((c & 10) == 10 )
{
c=c+6;
}
if(c==96)
{
c=0;
b++;
if(b & 10 == 10)
{
b=b+6;
}
if((b==96)||(b==224))
{
b=0;
a++;
if(a & 10 == 10)
{
a=a+6;
}
if (a == 19)
{
a=1;
if(b & 128 ==128)
b=0;
else
b=128;
c=0;
}
}
}
Delay_ms(1000);
}
}
use microc compiler if necessary