为了正常的体验网站,请在浏览器设置里面开启Javascript功能!
首页 > (DOC)-单片机外文翻译---单片机休眠-复位运行方式提高抗干扰能力-单片机

(DOC)-单片机外文翻译---单片机休眠-复位运行方式提高抗干扰能力-单片机

2017-11-11 17页 doc 50KB 13阅读

用户头像

is_682974

暂无简介

举报
(DOC)-单片机外文翻译---单片机休眠-复位运行方式提高抗干扰能力-单片机(DOC)-单片机外文翻译---单片机休眠-复位运行方式提高抗干扰能力-单片机 Dormancy of the one-chip computer---restore to the throne in the operation way and improve anti- interference ability Abstract: Introduce a kind of dormancy of using- restore to the throne in theoperation way and improve th...
(DOC)-单片机外文翻译---单片机休眠-复位运行方式提高抗干扰能力-单片机
(DOC)-单片机外文---单片机休眠-复位运行方式提高抗干扰能力-单片机 Dormancy of the one-chip computer---restore to the throne in the operation way and improve anti- interference ability Abstract: Introduce a kind of dormancy of using- restore to the throne in theoperation way and improve the anti-interference ability method of the one-chip computer;Analyse its scope of application, provide and use the circuit concretly; Combine the instance, analyse the characteristic of the hardware and software design under these kind of operation way. Keyword: One-chip computer Restore to the throne /dormancy anti-interference Foreword Introduction: With the development at full speed of the microelectric technique, the performance of the one-chip computer improves rapidly, demonstrate the outstanding advantage in the operation, logic control, intelligent respect, replaced and enlarged the measuring that the circuit made up, control circuit by digital logical circuit, operation originally to a great extent, use very extensivly. But because it have system halted, procedure run critical defect of flying etc, make it limit in a lot of important application of occasion. A lot of technology in anti-interference , for example set up the software trap, add thehardware to guard the gate in dog's circuit etc, can make this problem havebetter settlement, but still the existing problem: ? Guard the gate dog at the movement, mean and appear mistake already and run some time, this is not allowed in some occasions; ?Procedure appear circulation mistake very much sometimes, but just guard the gate dog control link include and enter, adopt and guard the gate as to such a mistake dog unable to discern; ? In measure and control cycle among the long system, one-chip computer spend wait for the peripheral hardware a large amount of time, will be interfered too when carry out and wait for the order. To these situations, we have tried the method restored to the throne voluntarily in practice, alternate pulse of adopting etc or restore to the throne waking according to external terms to the one-chip computer up. After being restored to the throne each time, the one-chip computer carries out the corresponding procedure, enters dormancy in time after finishing carrying out the task, wait to be restored to the throne nextly. Have solved above-mentioned problems well with this method , and has got better result in the agricultural voltage transformer comprehensive protector experiment. Now take 51 serial one-chip computers as an example and probe into the concrete principle and implementation method, restored to the throne the signal as the high level. 1.A principle and implementation method 1.1 Restored to the throne the law regularly unconditionally Use timer, special-purpose clock chip or other pulse generator, produce signal of restoring to the throne regularly according to interval that set for. This kind of method is especially suitable for the measuring instrument. In not running actually, sample the analog quantity of introduction with A/D converter often, then store showing. This course is very fast, but steady for reading, the data per second are only upgraded 1 -2 times, a large amount of time of CPU is used for waiting. Let CPU carry out and enter dormancy directly after the task , restore to the throne and wake by external world up It carry out the next operation, this is to restore to the throne the law regularly In this way can make anti-interference ability strengthen greatly , have 2 points mainly: ?. At the dormancy, procedure stop run, can appear PC indicator disorderly procedure that causes run and fly. Work time in dormancy proportion 1:9, that is to say 1 s have 0.1 time of s used for measuring, sending off showing, there is time dormancy of 0.9s, the probability that the procedure is interfered is 1/10 while running at full speed, whole anti-interference ability raise by 10 times. ? Because every 1s is restored to the throne once unconditionally, once present the system halted during a job, can certainly resume when restored to the throne next time. As to only instrument that show, some reading mistake that 1s appear accidentally there is no memory to the next measurement, be could bear , belong to “pass” mistake. This kind is restored to the throne the advantage of dog's circuit for guarding the gate regularly, first, change waiting time into a dormancy state, time to shorten and may be interfered; Second, avoided happenning that the dog controls the death circulation of the link to include guarding the gate. 1.2 The external condition is restored to the throne the law Some arrival that export or measure is controlled by the outside. For instance, the hot form. of heating, rotate the pulse produced and calculate heat by hot water water wheels, there is no hot water to flow, there is no heat to export, CPU only need in fact keep number value, do not need to count. Can imagine hot water water wheels rotate when parking warm , CPU idle in will it be will it be one season autumn spring and summer, If let dormancy its , measure have water wheels pulse constantly, anti-interference ability can strengthen greatly. So, so long as link up the restoring to the throne of the pulse of the water wheels and CPU, the water wheels rotate a circle each time, CPU is restored to the throne once, hot form. can work normally , this is restored to the throne the law by the external condition . Similar application have half electron kilowatt-hour meter , go on one count just when the machinery degree wheels and transfers to a circle, users do not need the electricity, CPU has been knowing the dormancy all the time . The restoring to the throne in the interval not to be regular, but confirmed according to the external condition of this method. In some occasions, the time of the dormancy will be very long, very effective to improving anti-interference ability. 2 .The hardware realizes the main point 2.1 Restored to the throne regularly unconditionally Generally have 2 kinds of methods. ? Use theitimer or the special-purpose clock chip to be restored to the throne. Fig1, in order to use the timing circuit that 555 circuit makes up; Can use the clock chips of X1126 ,etc too , wake CPU up with the alarm signal after setting up warning time. This kind of method is suitable when the long interval is made, can also follow the result of this operation ,determine to wake time up in alarm next time temporarily, very flexible and convenient. ? The signal of using the system to be inherent is as reducing the pulse regularly. Use 50Hz worker power make reducing after having a facelift frequently, already omit the timer, gathered the corresponding signal for the phase place which measured the electric current signal at the same time, as Fig. 2 shows. 2.2 External conditions are restored to the throne Send external condition pulse to and is restored to the throne the end son after having a facelift. To that above-mentioned water wheels or the ammeter spend a pulse produced, can use Schmitt's trigger to have a facelift; For writing down the instrument of the biggest or minimum,can use the window comparator. In order to realize the electronization that is regulated,can use the electronic electric potential device, establish upper and lower limits with the order of the one-chip computer. 2.3 Reduce cycle and restored to the throne the high electricity at ordinary times In Fig3, restored to the throne the signal during high level Tr, the one-chip computer is in the state of restoring to the throne, the procedure does not run, anti-interference ability is the strongest; After the high level, the one-chip computer begins to hold the conduct procedure. That is to say, are restored to the throne and suitable for the time that the procedure carries out during the low level Td of the signal, this time should be greater than the execution cycle of the procedure each time. It is restore to the throne cycle and restore to the throne high level of signal take empty than very much important to choose rationally. As to simple to show instrument, restore to the throne cycle determine data break cycle, low electricity is it measure, hancl over all time shown to greater than to want at ordinary times; Otherwise, cant present forever the mistake of the intact executive program.Monolithic integrated circuit in Ts and Tr period all can effectively the antijamming, but is best the unnecessary time arrangement in Tr. When the program time is long, when as far as possible the request reduces Tr, may join the differentiating circuit, like chart 1 center C30, R26, D9. 2.4 Treatment of output end sons (1) Restore to the throne straight pulse During all I/O mouth of one-chip computer turn into the high level when restoring to the throne. That is to say output for low pin normally, will according to restore to the throne cycle appear the width for the straight pulse of Tr. This straight pulse will influence the normal output, 2 methods are dealt with: ? Connect in parallel electric capacity suppress , capacity confirm according to Tr time that restore to the throne on the son in end. Reducing Tr can be reduced and connected the electric capacity in parallel. ? It is invalid to design the peripheral circuit into the high level. (2) Fault-tolerant Choose the capacity that the output end connects the electric capacity in parallel fault-tolerantly and properly, can realize fault-tolerant control. Reduced cycle in a certain, because interfered exporting the wrong level. Because the keeping function of electric capacity, can't still enable exporting the change to the valid level within this cycle; Next cycle , the mistake is corrected. So, so long as does not make mistakes in 2 cycles in succession, it is very fault-tolerant to export Certainly, this kind of method will make the normal output change lag behind for one cycle, just really reflect the output end son. 2.5 has the electricity to measure and restore to the throne manually Some system is it make some initialize and operate to want at electricity for the first time. Restored to the throne and already become the beginning condition of normal running each time while adopting the way of restoring to the throne to run , it is unable to distinguish and have the electricity for the first time. In some pin connects the electric capacity of one ljIF to the ground, measure this pin after being restored to the throne, if low level to have electricity for the first time. Give system set up one restore to the throne button, that is to say a common one manual to restore to the throne, this button is not joined and being restored to the throne in the end, is connected in parallel in the electric capacity both ends to the ground of above-mentioned pins. 3. The software realizes the main point 3.1 is it resume with zero clearing RAM to output Restore to the throne the last all pin turn high level into , is it should taKe place unnecessary change for low pin to make regularly, so, should resume the state.of all pins immediately after being restored to the throne. There are 2 kinds of methods : ? Analyse and judge immediately after being restored to the throne this time, provide the state of the pin according to the need; ? In being RAM it is the last last state that come down,these RAMs when restored.To the throne regularly can the zero clearing one; But electricity or manual to rstore to the throne when pushing in conformity with zero clearing, is it embody to want when the software is worked outing at the beginning. If calculate time allows, try one's best to take method 1. Restore to the throne cycle probability made mistakes to calculate very little, according to 2 for the 2nd time in succession. 4 output end son that narrate connect treatment method of electric capacity in parallel, can reach kind anti-interference result very. 3.2 realizes crossing over and is restored to the throne alternate time sequence regularly to control Work in way of restoring to the throne now, start anew and carry out the same procedure repeatedly each time. Can be divided into 2 kinds of situations: ? As to simple to show instrument, carry on measurement ,send off showing after being restored to the throne each time, have causality between restoring to the throne twice . need is it switch over to the dormancy to waiting original only. Should pay attention to, measurement, give total time used to show is it is it restore to the throne low electricity at ordinary times to smaller than to want, otherwise can't present forever the mistake of the intact executive program. ? For having application that time sequence controlled , after being restored to the throne each time , should check first that see the sign left last cycle , in order to determine what is done this cycle . That is to say every is it restore to the throne operation of cycle to stride , by is it transmit to indicate all, these indicate while leaving in inside RAM , the zero clearing only when have the electricity for the first time. For example, the protecting synthetically device of above-mentioned voltage transformer , is restored to the throne regularly according to the interval of 20ms. It reaches the normal working state through, certain movement order after having the electricity, such as Fig. 4; Write a part of the procedure of the software according to this movement, such as Fig. 5. In 4 Fig, act as person who protect the beginning at the electricity, is it transmit power 0 to try at first. 5s, points out and transmits power soon; Transmit power formally after waiting for 30s. It is start-up time in 1s after transmitting power, does not measure the electric current. Start after finishing, if all going well, the location is put" normal sign ", person who protect restore to the throne cycle enter normal running in the next one. Try 0 that transmits power. 5s is it is it realize to count once restoring to the throne to delay time, restore to the throne time 20ms each time. At having electricity for the first time, make all zero clearing to inside RAM, make it is it time Ts to transmit power not to try =Dormancy after 25. After restoring to the throne, is it have electric pin to have electricity for the first time already, is it is it is it is it time the measuring of Ts to transmit power to try to get to go on to measure next time. If Ts * 0, is it in is it prolong period to transmit power, is it enter dormancy after the 1 to reduce Ts to prove. Act as Ts-1 = 0, the course which waited for 30s that should enter and lose electrical power. Just when Ts decreases progressively to 0, make it is it indicate to wait for not to lose electrical power Td =1500. When the procedure is restored to the throne beginning again, measure to Ts =0 but Td * 0, is it is it is it transmit power to try to cross already to indicate, at is it wait for the course of 30s to lose electrical power now. In this way, the whole process is transmitted each other by such these parameters as Tr, Td , Ts etc, go on step by step. Result: Conclusion Anti-interference is an important problem in an electronic design, especially Important in the one-chip computer. This is because the one-chip computer has procedures to run particularity that flies, the consequence that it is interfered may be the system halted, may send out various kinds of mistakes or illegal movements before the system halted too, make the whole system produce the mortality mistake. So, only guarantee it is not enough yet for one-chip computer not to crash, study how to reduce the risk interfered, it can befault-toierant how is it after and make mistakes. This text is it act as some exploration from two these to try hard, hope these elementary opinions can play some function of casting a brick to attract jade, helpful to everybody; Hope too every colleague explore together, improve our design level together. 单片机休眠-复位运行方式提高抗干扰能力 摘要:介绍一种用休眠-复位运行方式提高单片机抗干扰能力的;分析其适用范围,给出具体应用电路;结合实例,分析这种运行方式下硬件和软件设计的特点。 关键词:单片机 复位/休眠 抗干扰 引 言 随着微电子技术的飞速发展,单片机的性能迅速提高,在运算、逻辑控制、智能化方面显示出非凡的优势,在很大程度上取代了原来由数字逻辑电路、运算放大电路组成的检测、控制电路,应用非常广泛。但由于它存在着死机、程序跑飞等致命缺陷,使它在许多重要场合的应用受到限制。在抗干扰方面的许多技术,比如设软件陷阱、加硬件看门狗电路等,可使这一问题有较好的解决,但仍然存在问题:? 看门狗动作时,意味着已经出现了错误,且运行了一段时间,这在有些场合是不允许的;? 有时程序出现死循环错误,但是刚好把看门狗控制环节包含进去,对于这样的错误采用看门狗无法识别;? 在检测控制周期比较长的系统中,单片机花大量时间等待外设,执行等待命令时同样会受到干扰。针对这些情况,我们在实践中尝试了主动复位的办法,采用等间隔的脉冲或根据外部条件对单片机进行复位唤醒。每次复位后,单片机执行相应的程序,执行完任务后及时进入休眠,等待下次复位。用此方法较好地解决了上述问题,并在农用变压器综合保护器实验中得到了较好的效果。下面以51系列单片机为例探讨具体原理与实现方法,复位信号为高电平。 1 原理与实现方法 1.1 无条件定时复位法 用定时器、专用时钟芯片或其它脉冲产生器,按照设定的间隔定时产生复位信号。这种方法特别适合监测仪表。在实际运行中,往往是用A/D转换器采样输入的模拟量,然后进行存储显示。这一过程很快,但为了读数稳定,每秒数据更新不过1,2次,CPU的大量时间用于等待。如果让CPU执行完任务后直接进入休眠,然后由外界复位唤醒它去执行下一次操作,这就是定时复位法。这样会使抗干扰能力大大增强,主要有2点:? 休眠时,程序停止运行,不会出现PC指针紊乱引起的程序跑飞。如果 工作与休眠的时间比例为1:9,也就是说,1s内有0.1s的时间用来检测、送显示,有0.9s的时间休眠,程序受干扰的概率是全速运行时的1/10,整体抗干扰能力提高了10倍。? 由于每1s无条件复位1次,一旦某次工作期间出现死机,在下次复位时肯定得以恢复。对于只是显示的仪表,某1s偶然出现的读数错误对下一次测量并没有记忆,是可以承受的,属“一过性”错误。这种定时复位相对于看门狗电路的优点,一是把等待时间改为休眠状态 ,缩短可能受干扰的时间;二是避免了恰好包含看门狗控制环节的死循环。 1.2 外部条件复位法 有些输出或测量的启动是由外部控制的。如暖气热表,靠热水水轮旋转产生的脉冲计算热量,没有热水流动,就没有热量输出,CPU只要保持原来数值即可,不需要计数。可以想象,停暖时热水水轮不转,CPU在春夏秋三季则无事可做;如果让其休眠,而不是时刻检测有无水轮脉冲,抗干扰能力会大大增强。因此,只要把水轮脉冲与CPU的复位联系起来,水轮每旋转1周,CPU复位1次,热表就可以正常工作了,这就是外部条件复位法。类似的应用还有半电子式电度表,当机械度盘旋转1周时才进行1个计数,用户不用电,CPU会一直休眠。这种方法的复位间隔不是固定的,而是根据外部条件确定的。在有些场合,休眠的时间会很长,对提高抗干扰能力非常有效。 2 硬件实现要点 2.1 无条件定时复位 一般有2种方法。? 使用定时器或专用时钟芯片复位。图1为使用555电路组成的定时电路;也可以使用X1126之类的时钟芯片,设置报警时间后用报警信号唤醒CPU。这种方法适用于长间隔定时,还可以根据本次运算的结果,临时决定下一次的报警唤醒时间,非常灵活方便。? 使用系统固有的信号作为定时复位脉冲。例如使用50Hz工频电源整形后作复位,既省略了定时器,同时又为检测电流信号的相位采集了相应的信号,如图2所示。 2.2 外部条件复位 把外部条件脉冲整形后送到复位端子。对于上述水轮或电表度盘产生的脉冲,可以使用施密特触发器整形;对于最大或最小值的仪器,可使用窗口比较器。为了实现调节的电子化,可以使用电子电位器,用单片机指令设定上下限。 2.3 复位周期与复位高电平时间 图3中,复位信号在高电平Tr期间,单片机处在复位状态,程序不运行,抗干扰能力最强;高电平过后,单片机开始执行程序。也就是说,复位信号的低电平Td期间是可供程序执行的时间,这个时间要大于每次程序的执行周期。合理选择复位周期和复位信号的高电平占空比非常重要。对于单纯显示仪表,复位周期决定数据刷新周期,低电平时间要大于检测、送显示的全部时间;否则,会出现永远不能完整执行程序的错误。单片机在Ts和Tr期间都能有效地抗干扰,但是最好还是把多余时间安排在Tr内。当程序执行时间较长,要求尽量缩短Tr时,可加入微分电路,如图1中的C30、R26、D9。 2.4 输出端子的处理 (1)复位期间的正脉冲 复位期间单片机的全部I/O口变成高电平。也就是说,正常输出为低的引脚,会按照复位周期出现宽度为Tr的正脉冲。这个正脉冲会影响正常的输出,有2个办法处理:? 在端子上并联电容加以抑制,容量根据复位的Tr时间确定。减小Tr可以减小并联电容。? 把外围电路设计成高电平无效。 (2)容 错 适当选取输出端并联电容的容量,可以实现容错控制。在某个复位周期,因干扰 输出了错误电平。由于电容的保持作用,在本周期内尚不能使输出变化到有效的电平;在下个周期,错误被纠正。因此,只要不是连续2个周期出错,输出是可容错的。当然,这种方法会使正常的输出变化滞后一个周期,才真正反映到输出端子。 2.5 上电检测与手动复位 有些系统在初上电时要做一些初始化操作。采用复位方式运行时,每次复位已经成为正常运行的开始条件,无法辨别是否初上电。在某引脚对地接一个1μF的电容,复位后检测该引脚,如果是低电平就是初上电。如果给系统设立一个复位按钮,也就是常见的手动复位,这个按钮不是连接在复位端,而是并联在上述引脚对地的电容两端。 3 软件实现要点 3.1 输出恢复与不清零RAM 定时复位后全部引脚变成高电平,使得本应为低的引脚发生了不应有的变化,因此,复位后要立即恢复所有引脚的状态。有2种方法:? 本次复位后立即进行分析判断,根据需要给出引脚状态;? 根据RAM中上一次留存下来的状态,这些RAM在定时复位时是不能清零的;而在初上电或手动复位按下时应清零,在软件编制时要体现出来。如果计算时间允许,尽量采取方法1。因为连续2次复位周期都计算出错的概率很小,按照2.4叙述的输出端子并联电容的处理方法,可以达到很好的抗干扰效果。 3.2 实现跨越定时复位间隔的时序控制 现在用复位方式工作,每次从头开始反复执行同一程序。可分为2种情况:? 对于单纯显示仪表,每次复位后进行测量、送显示,两次复位之间没有因果关系,只需把原来的等待改为休眠即可。要注意的是,测量、送显示用的总时间要小于复位低电 平时间,否则会出现永远不能完整执行程序的错误。? 对于有时序控制的应用,每次复位后,先要查看上个周期留下的标志,以决定本周期做什么。也就是说,凡是跨过复位周期的操作,都是靠标志传递的,这些标志存放在内部RAM中,只有初上电时才清零。例如,前面提到的变压器综合保护器,按照20ms的间隔定时复位。它在上电后,经过一定的动作顺序达到正常工作状态,如图4;根据这个动作编写软件的一部分,如图5。 在图4中,当保护器初上电时,首先试送电0.5s,提示马上就要送电;等待30s后正式送电。送电后的1s内为启动时间,不进行过电流检测。启动完成后,如果一切正常,则把“正常标志”置位,保护器在下一个复位周期进入正常运行。试送电的0.5s延时是对复位进行25次计数实现的,因为每次复位时间是20ms。初上电时,对内部RAM做全部清零,令试送电计时Ts=25后休眠。下一次被复位后,再检测上电引脚已不是初上电,于是进行到试送电计时Ts的检测。如果Ts?0,说明在送电延时期间,把Ts减1后进入休眠。当Ts-1=0时,应该进入停电等待30s的过程了。就在Ts递减到0的时候,令停电等待标志Td=1500。当程序再次由复位开始时,检测到Ts=0但是Td?0,表明已经越过了试送电,现在正处于停电等待30s的过程中。这样,整个进程由Tr、Td、Ts等这些参数相互传递着,一步步进行下去。 图5 变压器保护器部分程序流程 结 语 抗干扰是电子设计中的重要问题,在单片机中尤其重要。这是因为单片机有程序跑飞的特殊性,它受到干扰的后果可能是死机,也可能在死机前发出各种错误或非法动作,使整个系统产生致命性错误。因此,仅仅保证单片机不死机还不够,还要研究如何减少受干扰的风险,以及出错后如何能够容错。本文力图从这两方面作些探索,希望这些粗浅见解能够起些抛砖引玉的作用,对大家有所帮助;也希望各位同仁一起探索,共同提高我们的设计水平。
/
本文档为【(DOC)-单片机外文翻译---单片机休眠-复位运行方式提高抗干扰能力-单片机】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索