|
本例程可以實現(xiàn)用stc的51單片機來控制進行紅外線的發(fā)射,
完整keil工程文件下載:
http://www.torrancerestoration.com/bbs/dpj-55490-1.html
下面是部分程序代碼的預覽:
主程序:
- #include "IR_SendCode.h"
- #include "IR_SendDisp.h"
- #include "IR_Receive.h"
- #include "ChannelShortcutDef.h"
- #include "Nokia5110.h"
- #include "delay.h"
- ChannelKey_TypeDef Channel_ShortKey;//定義通道&快捷鍵結(jié)構(gòu)體
- uint8_t IRSendOrRemote_Flag = Function_IRsend;//定義需要實現(xiàn)的是紅外發(fā)射還是紅外接收
- void main(void)
- {
- IRsend_Init();
- IRreceiver_Init();
- Nokia5110_Init();
- ReadE2P_ChannelShortKey();//讀取設置的通道和快捷鍵
- Nokia5110_DispChannelKey();//顯示設置的通道和快捷鍵
-
- while(1)
- {
- Funtion_KeyScan();
- if(IRSendOrRemote_Flag == Function_IRsend) //紅外發(fā)送功能實現(xiàn)
- {
- Set_ChannelShortKey();
- ShortKeyScan_IRSendCode();
- }
- if(IRSendOrRemote_Flag == Function_IRremote)//紅外接收功能實現(xiàn)
- {
- IRcode_Disp();
- }
- }
- }
復制代碼
STC89Cx_it.c
|
|