Conversation Between namqn and kyo
Showing Visitor Messages 1 to 1 of 1
-
Nhờ anh xem chương trình này em viết tại sao ko chạy được. Em sử dụng timer0 để tạo thời gian delay bật tắt các led gắn vào portb của pic 16f877a, nhưng ko hiểu sao ko chạy được.
Chương trình như sau:
#include <16f877a.h>
#fuses nowdt,noprotect,put,xt
#use delay(clock=4000000)
#use fast_io(b)
#byte portb=0x06
#int_timer0
void ngat_tm0(void)
{
portb=0xff;
}
void main()
{
set_tris_b(0);
enable_interrupts(global);
enable_interrupts(int_timer0);
set_timer0(250);
setup_timer_0(rtcc_internal|rtcc_div_8);
while(1)
{
portb=0x00;
}
}