SNAD02C
8-CHANNEL 10-BIT ADC
@@:
;;***************************************
@Clock
@OFF_START
;; SET START=1
endm
;;***************************************
9.1. Program 1: Set Configuration of SNAD02C
;; Setup Configuration of SNAD02C
;;
;; With Pull-Low, use “REF” pin connected external voltage . (PH=0, PL=1, RF=0,MB=1)
;;
;;
CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
;; Analog/Digital: B
A
A D D
D
A
A
:B, battery detect
;; Wakeup:
X
X
X NO YES YES X
X
;;
SNC520
program
include def.h
START:
mov
mov
mov
mov
mov
a
p2s
a
p2
p2State
#1111b
a
#0000b
a
#0
#0, #1, #0, #1
#0, #1, #1, #0, #0, #0, #1, #1
#0, #0, #0, #0, #1, #1, #0, #0
;; Set Control Registers
;; Set Chan Analog/Digital
;; Setup Wakeup function
@Set_Control_Reg
@Set_Attrib
@Set_Wakeup
9.2. Program 2: Read ADC result from Channel 1
;; Inherit from program 1
;; 10-bit ADC result of channel 1 in ( ad_hh,ad_out_h, ad_out_l)
;; ad_hh is bit9~bit8, ad_out_h is bit7~bit4, ad_out_l is bit3~bit0
@Read_ADC
…
…
#0, #0, #1
;;get ADC result from Ch1 in ( ad_hh,ad_out_h, ad_out_l)
9.3. Program 3: Read Digital Input data from Ch4, Ch3, CH2
;; Inherit from program 1
;; After Reading,
;; Port_h.0 = Input of Ch4
;; Port_l.3= Input of Ch3
;; Port_l.2 = Input of Ch2
@Read_Port
…
…
;; 8-bit Data
(port_h, port_l)
Version: 1.3
23
July 31, 2003