Bạn thử sửa lại code trên đó thành như này xem sao
Code:
#include <16f877a.h>
#fuses HS, NOWDT
#use delay(clock=4000000)
#byte portb=0x06
#byte trisb=0x86
#byte INTCON=0x0b
#bit TMR0IF=INTCON.2
#byte TMR0=0x01
#use fast_IO (b)
int a,b=0;
int C[10]= {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90 };
#int_rtcc
void rtcc()
{
if(b++==250)
{
a++;
if(a==10) a=0;
}
}
void main ()
{
setup_timer_0 (RTCC_INTERNAL|RTCC_DIV_16);
set_timer0 (6);
enable_interrupts(int_rtcc);
enable_interrupts(global);
set_tris_b (0x00);
a=0;
while (true)
{
//for (a=0;a<=9;a++)
//{
//tre1s (250);
portb=C[a];
//tre1s (250);
}
}