ตัวอย่างของวิธีการใช้ the DMA burst feature
ในตัวอย่างนี้ the timer DMA burst feature ถูกใช้เพื่ออัปเดตสิ่งที่อยู่ภายในของ the CCRx registers (x = 2, 3, 4) ด้วย the DMA transferring half words ลงใน the CCRx registers นี้ถูกทำในขั้นตอนต่อไปนี้:
1. กำหนดค่า the corresponding DMA channel ดังต่อไปนี้:
– DMA channel peripheral address คือ the DMAR register address
– DMA channel memory address คือ the address ของ the buffer ใน the RAM บรรจุ the data ที่จะถูกส่งถ่ายโดย DMA
ลงใน CCRx registers.
– จำนวนของ data ที่จะ transfer = 3 (ดู note ข้างล่าง).
– Circular mode ถูกปิดการใช้งาน.
2. กำหนดค่า the DCR register โดยการกำหนดค่า the DBA และ DBL bit fields ดังต่อไปนี้: DBL = 3 transfers, DBA = 0xE.
3. เปิดการใช้งาน the TIMx update DMA request (เซ็ต the UDE bit ใน the DIER register).
4. เปิดการใช้งาน TIMx
5. เปิดการใช้งาน the DMA channel
Note: ตัวอย่างนี้สำหรับกรณีที่ทุก CCRx register ถูกอัปเดตหนึ่งครั้ง. ถ้าทุก CCRx register ต้องถูกอัปเดตสองครั้ง ตัวอย่างเช่น,
จำนวนของ data ที่จะ transfer ควรเป็น 6. ลองยกตัวอย่างของ a buffer ใน the RAM บรรจุ data1, data2, data3, data4,
data5 และ data6. The data ถูกส่งถ่ายถึง the CCRx registers ดังต่อไปนี้: บน the first update DMA request, data1
ถูกส่งถ่ายถึง CCR2, data2 ถูกส่งถ่ายถึง CCR3, data3 ถูกส่งถ่ายถึง CCR4 และบน the second update DMA request,
data4 ถูกส่งถ่ายถึง CCR2, data5 ถูกส่งถ่ายถึง CCR3 และ data6 ถูกส่งถ่ายถึง CCR4.