/******************************************************************************* *?Function?Name??:?PowerMonitor *?Description????:?電源監(jiān)控 *?Input??????????:?s:?? ????????????????????ENABLE??-?打開此功能??? ????????????????????DISABLE?-?關(guān)閉此功能 *?Return?????????:?None *******************************************************************************/ void?PowerMonitor(?UINT8?s?) { ????if(?s?==?DISABLE?) ????{ ????????R8_SAFE_ACCESS_SIG?=?SAFE_ACCESS_SIG1; ????????R8_SAFE_ACCESS_SIG?=?SAFE_ACCESS_SIG2; ????????R8_BAT_DET_CTRL?=?0; ????????R8_SAFE_ACCESS_SIG?=?0;? ????} ????else ????{ ????????R8_SAFE_ACCESS_SIG?=?SAFE_ACCESS_SIG1; ????????R8_SAFE_ACCESS_SIG?=?SAFE_ACCESS_SIG2; ????????R8_BAT_DET_CFG?=?1;?????????????????????//?2.05V?-?2.33V ????????R8_BAT_DET_CTRL?=?RB_BAT_DET_EN; ????????R8_SAFE_ACCESS_SIG?=?0;? ????????mDelayuS(1);? ????????R8_SAFE_ACCESS_SIG?=?SAFE_ACCESS_SIG1; ????????R8_SAFE_ACCESS_SIG?=?SAFE_ACCESS_SIG2; ????????R8_BAT_DET_CTRL?=?RB_BAT_LOW_IE|RB_BAT_LOWER_IE|RB_BAT_DET_EN;?? ????????R8_SAFE_ACCESS_SIG?=?0;?? ????}??? }
為什么這個(gè)寄存器R8_BAT_DET_CTRL要設(shè)置兩次,而且第二次的設(shè)置內(nèi)容還有一個(gè)一樣的 ?R8_BAT_DET_CTRL?=?RB_BAT_DET_EN;
R8_BAT_DET_CTRL?=?RB_BAT_LOW_IE|RB_BAT_LOWER_IE|RB_BAT_DET_EN;
開關(guān)兩次寄存器,而不是一次性設(shè)置所有參數(shù)
R8_SAFE_ACCESS_SIG
是為了避免這個(gè)原因嗎:此后約 16 個(gè)系統(tǒng)主頻周期(Tsys)?都處于安全模式下
熱門產(chǎn)品 :
CH182: 以太網(wǎng)PHY收發(fā)器芯片