⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 红外代码
💻 C
字号:
#include <regx52.h>
#include <stdio.h>
#include "ir.h"
#include "1602.h"

extern bit irok;
extern unsigned char ircode[4];

char tab[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b','c','d', 'e', 'f'};

void main()
{
	 char buf[16] = "code:";
	 ir_init();
	 lcd_init();
	 lcd_setpos(0, 1);
	 lcd_printf("code:");
	 while(1)
	 {
	 	if(irok == 1)
		{
			irok = 0;
			ir_pro();
			buf[5] = tab[ircode[0]/16];
			buf[6] = tab[ircode[0]%16];
			buf[7] = ' ';
			buf[8] = tab[ircode[1]/16];
			buf[9] = tab[ircode[1]%16];
			buf[10] = ' ';
			buf[11] = tab[ircode[2]/16];
			buf[12] = tab[ircode[2]%16];
			buf[13] = ' ';
			buf[14] = tab[ircode[3]/16];
			buf[15] = tab[ircode[3]%16];

//			sprintf(buf, "code:%02x-%02x", 255, 128);
//			sprintf(buf, "code:%x %x %x %x", 255, 128, ircode[2], ircode[3]);
			lcd_setpos(0, 1);
			lcd_printf(buf);
		}
	 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -