STM32单片机学习(12) 红外信号接收解码(外部中断)
时间:11-20
来源:互联网
点击:
LED//else GPIO_ResetBits(GPIOA,GPIO_Pin_0);//灭while(1){if(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_8)==1){time = HW_ReceiveTime();if(time>=250){//printf("VoverTime:%x\n",time); startSignal=0;HW_ReceivedData=0;Count=0;break;} else if(time>=200 && time<250){startSignal=1;//收到起始信号HW_ReceivedData=0;Count=0;continue;} else if(time>=60 && time<90) Data=1;//收到数据 1else if(time>=10 && time<50) Data=0;//收到数据 0//printf("%x ",Data);if(startSignal==1){HW_ReceivedData<=1;HW_ReceivedData+=Data;Count++;if(Count>=32){//printf("received:%x\n",HW_ReceivedData);if(HW_ReceivedData==0x1090000a) printf("红外编码:0x%8X,指令:打开空调\n",HW_ReceivedData);else if(HW_ReceivedData==0x90000a) printf("红外编码:0x%08X,指令:关闭空调\n",HW_ReceivedData);else printf("红外编码:0x%08X,指令:未知\n",HW_ReceivedData);HW_ReceivedData=0;Count=0;startSignal=0;break;} } }}EXTI_ClearITPendingBit(EXTI_Line8);//清除线路挂起位EXTI_ClearFlag(EXTI_Line8);//清除中断挂起位 } }
STM32红外信号接收解码外部中 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)