防止8051瞬間掉電之外部保護應用線路設計

新茂國際科技股份有限公司
8051 Series MCU Application Note
SyncMOS Technologies Inc.
Ext-Brown-out Protection for C51
防止8051瞬間掉電之外部保護應用線路設計
External Brown-out Protection for C51 Microcontrollers with Active High Reset Input
特色(Features):
• 低電壓偵測(Low-voltage Detector)
• 防止暫存器及EEPROM/FLASH誤動作(Prevents Register and EEPROM/Flash Corruption)
• 獨立的解決方案(One Discrete Solution)
• 整合IC的解決方案(Integrated IC Solution)
• 低功耗/低成本的解決方案(Low-power/Low-cost Solution)
• 使用一般的元件參數(Formulas for Component Value Calculations)
• 完整並簡單的線路設計(Complete with Sample Schematics)
內容介紹(Introduction):
這份應用文件詳細的說明如何防止系統在電源不穩定時出現當機情形,這種低電壓偵測線路可以防止MCU再運行
程序時不被不穩定的電源供應所影響.這種瞬間電壓下降到工作電壓以下的現象通常被稱做”Brown-outs”,而極短暫
的工作電壓完全消失的現象通常被稱作為”Black-outs”.
這種低電壓保護應用線路說明的非常詳細,並且可以讓使用者依照系統特性自行調整參數.使用這種線路可以預防
下列幾種現象發生:
z
MCU 暫存器錯誤.
z
I/O暫存器錯誤.
z
I/O Pin上出現異常訊號.
z
IC內部記憶體錯誤.
z
IC外部記憶體錯誤.
This application note shows in detail how to prevent system malfunction during periods of insufficient power supply
voltage. It describes techniques to prevent the MCU from executing code during periods of insufficient voltage by using
external low voltage detectors. These events are often referred to as “Brown-outs”, where power supply voltage drops to
an insufficient level, or “Black-outs” where power supply voltage totally disappear for a period of time.
One discrete solution is discussed in detail, allowing the user to calibrate the system requirements. A complete guide to
Integrated Circuit (IC) solutions is also included. By implementing these techniques, the following can be prevented:
• MCU Register Corruption
• I/O Register Corruption
• I/O-pin Random Toggling
• On-chip Memory Corruption (SRAM, EEPROM, Flash)
• External Memory Corruption
1
SyncMOS FAE 2004/02
新茂國際科技股份有限公司
8051 Series MCU Application Note
SyncMOS Technologies Inc.
Ext-Brown-out Protection for C51
保護MCU 暫存器不會錯誤(Preventing SFR Corruption)
當保護線路將MCU保持在RESET狀態時,MCU所有的工作將被終止.當RESET PIN的狀態從HIGH到LOW時,所有的
SFR會回復到初始值,如果沒有保護線路,MCU將會隨機的工作,就像是SFR錯亂而誤動作一樣.
When the Detector keeps the MCU in Reset, all MCU activity is halted. When released from Reset, all the Special
Function Registers (SFRs) are in their default state. Without a Detector, random MCU activity such as described before
might cause the Special Function Registers to get corrupted.
保護I/O暫存器不會錯誤(Preventing I/O Register Corruption)
當保護線路將MCU保持在RESET狀態時,MCU的IO將會保持在初始狀態即Port0在LOW,Port1/2/3在HIGH,所以在
MCU周圍的元件也會保持在初始的狀態.如果沒有保護線路,MCU將會隨機的工作,就像是不知道會將什麼值填入
IO的暫存器中而誤動作一樣.
When using a Detector to keep the MCU in Reset, all I/O Registers are kept in their default state for the duration of the
reset. Consequently, all on-chip peripherals will stay in their reset state. Without a Detector, random MCU activity such as
described before might write an unknown value to any I/O Register. This may cause unexpected behavior of the on-chip
peripherals.
保護I/O Pin上不會出現異常訊號(Preventing I/O Pin Random Toggling)
當保護線路將MCU保持在RESET狀態時,MCU的IO將會保持在初始狀態即Port0在LOW,Port1/2/3在HIGH,所以在
MCU周圍的元件也會保持在初始的狀態.如果沒有保護線路,MCU將會隨機的工作,就像是不知道會將什麼值填入
IO的暫存器中而誤動作一樣.
A Detector will keep the MCU in Reset, and all I/O pins are kept in their default state for the duration of the Reset.
Without a Detector, random MCU activity such as described before might write a random
value to the I/O Registers. This may cause random toggling of the I/O pins.
保護IC內部記憶體不會錯誤(Preventing Volatile On-chip Memory Corruption)
當保護線路將MCU保持在RESET狀態時,MCU將無法存取內部記憶體. 在RESET期間內部記憶體將保持原本的值
而不被改變. 如果沒有保護線路,MCU將會隨機的工作,就像是不知道會將什麼值填入內部記憶體中一樣,而造成系
統誤動作.
Using a Detector to keep the MCU in Reset, there will be no access to the volatile on-chip memory. The memory will keep
its present content for the duration of the Reset. Without a Detector, random MCU activity such as described in the
introduction may write an unknown value to any volatile on-chip memory location.
2
SyncMOS FAE 2004/02
新茂國際科技股份有限公司
8051 Series MCU Application Note
SyncMOS Technologies Inc.
Ext-Brown-out Protection for C51
保護IC外部記憶體不會錯誤(Preventing External Components Corruption)
當保護線路將MCU保持在RESET狀態時,MCU將無法存取外部元件像是記憶體,週邊線路,正反器等等. 在RESET期
間外部線路將保持原本的狀態而不被改變. 如果沒有保護線路,MCU將會隨機的工作,就像是不知道會將什麼值填
入外部元件中一樣,而造成系統誤動作.(SRAM,74系列IC等等)
Using a Detector to keep the MCU in Reset, prevents access to the external components such as memories, peripherals,
latches, etc. These components will keep their contents or status for the duration of the Reset.
Without a Detector, random MCU activity could write an unknown value to any External Components address (SRAM
locations, peripheral command registers, etc.).
保護IC內部FLASH不會錯誤(Preventing Non volatile On-chip Memory Corruption)
非揮發記憶體,像是EEPROM及FLASH,在斷電時它們的內容值將正確的被保留. 當保護線路將MCU保持在RESET
狀態時,它們的控制訊號將被終止,所有的記憶體內容將不會被誤寫入. 如果沒有保護線路,MCU將會隨機的工作,就
像是隨機寫入任何值到FLASH一樣,這會造成程式錯亂.自8051有能力對自我內部的程式記憶體做寫入的能力時,內
部的FLASH內容就有可能受到電源不穩的影響.
Non volatile memories such as EEPROM, and Flash are designed to keep their contents even when power is completely
removed from the system. By the use of a Detector to keep the MCU in Reset, activity on the control lines ceases. The
memory contents are then prevented from unintentional writes from the MCU for the duration of the Reset. Without a
Detector, random MCU activity could initialize an unintended write to the nonvolatile
memory. This may cause random corruption of the memory contents. Since the C51 MCU is capable of writing to its own
program memory, the internal Flash Program memory contents could be affected by a power failure situation.
備註:
1.任何非揮發的記憶體都會有一個最低的工作電壓,以保證能夠成功的將值寫入記憶體.如果供應電源在
寫入資料時電壓低於最低工作電壓,將會造成寫入的值錯誤.
2.當在寫入內部EEPROM時,發生RESET狀態,此時指令無效.
Notes:
1. For any write to non volatile memory, a minimum voltage is required to successfully write the new values into the
memory. If supplied voltage at any time during the write cycle drops below the minimum voltage, the write might fail,
corrupting the location written to.
2. When the reset activates during a write to the internal EEPROM, the operation is aborted. The result can be seen when
the location being written get corrupted.
3
SyncMOS FAE 2004/02
新茂國際科技股份有限公司
8051 Series MCU Application Note
SyncMOS Technologies Inc.
Ext-Brown-out Protection for C51
範例一(Alternative 1):低消耗功率線路(Low power Consumption)
特色(Characteristics):
˙非常低的功率損耗(Very Low-power Consumption, (Typ 0.5 µA@3V, 1 µA@5V))
˙低成本(Low-cost Solution)
˙較大的抖動電壓,約0.3V(Large Hysteresis, Typ. 0.3 Volts)
˙快速的輸出電壓轉換(Fast Output Transitions)
˙輸出準位誤差5V±10%( Accuracy ± 5 - 10%)
˙較多的組合元件線路(High Component Count)
˙Reset時間較長(Long Response Time against VCC)
圖二(Figure 2): 低消耗功率之瞬間掉電偵測線路(Low-power Consumption Brown-out Detector)
VCC(+5V)
Optional Reset Switch
SW1
C51 MCU
R2
1.3M
Crst
1uF
2N2906
Q1
2N2906
Q2
R3
1.5M
C3
0.1u
R1
4.7M
C1
0.1u
C2
0.1u
Q3
2N2904
VCC
Rrst
1K
RST Pin
R5
100K
R4
150K
VSS
注意事項(Notes):
1.
如果要自行調整檢測電壓,使用者可以自行調整R2的阻值,R2越大,檢測電壓越低, R2越小,則檢測電壓越高.
2.
依照圖二的參數所設計之線路,其檢測電壓在2.2V.
1.
If user want to adjust low VCC detect voltage. You just to adjust R2 resistance. R2 and Vlvd are an
inverse proportion.
2.
If you want to set Vlvd equal to 2.2V, please to refer figure 2.
圖三(Figure 3) : VCC與RST波型比較圖(Oscilloscope Plots Show how the Voltage on RST Varies with VCC)
4
SyncMOS FAE 2004/02