Cái trên dùng HT PIC mà bạn? Cú pháp như thế không sai đâu. Vấn đề là sao mô phỏng chưa chạy nữa.
Tiện thể, chương trình viết theo CCS như thế này thì chạy OK rồi:
Code:
#include <16F877A.h>
#fuses NOWDT,PUT,XT,NOPROTECT
#byte PORTD = 0x08
#bit RD0=PORTD.0
unsigned char count;
#int_timer0
void interrupt_timer0()
{
set_timer0(6);
++count;
if(count == 250)
{
count=0;
RD0^=1;
}
}
void main(void)
{
set_tris_d(0);
PORTD=0X00;
enable_interrupts(int_timer0);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16);
enable_interrupts(global);
set_timer0(6);
while(1);
}