- 1、本文档共14页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 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
您可能关注的文档
- 产10万吨酸奶设计说明收集资料.pdf
- 产后痹的中医治法.pdf
- 产后耻骨联合分离怎么护理.pdf
- 产后访视内容.pdf
- 产后康复科年终总结2篇.pdf
- 产后康复客户健康评估表.pdf
- 产后伤口处理.pdf
- 产后修复时期的注意事项(一).pdf
- 产后营养食谱(精华版).pdf
- 产品成本核算流程图.pdf
- 人教版二年级数学上册第七单元认识时间能力题和奥数题(附答案).pdf
- 人教版初中七年级上册道德与法治知识点思维导图.pdf
- 人教版七年级数学下册第九章不等式和不等式组达标练习.pdf
- 人教版小学五年级数学上册第五单元《简易方程》测试题附答案(共6套).pdf
- 人教PEP版英语三年级上册Unit 6教学反思.pdf
- 人教版生物七年级上册第一单元测试卷附答案.pdf
- 人教版九年级英语全册教案:Unit 11 教案.pdf
- 人教版四年级上册数学期中测试卷及参考答案【完整版】.pdf
- 人教版小学数学二年级数学上册第一单元《长度单位》单元测试卷(包含答案解析)(1).pdf
- 人教版新目标英语七年级下册Unit 8 Is there a post office near he.pdf
文档评论(0)