【正文】
因此,僅僅保證單片機(jī)不死機(jī)還不夠,還要研究如何減少受干擾的風(fēng)險,以及出錯后如何能夠容錯。就在 Ts 遞減到 0 的時候,令停電等待標(biāo)志 Td=1500。初上電時,對內(nèi)部RAM 做全部清零,令試送電計(jì)時 Ts=25 后休眠。 4 中,當(dāng)保護(hù)器初上電時,首先試送電 ,提示馬上就要送電;等待 30s后正式送電。② 對于有時序控制的應(yīng)用,每次復(fù)位后,先要查看上個周期留下的標(biāo)志,以決定本周期做什么。因?yàn)檫B續(xù) 2 次復(fù)位周期都計(jì)算出錯的概率很小,按照 敘述的輸出端子并聯(lián)電容的處理方法,可以達(dá)到很好的抗干擾效果。如果給系統(tǒng)設(shè)立一個復(fù)位按鈕,也就是常見的手動復(fù)位,這個按鈕不是連接在復(fù)位端,而是并聯(lián)在上述引腳對地的電容兩端。因此,只要不是連續(xù) 2 個周期出錯,輸出是可容錯的。減小 Tr 可以減小并聯(lián)電容。當(dāng)程序執(zhí)行時間較長,要求盡量縮短 Tr 時,可加入微分電路,如圖 1 中的 C R2 D9。也就是說,復(fù)位信號的低電平 Td期間是可供程序執(zhí)行的時間,這個時間要大于每次程序的執(zhí)行周期。例如使用 50Hz工頻電源整形后作復(fù)位,既省略了定時器,同時又為檢測電流信號的相位采集了相應(yīng)的信號,如圖 2 所示。 ① 使用定時器或?qū)S脮r鐘芯片復(fù)位。類似的應(yīng)用還有半電子式電度表,當(dāng)機(jī)械度盤旋轉(zhuǎn) 1 周時才進(jìn)行 1 個計(jì)數(shù),用戶不用電, CPU會一直休眠。這種定時復(fù)位相對于看門狗電 路的優(yōu)點(diǎn),一是把等待時間改為休眠狀態(tài) ,縮短可能受干擾的時間;二是避免了恰好包含看門狗控制環(huán)節(jié)的死循環(huán)。這樣會使抗干擾能力大大增強(qiáng),主要有 2 點(diǎn): ① 休眠時,程序停止運(yùn)行,不會出現(xiàn) PC 指針紊亂引起的程序跑飛。 1 原理與實(shí)現(xiàn)方法 無條件定時復(fù)位法 這種方法特別適合監(jiān)測儀表。針對這些情況,我們在實(shí)踐中嘗試了主動復(fù)位的辦法,采用等間隔的脈沖或根據(jù)外部條件對單片機(jī)進(jìn)行復(fù)位喚醒。 Hope too every colleague explore together, improve our design level together. 單片機(jī)休眠 復(fù)位運(yùn)行方式提高抗干 擾能力 摘要:介紹一種用休眠 復(fù)位運(yùn)行方式提高單片機(jī)抗干擾能力的方法;分析其適用范圍,給出具體應(yīng)用電路;結(jié)合實(shí)例,分析這種運(yùn)行方式下硬件和軟件設(shè)計(jì)的特點(diǎn)。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 antiinterference result very. 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 can39。t still enable exporting the change to the valid level within this cycle。s trigger to have a facelift。 ③ In measure and control cycle among the long system, onechip puter 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 onechip puter up. After being restored to the throne each time, the onechip puter 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 abovementioned problems well with this method , and has got better result in the agricultural voltage transformer prehensive protector experiment. Now take 51 serial onechip puters as an example and probe into the concrete principle and implementation method, restored to the throne the signal as the high level. principle and implementation method Restored to the throne the law regularly unconditionally Use timer, specialpurpose 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 antiinterference ability strengthen greatly , have 2 points mainly: ① . At the dormancy