cho mình hỏi mình làm truyền nhận uart thì dc rùi lúc đó thì chưa có ngắt. Khi mình đưa ngắt vào thì ko chạy dc. Bạn nào biết sai ở đâu trong code mình chỉ giúp mình nhé. Cảm ơn nhiều nhiều.
#include "C:\Documents and Settings\trungchanh108\My Documents\chuong trinh viet cho pic\ngatuart\main.h"
#include <stdio.h>
#use delay(clock=12000000)
#int_RDA
void RDA_isr(void)
{
int8 k;
k=getc();
putc(k);
}
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
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);// This device COMP currently not supported by the PICWizard
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
delay_ms(100);
printf("chanh");
delay_ms(100);
while(true)
{
}
}
#include <stdio.h>
#use delay(clock=12000000)
#int_RDA
void RDA_isr(void)
{
int8 k;
k=getc();
putc(k);
}
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
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);// This device COMP currently not supported by the PICWizard
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
delay_ms(100);
printf("chanh");
delay_ms(100);
while(true)
{
}
}
Comment