I was not suggesting there was a problem with your code. Just trying to help Jimmy understand what needs to happen. But given that you have written the code for him I will step back and shut up.
#include <pic.h>
int tmp;
char i[4]={1,2,3,4};
const char map[10]={
0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x67};
void main(void)
{
OPTION=0b01000110; //prescaler 128
TRISB=0b00000000;
TRISD=0b00000000; //port D output
TRISC=0x00;
RC0=0;
T0IE = 1; // Enable interrupt on TMR0 overflow
tmp=1;
GIE = 1; // Global interrupt enable
while(1){ //loop forever
CLRWDT(); // Idly kick the dog
}
}
static void interrupt
isr(void) // Here be interrupt function - the name is unimportant.
{
if(T0IF==1)
{
PORTB&=0xf0; //turn off all segments
T0IF=0; //clear interrupt
if(tmp==1) //first digit
{
PORTD=map[i[0]];//put segment pattern on port D
PORTB=0x00;
RB0=1; //and turn on display 1
}
else if(tmp==2)
{
PORTD=map[i[1]];
PORTB=0x00;
RB1=1;
}
else if(tmp==3)
{
PORTD=map[i[2]];
PORTB=0x00;
RB2=1;
}
else if(tmp==4)
{
PORTD=map[i[3]];
PORTB=0x00;
RB3=1;
}
tmp++; //change to next digit
if(tmp==5) //done last digit
PORTB=0x00;
tmp=1; //yes so start again
}
}
now it is working......