Em lập trình ccs v4.068 cho dspic30f2010
Code:
#include <30f2010.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES ICS0
#FUSES NOCOE
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPUT //No Power Up Timer
#FUSES HS
#FUSES NOWRT //Program memory not write protected
#FUSES NOPROTECT //Code not protected from reading
#use delay(clock=12000000)
void main()
{
output_high(pin_E0);
delay_ms(500);
output_high(pin_E1);
output_low(pin_E0);
delay_ms(500);
output_high(pin_E2);
output_low(pin_E1);
delay_ms(500);
output_high(pin_E3);
output_low(pin_E2);
delay_ms(500);
output_high(pin_E4);
output_low(pin_E3);
delay_ms(500);
output_high(pin_E5);
output_low(pin_E4);
delay_ms(500);
while(1);
}
Lẽ ra nó phải chạy là: sáng RE0; sau đó sáng RE1(tắt RE0) ;.....sáng RE5( tắt RE4) rồi dừng.
Nhưng khi chạy thử thì nó chỉ sáng tới RE2 sau đó nó lại lặp lại từ RE0.
Em làm vài thí nghiệm khác thì thấy có vẻ như con pic bị reset sau 1 thời gian( khoảng hơn 1s). Các bác giúp em với hix!!!
Cám ơn các bác!