![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_486.png)
462
CHAPTER 16 8/10-BIT A/D CONVERTER
MB90560 series
---------
CODE
START:
CSEG
;
Assumes that the stack pointer (SP) has already
been initialized.
Disables interrupts.
Interrupt level: 0 (highest priority).
Sets the address to which conversion data is stored.
(Uses 600H to 617H.)
AND
MOV
MOV
MOV
MOV
MOV
CCR,#0BFH
ICR00,#08H
BAPL,#00H
BAPM,#06H
BAPH,#00H
ISCS,#19H
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Transfers word data, adds 1 to the address,
transfers from I/O to memory, then ends by a
resource request.
Sets the address of the analog data register as the
transfer source address pointer.
Transfers only channel 3 twelve times by EI2OS
Sets P50 to P57 as input.
Sets P53/AN3 as analog input.
Stop conversion mode. Converts AN3 CH.
Activates the 16-bit timer, starts A/D conversion, and
enables interrupts.
Sets the timer value to 800 (320h), 100 μs.
Sets the clock source to 125 ns and disables
external trigger.
Disables timer output, disables interrupts, and
enables reload.
Activates the 16-bit timer.
Sets ILM in PS to level 7.
Enables interrupts.
Endless loop
MOV
MOV
MOV
MOV
MOV
MOV
MOV
IOAL,#36H
IOAH,#00H
DCTL,#0CH
DDR5,#00000000B
ADER,#00001000B
ADCS0,#0DBH
ADCS1,#0A8H
MOVW
MOV
TMRLR1,#0320H
TMCRH1,#00H
;
;
MOV
TMCRL1,#12H
;
MOV
MOV
OR
MOV
MOV
BRA
TMCRL1,#13H
ILM,#07H
CCR,#40H
A,#00H
A,#01H
LOOP
;
;
;
;
LOOP:
;-------Interrupt program----------------------------------------------------------------------------------------------------------
ED_INT1:
MOV
I:ADCS1,#80H
;
Does not stop A/D conversion. Clears and disables
the interrupt flag.
RETI
;
Returns from interrupt.
CODE
ENDS
;-------Vector setting----------------------------------------------------------------------------------------------------------------
VECT
CSEG
ABS=0FFH
ORG
0FFD0H
;
Sets vector for interrupt #11 (0BH).
DSL
ED_INT1
ORG
0FFDCH
;
Sets reset vector.
DSL
START
DB
00H
;
Sets single-chip mode.
VECT
ENDS
END
START