/***********************************************************
Part of old code
***********************************************************/
//for example DD0=0x7D display="6",DD1=0x4F display="3"
PORTB = DD0;//DD0=0x7D
RA0_bit = 0;// Select Ones Digit, display X X X 6
RA1_bit = 1;//display X X X 6
RA2_bit = 1;//display X X X 6
RA3_bit = 1;//display X X X 6
delay_ms(5);//hold
PORTB = DD1;//DD1=0x4F,becasue RA0_bit=0,[COLOR="#FF0000"]display X X X 3,this is the wrong results![/COLOR]
RA0_bit = 1;//display X X X X
RA1_bit = 0;//Select Tens Digit,display X X 3 X
RA2_bit = 1;
RA3_bit = 1;
delay_ms(5);
PORTB = DD2;
RA0_bit = 1;
RA1_bit = 1;
RA2_bit = 0;// Select Hundreds Digit
RA3_bit = 1;
delay_ms(5);
PORTB = DD3;
RA0_bit = 1;
RA1_bit = 1;
RA2_bit = 1;
RA3_bit = 0;// Select Thousands Digit
delay_ms(5);
/***********************************************************
Part of new code
***********************************************************/
//for example DD0=0x7D display="6",DD1=0x4F display="3"
RA3_bit = 1;//disable RA3,display X X X X
PORTB = DD0;//DD0=0x7D
RA0_bit = 0;// Select Ones Digit,display X X X 6
RA1_bit = 1;//display X X X 6
RA2_bit = 1;//display X X X 6
delay_ms(5);//hold
RA0_bit = 1;//disable RA0,display X X X X
PORTB = DD1;//DD1=0X4F
RA1_bit = 0;// Select Tens Digit,display X X 3 X
RA2_bit = 1;
RA3_bit = 1;
delay_ms(5);
RA1_bit = 1;//disable RA1
PORTB = DD2;
RA0_bit = 1;
RA2_bit = 0;// Select Hundreds Digit
RA3_bit = 1;
delay_ms(5);
RA2_bit = 1;//disable RA2
PORTB = DD3;
RA0_bit = 1;
RA1_bit = 1;
RA3_bit = 0;// Select Thousands Digit
delay_ms(5);