串口通信发送红外遥控器解码值.pdf

  1. 1、本文档共14页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
串口通信发送红外遥控器解码值 本程序所用的原理图下载 : 点这里 ,单片机芯片使 用的 stc89c52 ;找到数码管的原理图即可 . 这是一整个 单片机开发板的电路图其他的忽略 . /** ************************************************* ********************************************** * @file main.c * @author xr * @date 2014 年 3 月 31 日 10:26:47 * @version V1.2.3 * @brief 红外通信 NEC 协议进行红外遥控器解码 显示用户 码和键码到数码管上 * @note 单片机 STC89C52RC MCU晶振 11.0592MHZ ************************************************* ********************************************** */ #include ; // 红外输出数据口 sbit IRD = P3^3;// 外部中断引脚 bit irflag = 0; unsigned char ircode[4];// 接收解码得到的数据 unsigned char code LedTable[] = { 0xC0, //quot;0quot; 0xF9, //quot;1quot; 0xA4, //quot;2quot; 0xB0, //quot;3quot; 0x99, //quot;4quot; 0x92, //quot;5quot; 0x82, //quot;6quot; 0xF8, //quot;7quot; 0x80, //quot;8quot; 0x90, //quot;9quot; 0x88, //quot;Aquot; 0x83, //quot;Bquot; 0xC6, //quot;Cquot; 0xA1, //quot;Dquot; 0x86, //quot;Equot; 0x8E //quot;Fquot; }; unsigned char LedBuff[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};// 数码管显示缓冲区 unsigned char thr0, tlr0; void ConfigTimer0(unsigned int xms); void ConfigTimer1(); void main() { ConfigTimer0(1); // 定时 1ms ConfigTimer1(); while (1) { if (irflag)// 接收到红外数据,则刷新显示 { LedBuff[5] = LedTable[ircode[0] ;; 4];// 取用户码 的高 4 位字节 LedBuff[4] = LedTable[ircode[0] 0x0F];// 取用户码 的低四位字节 LedBuff[1] = LedTable[ircode[2] ;; 4];// 取键码的 高四位 LedBuff[0] = LedTable[ircode[2] 0x0F];// 取键码的 低四位 } } } /** * @brief 定时器 T0 配置 * @param 定时时间 xms * @retval 无 */ void ConfigTimer0(unsigned int xms) { unsigned

文档评论(0)

hao187 + 关注
官方认证
内容提供者

该用户很懒,什么也没介绍

认证主体武汉豪锦宏商务信息咨询服务有限公司
IP属地上海
统一社会信用代码/组织机构代码
91420100MA4F3KHG8Q

1亿VIP精品文档

相关文档