BAT32G1x9 user manual | Chapter 24 Enhanced DMA
1034 / 1149
Rev.1.02
(1) Example 1 of the use of repeat mode: Use the stepper motor of the port to control the pulse output
The DMA is initiated using the Timer4's Channel 0 Interval Timer feature, and the pattern of the motor
control pulse saved in the code flash memory is transmitted to the universal port.
•
Vector addresses are assigned at 20000013H, and control data is assigned at
20000170H~2000017FH.
• Transfer 8 bytes of code flash memory from 02000H to 02007H to port register 1 (40040301H).
•
Disable repeat mode interrupts.
Figure 24-21 repeat mode example 1: Using the stepper motor of the port to control the pulse output
internal handling automatically executed by DMA
DMABAR=20000000H
vector address (200000013H)=13H
DMACR19(20000170H)=0003H
DMBLS19(20000172H)=0008H
DMACT19(20000174H)=0008H
DMSAR19(20000178H)=2000H
DMDAR19(2000017CH)=40040301H
DMAEN2=08H
configure Timer
Timer channel 0 count completion
interrupt?
data tarnsmit
data tarnsmit
Yes
port register 1
program
flash
2000H
2007H
configure P10~P13 as output mode
Start Timer operation
DMACT19=01H
?
Yes
No
No
DMACT19=DMRLD19
P13
P12
P11
P10
To stop the output, bit3 of DMAEN2 must be cleared after stopping the operation of the timer.