uint16_t dma_temp_A[8] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8};
uint16_t dma_temp_B[8] = {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8};
int main (void)
{
uint16_t i = 0;
WDTCTL = WDTPW + WDTHOLD;
// 传输4个word
// 源地址为dma_temp_A
// 目标地址为dma_temp_B
DMA0SZ = 4;
DMA0SA = dma_temp_A;
DMA0DA = dma_temp_B;
// 采用Single transfer模式,源地址和目标地址都递增
DMA0CTL = DMADT_0 + DMADSTINCR_3 + DMASRCINCR_3;
DMA0CTL |= DMAEN;
for (i = 0; i < 4; i++)
DMA0CTL |= DMAREQ;
while (1);
return 0;
} |