【正文】
的 C R2 D9。例如使用 50Hz工頻電源整形后作復(fù)位,既省略了定時(shí)器,同時(shí)又為檢測(cè)電流信號(hào)的相位采集了相應(yīng)的信號(hào),如圖 2 所示。類似的應(yīng)用還有半電子式電度表,當(dāng)機(jī)械度盤旋轉(zhuǎn) 1 周時(shí)才進(jìn)行 1 個(gè)計(jì)數(shù),用戶不用電, CPU會(huì)一直休眠。這樣會(huì)使抗干擾能力大大增強(qiáng),主要有 2 點(diǎn): ① 休眠時(shí),程序停止運(yùn)行,不會(huì)出現(xiàn) PC 指針紊亂引起的程序跑飛。針對(duì)這些情況,我們?cè)趯?shí)踐中嘗試了主動(dòng)復(fù)位的辦法,采用等間隔的脈沖或根據(jù)外部條件對(duì)單片機(jī)進(jìn)行復(fù)位喚醒。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。s trigger to have a facelift。Analyse its scope of application, provide and use the circuit concretly。s circuit for guarding the gate regularly, first, change waiting time into a dormancy state, time to shorten and may be interfered。 Next cycle , the mistake is corrected. So, so long as does not make mistakes in 2 cycles in succession, it is very faulttolerant 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. 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 bee 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 mon 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 abovementioned pins. 3. The software realizes the main point 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 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。 關(guān)鍵詞:?jiǎn)纹瑱C(jī) 復(fù)位 /休眠 抗干擾 引 言 化方面顯示出非凡的優(yōu)勢(shì),在很大程度上取代了原來由數(shù)字邏輯電路、運(yùn)算放大電路組成的檢測(cè)、控制電路,應(yīng)用非常廣泛。在實(shí)際運(yùn)行中,往往是用 A/D 轉(zhuǎn)換器采樣輸入的模擬量,然后進(jìn)行存儲(chǔ)顯示。 外部條件復(fù)位法 沖計(jì)算熱量,沒有熱水流動(dòng),就沒有熱量輸出, CPU只要保持原來數(shù)值即可,不需要計(jì)數(shù)。圖 1 為使用 555 電路組成的定時(shí)電路;也可以使用 X1126 之類的時(shí)鐘芯片,設(shè)置報(bào)警時(shí)間后用報(bào)警信號(hào)喚醒CPU。合理選擇復(fù)位周期和復(fù)位信號(hào)的高電平占空比非常重要。 ② 把外圍電路設(shè)計(jì)成高電平無效。 3 軟件實(shí)現(xiàn)要點(diǎn) 輸出恢復(fù)與不清零 RAM 此,復(fù)位后要立即恢復(fù)所有引腳的狀態(tài)。也就是說,凡是跨過復(fù)位周期的操作,都是靠標(biāo)志傳遞的,這些標(biāo)志存放在內(nèi)部 RAM 中,只有初上電時(shí)才清零。下一次被復(fù)位后,再檢測(cè)上電引腳已不是初上電,于是進(jìn) 行到試送電計(jì)時(shí) Ts 的檢測(cè)。本文力圖從這兩方面作些探索,希望這些粗淺見解能夠起些拋磚引玉的作用,對(duì)大家有所幫助;也希望各位同仁一起探索,共同提高我們的設(shè)計(jì)水平。當(dāng) Ts1=0 時(shí),應(yīng)該進(jìn)入停電等待 30s 的過程了。它 在上電后,經(jīng)過一定的動(dòng)作順序達(dá)到正常工作狀態(tài),如圖 4;根據(jù)這個(gè)動(dòng)作編寫軟件流程的一部分,如圖 5。如果計(jì)算時(shí)間允許,盡量采取方法 1。由于電容的保持作用,在本周期內(nèi)尚不能使輸出變化到有效的電平;在下個(gè)周期,錯(cuò)誤被 糾正。單片機(jī)在 Ts 和 Tr 期間都能有效地抗干擾,但是最好還是把多余時(shí)間安排在 Tr 內(nèi)。 ② 使用系統(tǒng)固有的信號(hào)作為定時(shí)復(fù)位脈沖。因此,只要把水輪脈沖與 CPU的復(fù)位聯(lián)系起來,水輪每旋轉(zhuǎn) 1 周, CPU復(fù)位 1 次,熱表就可以正常工作了,這就是外部條件復(fù)位法。如果讓 CPU 執(zhí)行完任務(wù)后直接進(jìn)入休眠,然后由外界復(fù)位喚醒它去執(zhí)行下 一次操作,這就是定時(shí)復(fù)位法。在抗干擾方面的許多技術(shù),比如設(shè)軟件陷阱 、加硬件看門狗電路等,可使這一問題有較好的解決,但仍然存在問題:① 看門狗動(dòng)作時(shí),意味著已經(jīng)出現(xiàn)了錯(cuò)誤,且運(yùn)行了一段時(shí)間,這在有些場(chǎng)合是不允