SNAD02C
8-CHANNEL 10-BIT ADC
;; Inherit from program 1
;; Enter Power-down Mode (0)
CheckBattery:
@Set_Control_Reg
@Set_Attrib
#0, #1, #1, #0
;; Set rf=1, turn-on bandgap
;; Switch Ch7 to Analog
#1, #1, #1, #0, #0, #0, #1, #1
mov
m15
#0
CheckAgain:
@Read_ADC
#1, #1, #1
#1000b
;; Read Ch7
mov
a
a
and
ad_out_h
caje
#1000b Battery_Low_No
;; if (Value>=128) then Not Battery Low
mov
a
m15
inca
mov
m15
#3
a
caje
jmp
Battery_Low_Yes
;; if (Value<128) for 3 times, then
;; battery low.
CheckAgain
Battery_Low_Yes:
mov
m14
#1
Battery_Low_No:
@Set_Control_Reg
@Set_Attrib
#0, #1, #0, #0
;; Set rf=0, turn-off bandgap
#0, #1, #1, #0, #0, #0, #1, #1;; Switch Ch7 to Digital
;; To save operating current
Version: 1.3
July 31, 2003
25