cc2430 DMA设置
typedef __xdata struct
{
unsigned char SRCADDRH; //源地址高8位
unsigned char SRCADDRL; //源地址低8位
unsigned char DESTADDRH; //目的地址高8位
unsigned char DESTADDRL; //目的地址低8位
unsigned char VLEN :3; //长度域模式选择
unsigned char LENH :5; //传输长度高字节
unsigned char LENL :8; //传输长度低字节
unsigned char WORDSIZE :1; //字节(byte)或字(word)传输
unsigned char TMODE :2; //传输模式选择
unsigned char TRIG :5; //触发事件选择
unsigned char SRCINC :2; //源地址增量:-1/0/1/2
unsigned char DESTINC :2; //目的地址增量:-1/0/1/2
unsigned char IRQMASK :1; //中断屏蔽
unsigned char M8 :1; //7或8bit传输长度,仅在字节传输模式下适用
unsigned char PRIORITY :2; //优先级
}DMA_CFG;
//实验说明:将字符数组sourceString的内容通过DMA传输到字符数组destString中,转换结果通过串口显示到PC上。
void main(void)//
{
DMA_CFG dmaConfig; //定义配置结构体
unsigned char sourceString[]="I'm the sourceString!\r\n"; //源字符串
unsigned char destString[sizeof(sourceString)]="I'm the destString!\r\n"; //目的字符串
InitLed();
initUARTtest();
UartTX_Send_String(sourceString); //传输前的原字符数组
UartTX_Send_String(destString); //传输前的目的字符数组
//配置DMA结构体
dmaConfig.SRCADDRH=(unsigned char)((unsigned short int)&sourceString >> 8); //源地址
dmaConfig.SRCADDRL=(unsigned char)((unsigned short int)&sourceString);
dmaConfig.DESTADDRH=(unsigned char)((unsigned short int)&destString >> 8); //目的地址
dmaConfig.DESTADDRL=(unsigned char)((unsigned short int)&destString);
dmaConfig.VLEN=0x00; //选择LEN作为传送长度
dmaConfig.LENH=(unsigned char)((unsigned short int)sizeof(sourceString) >> 8); //传输长度
dmaConfig.LENL=(unsigned char)((unsigned short int)sizeof(sourceString));
dmaConfig.WORDSIZE=0x00; //选择字节(byte)传送
dmaConfig.TMODE=0x01; //选择块传送(block)模式
dmaConfig.TRIG=0; //无触发(可以理解为手动触发)
dmaConfig.SRCINC=0x01; //源地址增量为1
dmaConfig.DESTINC=0x01; //目的地址增量为1
dmaConfig.IRQMASK=0; //DMA中断屏蔽
dmaConfig.M8=0x00; //选择8位长的字节来传送数据
dmaConfig.PRIORITY=0x02; //传输优先级为高
DMA0CFGH=(unsigned char)((unsigned short int)&dmaConfig >> 8); //将配置结构体的首地址赋予相关SFR
DMA0CFGL=(unsigned char)((unsigned short int)&dmaConfig);
DMAARM=0x01; //启用配置 使DMA进入工作状态
DMAIRQ=0x01; //清中断标志
DMAREQ=0x01; //启动DMA传输
while(!(DMAIRQ&0x01)); //等待传输结束
}阻塞到 while(!(DMAIRQ&0x01)); 请求高手讲解
[解决办法]
帮忙顶起来。