The invention discloses a method for using the serial port to receive infrared remote control signal to complete the software method of remote signal pulse decoding, to reduce the occupation of the system additional external interrupt resources, software decoding mainly lies in: the infrared remote control receiver OUT pin and RXD pin serial connected computing; serial baud rate according to the pulse width of the current use of the remote control, and set the including the serial baud rate, serial port property; get to meet the serial data of the current use of remote preamble and user identification code, and save the serial data and the corresponding serial port status register value; according to the remote control button and save the serial data and serial port status register value corresponding to the relationship between the remote button mapping table, the serial data conversion for the remote control key value. The method of the invention does not occupy the additional external interrupt resources of the system, and can also reduce the error probability when other interrupt burdens are heavy.
【技术实现步骤摘要】
本专利技术涉及红外遥控技术,具体地说,是涉及用串口接收红外遥控信号 的方法。
技术介绍
红外遥控技术目前已较为成熟,具有使用方便、功耗低、抗干扰能力强 和成本低等优点,在家电中得到了广泛的应用,也在智能仪器系统中受到重 视。 一般的红外遥控系统是由红外遥控信号发射器、红外遥控信号接收器和微控制器及其外围电路等3部分构成的。由遥控编码器产生遥控编码脉沖,驱动红外发射管输出红外遥控信号,遥控接收头完成对遥控信号的^L大、检 波、整形,解调出遥控编码脉冲。遥控编码脉沖不能直接被程序识别,还需 要对编码脉冲进行解码,获得包含用户信息的二进制码。从遥控编码脉冲解出包含用户信息的二进制码可以用两种方法, 一种是用专用的解码芯片,完全交给硬件处理;还有一种是用软件按照遥控编码脉 冲的格式进行解码。采用硬件解码来说,对系统的负担小,而且出错概率小, 但是成本比较高;用软件解码成本低,但是增加了系统负担,常规软件解码 占用了系统外部中断资源和内部定时器资源,特别是在系统其它中断任务重 的时候出错概率较大。因此,需要提供一种新的红外遥控信号接收方法,来解决现有技术中的 上述矛盾。
技术实现思路
本专利技术所要解决的技术问题是在于需要提供一种使用串口接收红外遥 控信号来完成软件解码遥控信号脉冲的方法,避免了现有技术软件解码占用系统额外的外部中断资源。为了解决上述技术问题,本专利技术提供了一种用串口接收红外遥控信号的 方法,包括步骤(1 )将红外遥控接收器OUT引脚与所述串口的RXD引脚相连,并将 所述红外遥控接收器与所述串口均接地;(2) 根据当前使用遥控器的脉冲宽度计算串口波特 ...
【技术保护点】
一种用串口接收红外遥控信号的方法,其特征在于,包括步骤:(1)将红外遥控接收器OUT引脚与所述串口的RXD引脚相连,并将所述红外遥控接收器与所述串口均接地;(2)根据当前使用遥控器的脉冲宽度计算串口波特率,并设置包括所述串口 波特率在内的串口属性;(3)获取符合当前使用遥控器前导码和用户识别码的串口数据,并保存所述串口数据及相应的串口状态寄存器的值;(4)根据保存遥控器按键与串口数据和串口状态寄存器的值对应关系的遥控器按键映射表,将步骤(3)中的 串口数据转换为遥控按键值。
【技术特征摘要】
【专利技术属性】
技术研发人员:李华,于京涛,朱晓斌,丁元欣,苗军,谭笑,
申请(专利权)人:中兴通讯股份有限公司,
类型:发明
国别省市:94[中国|深圳]
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。