305
CHAPTER 18 8/10-BIT A/D CONVERTER
●
Coding example
BAPL EQU 000100H ;Lower buffer address pointer
BAPM EQU 000101H ;Middle buffer address pointer
BAPH EQU 000102H ;Upper buffer address pointer
ISCS EQU 000103H ;EI
2
OS status register
IOAL EQU 000104H ;Lower I/O address register
IOAH EQU 000105H ;Upper I/O address register
DCTL EQU 000106H ;Lower data counter
DCTH EQU 000107H ;Upper data counter
DDR6 EQU 000016H ;Port 6 direction register
ADER0 EQU 00000CH ;Analog input enable register
ICR10 EQU 0000BAH ;Interrupt control register for A/D Converter
ADCS0 EQU 000034H ;A/D control status register
ADCS1 EQU 000035H ;
ADCR0 EQU 000036H ;A/D data register
ADCR1 EQU 000037H ;
TMCSR1L EQU 000068H ;Lower control status register 1
TMCSR1H EQU 000069H ;
TMRL1L EQU 003902H ;16-bit reload register 1
TMRL1H EQU 003903H ;
;-----Main program---------------------------------------------------------------
CODE CSEG
START: ;Assumes that the stack pointer (SP) has already
;been initialized.
AND CCR,#0BFH ;Disables interrupts.
MOV ICR10,#08H ;Interrupt level: 0 (highest priority).Enables EI
2
OS when
;interrupt
MOV BAPL,#00H ;Sets the address to which the conversion data is stored.
MOV BAPM,#06H ;(Uses 600
H
to 60B
H
.)
MOV BAPH,#00H ;
MOV ISCS,#18H ;Transfers word data, adds 1 to the address, then
;transfers from I/O to memory.
MOV IOAL,#36H ;Sets the address of the analog data register as the
MOV IOAH,#00H ;transfer source address pointer.
MOV DCTL,#06H ;Six transfer by EI
2
OS (two transfers each for three
;channels.)
MOV DDR6,#00000000B ;Sets P60 to P67 as input.
MOV ADER0,#00111000B ;Sets P63/AN3 to P65/AN5 as analog input.
MOV DCTH,#00H ;
MOV ADCS0,#9DH ;Continuous conversion mode. Converts AN3 to AN5.
MOV ADCS1,#0A8H ;Activates the 16-bit timer, starts A/D conversion, and
;enables interrupts.
MOVW TMRL1L,#0320H ;Sets the timer value to 800(320
H
),100 s.
MOV TMCSR1H,#00H ;Sets the clock source to 125 ns and disables
;external trigger.
MOV TMCSR1L,#12H ;Disables timer output, disables interrupts, and
;enables reload.
MOV TMCSR1L,#13H ;Activates the 16-bit timer.
MOV ILM,#07H ;Sets ILM in PS to level 7.
OR CCR,#40H ;Enables interrupts.
Содержание MB90390 Series
Страница 2: ......
Страница 4: ......
Страница 17: ...xiii APPENDIX D List of Interrupt Vectors 690 INDEX 695 ...
Страница 18: ...xiv ...
Страница 132: ...104 CHAPTER 5 CLOCKS ...
Страница 152: ...124 CHAPTER 6 CLOCK MODULATOR ...
Страница 210: ...182 CHAPTER 11 TIME BASE TIMER ...
Страница 218: ...190 CHAPTER 12 WATCHDOG TIMER ...
Страница 264: ...236 CHAPTER 14 16 BIT RELOAD TIMER WITH EVENT COUNT FUNCTION ...
Страница 274: ...246 CHAPTER 15 WATCH TIMER ...
Страница 306: ...278 CHAPTER 17 DTP EXTERNAL INTERRUPTS ...
Страница 338: ...310 CHAPTER 18 8 10 BIT A D CONVERTER ...
Страница 364: ...336 CHAPTER 19 UART0 UART1 ...
Страница 398: ...370 CHAPTER 20 UART2 UART3 Figure 20 5 2 ORE Set Timing Receive data RDRF ORE ...
Страница 432: ...404 CHAPTER 20 UART2 UART3 ...
Страница 482: ...454 CHAPTER 22 SERIAL I O ...
Страница 560: ...532 CHAPTER 24 STEPPING MOTOR CONTROLLER ...
Страница 582: ...554 CHAPTER 27 ROM MIRRORING MODULE ...
Страница 632: ...604 CHAPTER 29 EXAMPLES OF SERIAL PROGRAMMING CONNECTION ...
Страница 722: ...694 APPENDIX ...
Страница 723: ...695 INDEX The index follows on the next page This is listed in alphabetic order ...
Страница 740: ......