![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_481.png)
MB90560 series
CHAPTER 16 8/10-BIT A/D CONVERTER
457
;-------Main program---------------------------------------------------------------------------------------------------------------
CODE
CSEG
START:
;
Assumes that the stack pointer (SP) has already
been initialized.
AND
CCR,#0BFH
;
Disables interrupts.
MOV
ICR00,#00H
;
Interrupt level: 0 (highest priority)
MOV
BAPL,#00H
;
Sets the address to which the conversion data is
transferred and stored.
MOV
BAPM,#02H
;
(Uses 200H to 205H.)
MOV
BAPH,#00H
;
MOV
ISCS,#18H
;
Transfers word data, adds 1 to the address, then
transfers the data from I/O to memory.
MOV
;
Sets the address of the analog data register as the
MOV
IOAH,#00H
;
transfer source address pointer.
MOV
DCTL,#03H
;
Sets the EI2OS transfer count to three, which is the
same value as the conversion count.
MOV
DDR5,#11110001B
;
Sets P51 to P53 as input.
MOV
ADER,#00001110B
;
Sets P51/AN1 to P53/AN3 as analog inputs.
MOV
CTH,#00H
;
MOV
ADCS0,#0BH
;
Single activation. Converts AN1 to AN3.
MOV
ADCS1,#0A2H
;
Software activation. Begins A/D conversion.
Enables interrupts.
MOV
ILM,#07H
;
Sets ILM in PS to level 7.
OR
CCR,#40H
;
Enables interrupts.
LOOP:
MOV
A,#00H
;
Endless loop
MOV
A,#01H
BRA
LOOP
;-------Interrupt program----------------------------------------------------------------------------------------------------------
ED_INT1:
MOV
I:ADCS1,#00H
;
Stops 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 #31 (1FH)
DSL
ED_INT1
ORG
0FFDCH
;
Sets reset vector.
DSL
START
DB
00H
;
Sets single-chip mode.
VECT
ENDS
END
START