📄 msp430xg46x_dma_01.c
字号:
//******************************************************************************
// MSP430xG461x Demo - DMA0, Repeated Burst to-from RAM, Software Trigger
//
// Description: A 16 word block from 1400-141fh is transfered to 1420h-143fh
// using DMA0 in a burst block using software DMAREQ trigger.
// After each transfer, source, destination and DMA size are
// reset to inital software setting because DMA transfer mode 5 is used.
// P5.1 is toggled durring DMA transfer only for demonstration purposes.
// ** RAM location 0x1400 - 0x143f used - make sure no compiler conflict **
// ACLK = 32kHz, MCLK = SMCLK = default DCO 1048576Hz
//
// MSP430xG461x
// -----------------
// /|\| XIN|-
// | | | 32kHz
// --|RST XOUT|-
// | |
// | P5.1|-->LED
//
// A. Dannenberg/ M. Mitchell
// Texas Instruments Inc.
// October 2006
// Built with IAR Embedded Workbench Version: 3.41A
//******************************************************************************
#include "msp430xG46x.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P5DIR |= 0x002; // P1.0 output
DMA0SA = 0x1400; // Start block address
DMA0DA = 0x1420; // Destination block address
DMA0SZ = 0x0010; // Block size
DMA0CTL = DMADT_5 + DMASRCINCR_3 + DMADSTINCR_3 + DMAEN; // Rpt, inc
DMA0CTL |= DMAEN; // Enable DMA0
while(1)
{
P5OUT |= 0x02; // P5.1 = 1, LED on
DMA0CTL |= DMAREQ; // Trigger block transfer
P5OUT &= ~0x02; // P5.1 = 0, LED off
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -