本帖最后由 sweet_136 于 2012-8-4 15:03 编辑
360桌面截图20120804150228.jpg (57.43 KB, 下载次数: 0)
下载附件
2012-8-4 15:02 上传
现在出现了这个警告.不知道是哪里问题.
//AD 端口设置
setup_adc_ports(AN0_TO_AN8|VSS_VREF); //AN0-AN8为AD输入端口,VREF为参考端
setup_adc(ADC_CLOCK_INTERNAL);
enable_interrupts(INT_RDA); //使能串口接收中断
enable_interrupts(GLOBAL); //使能串口接收中断
上面是主函数,
下面是中断.
为什么不能进入到中断里面去呢? 好纠结...搞了好几天了就一直是这个问题.或者.数据有时候不对.
#int_RDA
void RDA_isr()
{
receivedata=getc();//得到数据
switch(receivedata)
{
case 10:
LED[0].key_status = OFF;
printf("LED[0].key_status = OFF
");
receivedata = 0;
break;
case 11:
LED[0].key_status = ON;
printf("LED[0].key_status = ON
");
receivedata = 0;
break;
case 20:
LED[1].key_status = OFF;
printf("LED[1].key_status = OFF
");
receivedata = 0;
break;
case 21:
LED[1].key_status = ON;
printf("LED[1].key_status = ON
");
receivedata = 0;
break;
case 30:
LED[2].key_status = OFF;
printf("LED[2].key_status = OFF
");
receivedata = 0;
break;
case 31:
LED[2].key_status = ON;
printf("LED[2].key_status = ON
");
receivedata = 0;
break;
case 40:
LED[3].key_status = OFF;
printf("LED[3].key_status = OFF
");
receivedata = 0;
break;
case 41:
LED[3].key_status = ON;
printf("LED[3].key_status = ON
");
receivedata = 0;
break;
case 0xFA:
LED[0].error_flag = ON;
printf("LED[0].error_flag = ON
");
receivedata = 0;
break;
case 0xFB:
LED[1].error_flag = ON;
printf("LED[1].error_flag = ON
");
receivedata = 0;
break;
case 0xFC:
LED[2].error_flag = ON;
printf("LED[2].error_flag = ON
");
receivedata = 0;
break;
case 0xFD:
LED[3].error_flag = ON;
printf("LED[3].error_flag = ON
");
receivedata = 0;
break;
}
}
非常谢谢你的回复.我试过了.就算我只在中断里面用一条 receivedata = getc(); 第二次中断都不会进来.
一周热门 更多>