基于STC单片机的红外遥控开关系统的设计_第1页
基于STC单片机的红外遥控开关系统的设计_第2页
基于STC单片机的红外遥控开关系统的设计_第3页
基于STC单片机的红外遥控开关系统的设计_第4页
基于STC单片机的红外遥控开关系统的设计_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 pu

48、lse 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, switch to a demodulating

49、 ir receiver. with the option selector still at 1, press a button on the remote control again until the decimal point comes on. the series of memorized pulse durations will now probably include a lot of ffh values. if so, move the option selector up until the val-ues are in the 7h to 1fh range. the

50、option selector has the optimum value for the option divisor to be used in the tmr0 register. to optimize range and reliability, several demodulating receivers may be tried. these are available from sharp or lite on. the modulating frequencies that are presently used are 32.75 khz, 35.0 khz, 36.0 kh

51、z, 36.7khz, 38 khz, 39 khz, 40 khz, 41.7 khz, 48 khz, and 56.8 khz2. the most common are round 40 khz. the best match for your remote control will give the longest range and most consistent results.step 4:decoding ones and zerosthe next step is to map out the characteristic pulse and gap lengths tha

52、t represent ones and zeros. by pressing the same button on the remote, write down the series of numbers read by the pic16c57 running the measure .asm program. each odd numbered entry is the duration of a burst of ir from the remote control. each even numbered entry is the duration of a gap between b

53、ursts of infrared. the lengths of these gaps and bursts define ones and zeros. their order will depend on which button is pressed. once the characteristic lengths have been discovered for a one and a zero, an algorithm can then be created with a counter to translate the lengths into ones and zeros.s

54、tep 5:finding the command lengthpress the same button again. the command duration can also be found. this is necessary to determine if a button is being held down or a new command of the same type is being issued. most remote controls repeat the command as long as the button is held down, the repeti

55、tions separated by a long dark time, usually 0ffh on an even numbered transition.if no long even num-bered counts can be found, consider that some com-mands can be longer than 64 transitions. the option to delay counting is available for this reason. insert jumper 1 and measure. asm will only start

56、storing transition times after the 32nd transition.step 6: translating lengths to bitsonce the characteristic lengths of ones and zeros have been found and the length of the typical command has been found, a program can then be written to decode these lengths to ones and zeros and display them on th

57、e two digit display. also a hold flag can be created which will be true as long as the button is being held down. usually 1/8 second between commands indicates a new command. use this value to time out hold times and times between commands. ir6121.asm is an example of a program that translates the g

58、ap lengths of the nec6121 format to the four bytes that make up the information in each command.step 7:create a button to code cross reference tableteknika.asm implements a lookup table to translate the codes received to the actual button pressed. a counter is loaded with the highest number button tha

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论