#include "Delay.h" #include "OLED.h" #include "IRDecod.h" #include <stdio.h> uint8 Recdata[30]="红外解码测试\r\n"; //串口输出字符串 uint16 stringlen; //字符串长度 extern uint16 HWAddcode,HWComcode; //红外解码 地址码 指令码全局调用 IRDecod.c void main(void) { unsigned char str[40]; uint8 j = 0; IRInit(); //红外接收初始化 oled_port_init(); initial_lcd(); clear_screen(); //清屏 display_string_8x16_16x16(1,1,"武汉唯众智创科技"); display_string_8x16_16x16(3,1,"有限公司荣耀创造"); Delay_ms(100); clear_screen(); while(1) { if(IR_IRQ==0) //如果红外接收头有信号 { j = IR_Decoding(); //开始解码 if(j==0) { sprintf((char *)str, "A:%04X C:%04X", HWAddcode,HWComcode); clear_screen(); display_string_8x16_16x16(1,1,str); display_string_8x16_16x16(3,1,"N:"); switch(HWComcode) //判断指令 { case 0x1234: display_string_8x16_16x16(3,16,"CH- "); break; case 0xBA45: display_string_8x16_16x16(3,16,"CH- "); break; case 0xB946: display_string_8x16_16x16(3,16,"CH "); break; case 0xB847: display_string_8x16_16x16(3,16,"CH+ "); break; case 0xBB44: display_string_8x16_16x16(3,16,"PREV "); break; case 0xBF40: display_string_8x16_16x16(3,16,"NEXT "); break; case 0xBC43: display_string_8x16_16x16(3,16,"PLAY "); break; case 0xF807: display_string_8x16_16x16(3,16,"VOL- "); break; case 0xEA15: display_string_8x16_16x16(3,16,"VOL+ "); break; case 0xF609: display_string_8x16_16x16(3,16,"EQ "); break; case 0xE916: display_string_8x16_16x16(3,16,"0 "); break; case 0xE619: display_string_8x16_16x16(3,16,"100+ "); break; case 0xF20D: display_string_8x16_16x16(3,16,"200+ "); break; case 0xF30C: display_string_8x16_16x16(3,16,"1 "); break; case 0xE718: display_string_8x16_16x16(3,16,"2 "); break; case 0xA15E: display_string_8x16_16x16(3,16,"3 "); break; case 0xF708: display_string_8x16_16x16(3,16,"4 "); break; case 0xE31C: display_string_8x16_16x16(3,16,"5 "); break; case 0xA55A: display_string_8x16_16x16(3,16,"6 "); break; case 0xBD42: display_string_8x16_16x16(3,16,"7 "); break; case 0xAD52: display_string_8x16_16x16(3,16,"8 "); break; case 0xB54A: display_string_8x16_16x16(3,16,"9 "); break; default: display_string_8x16_16x16(3,16,"CodError"); break; } } } } } |