SNAD02C
8-CHANNEL 10-BIT ADC
@@:
;;***************************************
@Clock
@OFF_START
endm
;; SET START=1
;;***************************************
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:
;; Wakeup:
;;
B
X
A
X
A
X
D
D
D
A
A
X
:B, battery detect
NO YES YES X
SNC520
program
include def.h
START:
mov
a
#1111b
mov
p2s
a
a
mov
#0000b
a
mov
p2
mov
p2State #0
@Set_Control_Reg
@Set_Attrib
#0, #1, #0, #1
;; Set Control Registers
;; Set Chan Analog/Digital
;; Setup Wakeup function
#0, #1, #1, #0, #0, #0, #1, #1
#0, #0, #0, #0, #1, #1, #0, #0
@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
July 31, 2003
23