Example Of A/D Conversion Program - NEC PD17062 Datasheet

Mos integrated circuit 4-bit single-chip microcontroller containing pll frequency synthesizer and image display controller
Table of Contents

Advertisement

19.6 EXAMPLE OF A/D CONVERSION PROGRAM

The following example shows an A/D conversion program based on the successive comparison method.
The result of conversion is held in the DBF0.
Sample program
DBF0B3 FLG 0.0FH.3
DBF0B2 FLG 0.0FH.2
DBF0B1 FLG 0.0FH.1
DBF0B0 FLG 0.0FH.0
START:
BANK0
INITFLG
DBF0B3, NOT DBF0B2, NOT DBF0B1, NOT DBF0B0 ; Sets DBF data.
PUT
ADCR, DBF
SKT1
ADCCMP
CLR1
DBF0B3
SET1
DBF0B2
PUT
ADCR, DBF
SKT1
ADCCMP
CLR1
DBF0B2
SET1
DBF0B1
PUT
ADCR, DBF
SKT1
ADCCMP
CLR1
DBF0B1
SET1
DBF0B0
PUT
ADCR, DBF
SKT1
ADCCMP
CLR1
DBF0B0
END:
Number of steps in the conversion loop : 17
Conversion time : 34 s (not in DMA mode)
Conversion time : 204 s (in DMA mode)
PD17062
; Sets reference voltage.
; Judges comparison result.
; DBF0B3
0
; DBF0B2
1
; Sets reference voltage.
; Judges comparison result.
; DBF0B2
0
; DBF0B1
1
; Sets reference voltage.
; Judges comparison result.
; DBF0B1
0
; DBF0B0
1
; Sets reference voltage.
; Judges comparison result.
; DBF0B0
0
237

Advertisement

Table of Contents
loading

Table of Contents