Cho e hỏi chút về đoạn code cho 16F877A
e mới học PIC nhưng mà đã mấy ngay nay e vẫn chưa hiểu vì sao đoạn code của mình lại ko chạy được!:|!Mong các tiền bối giúp e vs ạ!
#include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bi ts=8)
char a,i;
#int_RTCC
void RTCC_isr(void)
{
}
#int_EXT
void EXT_isr(void)
{
}
#int_TBE
void TBE_isr(void)
{
}
#int_RDA
void RDA_isr(void)
{
}
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(INT_EXT);
enable_interrupts(INT_TBE);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
set_timer0(55);
set_tris_d(0x00);
set_tris_b(0x00);
a=0;
while(1)
{
for(i=0;i++;i<50)
{
a++;
if(a==49)
{
output_d(0x00);
a=0;
}
}
}
// TODO: USER CODE!!
}
|