基于STC单片机的红外遥控开关系统的设计.doc

上传人:文库蛋蛋多 文档编号:4143689 上传时间:2023-04-07 格式:DOC 页数:13 大小:96KB
返回 下载 相关 举报
基于STC单片机的红外遥控开关系统的设计.doc_第1页
第1页 / 共13页
基于STC单片机的红外遥控开关系统的设计.doc_第2页
第2页 / 共13页
基于STC单片机的红外遥控开关系统的设计.doc_第3页
第3页 / 共13页
基于STC单片机的红外遥控开关系统的设计.doc_第4页
第4页 / 共13页
基于STC单片机的红外遥控开关系统的设计.doc_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《基于STC单片机的红外遥控开关系统的设计.doc》由会员分享,可在线阅读,更多相关《基于STC单片机的红外遥控开关系统的设计.doc(13页珍藏版)》请在三一办公上搜索。

1、JSJ-1302计算机信息工程学院 2013 届毕业设计(论文)外文阅读与翻译毕业设计题目 基于STC单片机的红外遥控开关系统的设计 外文翻译题目 Decoding Infraed Remote Controls Using a PIC16C5X Microcontroller 专业 计算机信息科学与技术 班级 姓名 学号 指导教师 职称 评价参考是否按要求完成外文翻译,译文的准确性,译文的总体质量,翻译工作量(英文不少于15000个印刷符号);格式符合指导书要求。指导教师意见签名: 得分(10分制):日期: 评阅教师意见 签名: 得分(10分制):日期: 介绍:家用电子工业已经应用红外遥控器

2、控制电视机,录像机和有线电视很多年了。同样的技术最近开始应用于工业应用以替代小键盘。可以通过PIC16C5X译解大多数的红外信号。这份说明书是描述如何破解的。唯一用来译解IR信号的强制性硬件是红外接收仪。它的两种类型的用法在这里都有说明。两种模块类型都经常被用于家用电子工业。第一种类型响应的已调制的红外信号大概为40KHz。第二种响应未调制的红外脉冲并且有受限范围。每种类型的硬件成本都不高于2美元。此处描述了三种PIC16C5X应用程序,说明了如何用它们来创建一个算法使其能够破译任何遥控信号。每种PIC16C5X应用程序表示在映射出一个预先存在的红外格式的一个步骤。最终的应用程序是一个用来完全

3、实现的示例的红外信号解码和解调的一种Teknika电视遥控器。三个层次的红外线信号典型的红外信号遥控器有三层。用于这些层的名字没有被标准化。在这个应用程序中注意他们被称为“红外、调制和串行数据。红外层是种发射方式。红外线是一种因为波长太长以至于看不到的光。虽然你不能看到红外光束,但它是光的一种形式,所以如果你不能看到目标设备,你就不能用红外信号控制它。控制绕过拐角,通过不透明的材料、RF,通常使用超高频信号。虽然这个应用程序注没有进一步提到RF,这里介绍的许多东西都是可以用作一个射频传输介质。这个频率层爆出的红外信号通常是在频率调制32.75千赫和56.8千赫之间。这样做是为了减少环境光的影响

4、。虽然考虑到这一层,但还是可选的。如果不调整红外格式的输出,发送脉冲与未调整的红外线则相反。这样做是为了延长电池寿命和远程控制减少成本的遥控装置。串行数据层的信息包含一个命令。这是典型的编码在长度的红外脉冲或长度的差距红外脉冲。一个长缺口或突变被诠释为一个“1”,一个短间隙或突变被解释为“0”。硬件信息在示意图显示了一个工具,可以帮助解调红外接收器的代码。图示由PIC16C57连接到两种可用的红外接收器。一个接收器是为非调制信号,另一个用于调制信号。调制接收器都可以从夏普和Lite,零件编号和lt - 1060 GP1U521Y分别解调。这个非调制类型可以从质量技术QSE157QT零件号码。P

5、IC16C57的选择并不表示这些处理操作需要解码。典型的红外接收器的代码可以放入不到一半的可用PIC16C54 ROM空间中,并使用四个内存位置。选择一个PIC16C57是由于需要存储大量的信号长度为以后阅读方便。PIC16C57含有一个陶瓷谐振器时钟。它会给足够的频率准确度来确定脉冲和间隙长度。一个RC网络通常不会有足够的精度。PIC16C57含有一个按钮用于重置,和四个跳投是提供用于控制应用程序启动。这两个数字显示是多路复用,驱动时通过Q1和Q2实现。三个八进制开关最为输入来控制选项显示,哪些文件注册。整个电路得出其权力从9v,200米墙安装供应。U1调节9v降到5v的PIC16C57和相

6、关电路。软件开发援助描述这个应用程序使用四种不同的固件文件IRMAIN。ASM控制三个应用程序文件。第一个文件是衡量ASM红外部件,以及内存,并允许传播information。IR6121.ASM 将NEC6121红外格式代码转码到在LED显示屏显示。最后一个文件,TEC-NICKA. ASM 显示了最终的固件解码红外格式。固件上包括三个应用程序,其将帮助设计一个红外控制系统。IRMAIN. ASM读取跳转1、2和程序流重置。如果没有跳转至2将直接程序流来衡量ASM。如果跳转至2只会直接对IR6121.ASM产生程序流。跳转在这两个1和2将直接程序流向TEKNIKA.ASM跳转至3和4。这三个

7、应用程序是最基本的和最有用的。这个程序将存储红外突发和间隙长度到内存中,允许的测量ments播放,通过两个数字显示其差距。它允许OPTION控制寄存器也通过SW1。SW1的设置是直接读入OPTION寄存器的频值TMR0。如果在程序操作过程中SW1改变了,PIC16C57复位。“连字符”启动后将被显示在左边的数字空间,直到红外线输入,黑暗的图示表明准备接收红外线信号作为一个红外信号出现时,长度的爆发的红外和长度的差距破裂存储在连续文件位置,直到PIC16C57所有的内存文件都充满。如果一个跳线已经在1,程序扔掉的前32脉冲间隙长度,开始储存脉冲和间隙长度的第33脉冲长度。这允许很长的解码格式。当

8、所有四页的内存文件充满了脉冲和间隙长度,数量和小数点表现。小数点表明,单位是donereading。 这个数字是一个间隙或脉冲长度。SW2和SW3控制脉冲或显示间隙长度的时间序列。这些在SW3下的八进制是更有效的。编写一个算法来解码红外遥控器的说明1.设计一个系统,它使用一个红外遥控器,第一步是选择一个遥控器。拥有自己的设计或现成的,调制或未调制的是主要的技术决策。2.一旦遥控器已经被选择或设计,其调制频率,如果有的话,必须确定。这用于接收红外信号来控制选择什么样的硬件。3.下一步是确定的时间数据的基础上,也就是说,以脉冲和差距是短或长的PIC16C57时钟参数。选择开关SW1,以获得最佳的长

9、脉冲和差距计数TMR0。这个定义的作用是预选分频器。4.第四步,定义,在格式上定义了一个1 的格式和一个0格式。这可能是差距计数,脉冲计数,或两者的结合。5.第五步,确定制成的全长的命令。这使得确定按钮是否被按下,或者如果与前面相同类型的一个新的命令被发出。6.第六步需要编写代码。代码将解决差距和脉冲长度和命令的长度成比特和字节。每个按钮在远程将解码一个独特的连续位。7.第七步,也是最后一步将这些收到的代码,将它们转换成数字或命令按钮,使用一个查找表。步骤1:选择一个远程控制取决于您的应用程序,您可能会选择选择一个遥控器,拥有自己的设计或现成的。通常他们在他们的小4比特微控制器上设定为一个串行

10、格式。一些公司如通用仪器COM命令,其他如NEC出售主要成分,可以定制由外部二极管到不会干扰其他应用程序。也可以计划一个PIC16C57来生成一个信号,可以发送给一个红外LED传输。另一种方法是使用一个可编程的远程控制来生成任意数量的红外格式,并使用它们对现成的目标设备进行控制。步骤2:确定调制频率对于这一点,下一个步骤的MEASURE.ASM程序将使用。展开,取出,使用非调制的接收器和PIC16C57运行MEASURE.ASM应用程序的。选择1选项selector.Press一个按钮,直到小数点结束。通过记忆的脉冲持续时间使用的跳线开关PIC16C57将存储在内存中。如果所有的输出(第一个除

11、外)均低于40小时,红外的格式是一个调制的。如果一半或更多的值显示为0FFh的,则是远程非调制。步骤3:确定时基如果遥控器的调制、解调红外接收器切换到的选项的选择仍处于1,再次按下遥控器上的一个按钮,直到小数点来。该系列记忆的脉冲持续时间,现在可能会包括FFH值很多。如果是这样,移动选项的选择,直到值7H1FH范围。期权选择的最佳选项除数,TMR0寄存器值。要优化覆盖范围和可靠性,几个解调接收器,可尝试。这些都可以从夏普或精简版上。目前所使用的调制频率是32.75千赫,35.0千赫,36.0千赫,36.7kHz电源,38千赫,39千赫,40千赫,41.7千赫,48千赫,56.8千赫。最常见的是

12、一轮40千赫。会给你的遥控器的最佳匹配最长范围和最一致的结果。步骤4:解码1和0下一个步骤是绘制出的特征的脉冲代表1和0的间隙长度。按相同的遥控器上的按钮,写下一系列数字阅读由PIC16C57运行措施,ASM程序。每个奇数编号的条目是一个来自遥控器的红外突发的持续时间。每个偶数编号的输入项的红外脉冲串之间的间隙的持续时间。这些差距和阵阵的长度定义的和为零。它们的顺序将取决于哪个按钮被按下。一旦特征长度已经发现了一个和一个零,然后创建一个算法,用一个计数器来翻译成“和”0“的长度。步骤5:找到命令的长度再次按同样的按钮。命令持续时间也可以找到。这是必要的,以确定一个按钮被压低或一个新的相同类型的

13、命令已经发出了。大多数遥控器重复命令时,只要按住按钮,重复分离一段时间,通常在一个甚至数0 ffh过渡。如果没有长甚至容易的计数可以发现, 认为某些COM命令可以长于64转换。延迟计数的选项是这个原因。插入跳线1和小节。 ASM将开始储存后的第32届过渡的过渡时间。步骤6:翻译长度成碎片一旦特征长度的1和0中被发现并已被发现的典型的命令的长度,一个程序可以被写入解码这些长度“和”0“,并将其显示两位数字的显示。也可以创建一个HOLD标志,这将是真实的,只要按钮被按住。一般1/8秒之间的命令,指示一个新的命令。使用这个值来保持时间和命令之间的时间超时。 IR6121.ASM是一个程序,它的NEC

14、6121格式转换的间隙长度的4个字节构成的每个命令的信息的一个示例。 步骤7:创建一个按钮代码交叉参考表TEKNIKA.ASM实现了一个查找表来把代码转换接收到的实际按下按钮。计数器最高时,可以按下按钮,然后抬起头,比对收到的代码。如果不匹配,计数器递减,直到找到下一个匹配。当发现时,从计数器读出有按钮被按下的数量。同时也要注意到,在这个级别上的一些格式做更多的检查,比如具有一个地址,一个补充的代码检查下面的代码本身。来自解码中的步骤的的结果是:如果按下遥控器一个按钮,按钮的号码出现在PIC16C57文件位置。一个命令如通道或下降通道将会出现两个组标志,指示命令,以表明它是持有活跃的。从这一点

15、上应用程序可以访问这些标志和文件做出适当反应。注意下面的详细代码在PICmicro MCUs保护特性。Microchip的满足Microchip数据手册中包含的规格。Microchip的认为其Microchip系列是当今市场上同类最安全的产品之一,当预期的方式,在正常条件下使用。有用来破坏代码保护功能的恶意,甚至是非法的方法。所有这些方法,就我们所知,需要的方式数据表中包含的操作规范来使用Microchip的微控制器。这样做的人可能从事窃取知识产权。Microchip愿与客户的工作谁关心他们的代码的完整性。Microchip或任何其他半导体厂商可以保证自己的代码的安全性。代码保护并不意味着我们

16、保证产品是“牢不可破”的。代码保护是不断变化的。我们在Microchip承诺将不断改进产品的代码保护功能我们的产品。如果你对此事有任何进一步的问题,请联系当地离您最近的销售办事处。本出版物中包含的信息有关设备的应用程序和类似内容仅为建议,并可能被取代的更新。这是你的责任,以确保您的应用程序符合技术规范。任何陈述或保证,并给出微芯科技注册成立的准确性或使用这些信息,或侵犯专利或其他知识产权所产生的这种使用或以其他方式承担任何责任。除了明确Microchip书面批准,没有被授权使用Microchip的产品用作生命支持系统中的关键组件。转让任何许可证,暗中或以其他方式,在任何知识产权。商标权微芯片的

17、名称和商标,微芯片标志,FilterLab KEELOQ microID MPLAB,PICMASTER PICmicro PIC,PICSTART,PRO伴侣,SEEVAL和嵌入式控制解决方案公司是注册商标的微芯片技术纳入美国和其他国家。dsPIC,ECONOMONITOR,FanSense,FlexROM,fuzzyLAB串行编程,ICSP,在线,ICEPIC、微创、Migratable内存,MPASM,MPLIB,MPLINK,MPSIM,MXDEV,中国人民保险公司,PICDEM,PICDEM.net,rfPIC,选择模式和总耐力的商标微芯片技术在美国注册序列化急转弯编程(SQTP)是

18、一个服务标志的微芯片技术纳入美国这里提到的所有另外的商标是他们的各自的公司财产。待添加的隐藏文字内容1Decoding Infrared Remote Controls Using a PIC16C5X MicrocontrollerINTRODUCTIONFor many years the consumer electronics industry has been employing infrared remote controls for the control of televisions, VCRs, and cable boxes. This same technology ha

19、s recently started to appear in industrial applications to eliminate keypads.Decoding most of the infrared signals can be easily handled by PIC16C5X microcontrollers. This application note describes how this decoding may be done.The only mandatory hardware for decoding IR signals is an infrared rece

20、iver. The use of two types is described here. Both are modular types used often by the consumer electronics industry. The rst type responds to infrared signals modulated at about 40 kHz. The second responds to non-modulated infra-red pulses and has a restricted range. The hardware costs of each appr

21、oach will be less than two dollars. Three PIC16C5X application programs are described, and instructions on how they can be used to create an algorithm that can decode just about any remote control signal. Each PIC16C5X application program represents a step in mapping out a pre-existing infrared form

22、at. The nal application is a fully implemented example of decoding and interpreting the infrared signals of a type of Teknika TV remoteTHE THREE LAYERS OF AN INFRARED SIGNALThe typical infrared signal used by remote controls has three layers. The names used for these layers has not been standardized

23、. In this application note they are called the infrared, the modulation, and the serial data.The infrared layer is the means of transmission. Infra-red is light whose wavelength is too long to see. Although you cannot see the infrared beam, it behaves the same as light, so if you cannot see the targ

24、et device, you cannot control it with an infrared signal. To control around corners or through opaque materials, RF, usually UHF signals are used. Although this application note does not further mention RF, much of what is presented here can be used with an RF transmission medium.The modulation laye

25、r refers to the fact that each burst of infrared signal is often modulated at a frequency between 32.75 kHz and 56.8 kHz. This is done to diminish the effects of ambient light. This layer, however, is optional. Some infrared formats do not modulate their outputs, sending pulses of unmodulated infrar

26、ed light instead. This is done to extend the remote controls battery life and to reduce the cost of the remote control device. The serial data layer has the information containing a command. This is typically coded in the lengths of infrared bursts or in the lengths of gaps between infrared bursts.

27、A long gap or burst is interpreted as a 1, a short gap or burst is interpreted as a 0.HARDWARE DESCRIPTIONThe schematic in Figure 1 shows a tool that can be made to aid development of infrared receiver code. The schematic consists of a PIC16C57 connected to one of two available infrared receivers. O

28、ne receiver is for non-modulated signals, the other for modulated signals. Modulated receivers are available from Sharp and Lite On, part numbers GP1U521Y and LT-1060 respectively. The non-modulated type is available from Quality Technologies part number QSE157QT.The choice of the PIC16C57 is not in

29、dicative of the processing power required for decoding. Typical IR receiver code can t into less than half the ROM space available in a PIC16C54, and uses four RAM locations.The choice of a PIC16C57 in this case was driven by the need to store a lot of signal lengths for later reading.A ceramic reso

30、nator clocks the PIC16C57. It will give adequate frequency accuracy to determine pulse and gap lengths. A RC network does not usually have adequate accuracy. A button is available for resetting the PIC16C57, and four jumpers are provided to control the application start-up. The two digit display is

31、multiplexed and driven through Q1 and Q2.Three octal switches are used as inputs to control the OPTION register and which le is displayed. The whole circuit derives its power from a 9V, 200 m A wall mounted supply. U1 regulates the 9V down to 5V for the PIC16C57 and associated circuitry.DESCRIPTION

32、OF SOFTWARE TO AID DEVELOPMENTThis application uses four different firmware files. IRMAIN. ASM controls the selection of the three application files. The first file is MEASURE. ASM which stores the infrared burst and gap lengths into memory and allows playback of that information.IR6121.ASM decodes

33、NEC6121 infrared format and displays the received codes on the LED display. The final file, TEC-NICKA.ASM, shows the final firmware for decoding the infrared format for a Teknika Television.IRMAIN.ASM The firmware listed includes three applications that will aid in designing an infrared control syst

34、em. IRMAIN. ASM reads jumpers 1 and 2 and directs pro-gram flow after reset to one of the three applications. Having no jumper in 2 will direct program flow to MEASURE.ASM.A jumper in 2 only will direct program flow to IR6121.ASM.Jumpers in both 1 and 2 will direct program flow to TEKNIKA. ASM. Jump

35、ers 3 and 4 are not used.MEASURE.ASMThis is the most basic and most useful of the three applications. This program stores the infrared burst and gap lengths into memory, allowing playback of the mea-sure ments through the two digit display. It allows exter-nal control of the OPTION register also, th

36、rough SW1.The setting of SW1 is read directly into the OPTION register prescaler value for TMR0.If SW1 is changed during program operation, the PIC16C57 resets.Upon start-up a “hyphen”will be displayed in the left digit space until the infrared input settles to the dark logic indicating that the uni

37、t is ready to receive an infra-red signal.As an infrared signal comes in, the lengths of bursts of infrared, and the lengths of gaps between burst are stored in consecutive file locations until all four pages of the PIC16C57s memory files are filled. If a jumper had been in 1, the program throws awa

38、y the first 32 pulse and gap lengths and starts storing pulse and gap lengths with the thirty third pulse length. This allows the decoding of very long formats.When all four pages of file memory are filled with pulse and gap lengths, a number and decimal point are dis-played. The decimal point indic

39、ates that the unit is donereading. The number is a gap or pulse length.SW2 and SW3 control the time sequence of the pulse or gap length displayed. These are in octal with SW3 being the more significant digit.INSTRUCTIONS ON WRITING AN ALGORITHM TO DECODE IR REMOTES1. To design a system that uses an

40、infrared remote control, the first step is to choose a remote control. Self designed or off the shelf, modulated or unmodulated are the primary technical decisions. 2. Once a remote control has been chosen or designed, its modulation frequency, if it has one, must be determined. This controls the ki

41、nd of hardware used to receive the infrared signal. 3. The next step is to determine the time-base of the data, that is, if the pulses and gaps are short or long in reference to the PIC16C57 clock. The OPTION switch, SW1, is used to get optimum length pulse and gap counts from TMR0. This defines the

42、 value of the OPTION prescaler. 4. Fourth, definition is made as to what, in the for-mat, defines a 1, and what, in the format, defines a 0. This could be gap counts, pulse counts, or a combination of both. 5. Fifth, determination is made of the full length of commands. This enables the determinatio

43、n as to whether a button is being held down or if a new command of the same type as previous is being issued.6. The sixth step requires the writing of code. The code will resolve the gap and pulse lengths and command lengths into bits and bytes.Each but-ton on the remote will decode to a unique seri

44、esof bits. 7. The seventh and final step takes these codes that are received and converts them to button numbers or commands, using a lookup table.Step 1:Choosing a remote controlDepending on your application, you may choose to have an off the shelf remote control or design one your-self. Typically

45、they have small 4-bit microcontrollers in them, preprogrammed for a serial format.Some com-panies such as General Instrument sell them as com-plete units, others such as NEC sell the main component which can be customized by external diodes to not interfere with other applications. It is also possib

46、le to program a PIC16C57 to generate a signal that can be sent to an infrared LED for transmission. Yet another approach is to use a programmable remote control to generate any number of infrared formats and use them right off the shelf to control the target device.Step 2:Determining a modulation fr

47、equencyFor this and the next step the MEASURE.ASM program will be used. To start out, use the non-modulated receiver and a PIC16C57 running the MEASURE.ASM application. Select 1 on the option selector. Press a button until the decimal point comes on. Using the jumpers switch through the memorized pulse durations that the PIC16C57 will have stored in its memory. If all of the reading except the first are below 40h, the infrared format is a modulating one. If half or more of the values show up as 0FFh, then the remote is non-modulating.If the remote control is modulated, s

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号