Here a code for hi-tech compiler..................
just connect the pins from ports to bcd to 7-seg display njoy
#include<htc.h>
__CONFIG(HS & BORDIS & PWRTEN & WDTDIS & LVPDIS);
__EEPROM_DATA(0,1,2,3,4,5,6,7);
__EEPROM_DATA(8,9,0,0,0,0,0,0);
int min_t, min_o, sec_t, sec_o, hr_t, hr_o;
void delay_Nms(int n )
{
while(n>0)
{
TMR1H=0xEC; // EC77H=60535d
TMR1L=0x77;
T1CKPS1=0;
T1CKPS0=0;
TMR1CS=0;
TMR1IF=0;
TMR1ON=1;
while(!TMR1IF) { }
TMR1IF=0;
n--;
}
}
void main()
{
TRISB=0x00;
PORTB=0x00;
TRISD=0x00;
PORTD=0x00;
TRISC=0x00;
PORTC=0x00;
while(1)
{
for(hr_t=0;hr_t<=1;hr_t++)
{
PORTB=eeprom_read(hr_t)<<4;
for(hr_o=0;hr_o<=2;hr_o++)
{
PORTB=eeprom_read(hr_t)<<4 | eeprom_read(hr_o);
for(min_t=0;min_t<=5;min_t++)
{
PORTC=eeprom_read(min_t)<<4 | eeprom_read(min_t);
for(min_o=0;min_o<=9;min_o++)
{
PORTC=eeprom_read(min_t)<<4|eeprom_read(min_o);
for(sec_t=0;sec_t<=5;sec_t++)
{
PORTD=eeprom_read(sec_t)<<4 | eeprom_read(sec_o);
for(sec_o=0;sec_o<=9;sec_o++)
{
PORTD=eeprom_read(sec_t)<<4|eeprom_read(sec_o);
delay_Nms(1000);
}
}
}
}
}
}
}
}