EasyManua.ls Logo

Samsung S3F84B8 - Page 258

Samsung S3F84B8
322 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
S3F84B8_UM_REV 1.00 13 A/D CONVERTER
13-6
Example 13-1 Configuring A/D Converter
;-----------------<< Interrupt Vector Address >>
VECTOR F0H, INT_ADC ;
;--------------<< Smart Option >>
ORG 003CH
DB 0FFH ; 003CH, must be initialized to 1
DB 0FFH ; 003DH, must be initialized to 1
DB 0FFH ; 003EH, must be initialized to 1
DB 0FFH ; 003FH, disables LVR and internal RC oscillator
ORG 0100H
RESET: DI ; Disables interrupt
LD BTCON,#10100011B ; Disables Watchdog
LD P2CONH,#11111111B ; Configures P2.4–P2.7 AD input
LD P2CONL,#11111111B ; Configures P2.0–P2.3 AD input
EI ; Enables interrupt
;--------------<< Main loop >>
MAIN:
JR t, MAIN
AD_CONV: LD ADCON, #00110001B ; Selects analog input channel P2.1
; Enables ADC interrupt
; Selects conversion speed f
OSC
/8
; Sets conversion start bit
NOP
; If you set conversion speed to f
OSC
/8
; at least one NOP must be included
INT_ADC:
LD R2, ADDATAH ;
LD R3, ADDATAL ;
AND ADCON, #11110111B ; Clears pending bit
;
IRET ;
END

Table of Contents

Other manuals for Samsung S3F84B8

Related product manuals