![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_483.png)
MB90560 series
CHAPTER 16 8/10-BIT A/D CONVERTER
459
TMCRH1 EQU
RLDRL1
RLDRH1
;-------Main program------------------------------------------------------------------------------------------------
---------
CODE
CSEG
START:
;
000087H
000088H
000089H
;
;16-bit reload register
;
EQU
EQU
Assumes that the stack pointer (SP) has already
been initialized.
Disables interrupts.
Interrupt level; 0 (highest priority). Enables
interrupts.
Sets the address to which conversion data is stored.
(Uses 600H to 60BH.)
AND
MOV
CCR,#0BFH
ICR10,#08H
;
;
MOV
MOV
MOV
MOV
BAPL,#00H
BAPM,#06H
BAPH,#00H
ISCS,#18H
;
;
;
;
;
;
;
;
Transfers word data, adds 1 to the address, then
transfers from I/O to memory.
Sets the address of the analog data register as the
transfer source address pointer.
Six transfers by EI2OS (two transfers each for three
channels)
Sets P50 to P57 as input.
Sets P53/AN3 to P55/AN5 as analog input.
MOV
MOV
MOV
IOAL,#36H
IOAH,#00H
DCTL,#06H
MOV
MOV
MOV
MOV
DDR5,#00000000B
ADER,#00111000B
DCTH,#00H
ADCS0,#9DH
;
;
;
;
Continuous conversion mode. Converts AN3 to AN5
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
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----------------------------------------------------------------------------------------------------------------