芯片为28069.我在一个例程中看到主函数中没有关于中断函数的配置函数,由于我第一次写中断函数,求教如何编写中断函数,实现的是dma传输数据。求教,要编写头文件和.c文件,最好能给我个例子。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
芯片为28069.我在一个例程中看到主函数中没有关于中断函数的配置函数,由于我第一次写中断函数,求教如何编写中断函数,实现的是dma传输数据。求教,要编写头文件和.c文件,最好能给我个例子。
如controlsuite中的例程dma_ram_to_ram,其中就有DMA中断,不过中断函数中没有执行其他内容。
使用中断主要是以下三点:
1.初始化中中断向量表配置好中断函数入口
EALLOW; // Allow access to EALLOW protected registers
PieVectTable.DINTCH1= &local_DINTCH1_ISR;
EDIS; // Disable access to EALLOW protected registers
2.初始化中使能所使用的中断
IER = M_INT7 ; //Enable INT7 (7.1 DMA Ch1)
EnableInterrupts();
3.编写中断函数,例程中的函数没有内容,使用时需要注意执行的内容时间不能超出中断时间,否则造成中断的溢出。并且通常是在中断函数的最后清除中断标志位。