贴不了全部源码,增加附件,需要的发信息至njget@163.com 索要,硬件也可以提供!一、主程序
void main(void)
{
InitSysCtrl(); //Initialize System Control in the DSP2833x_SysCtrl.c; PLL, WatchDog, enable Peripheral Clocks
MemCopy(&RamfuncsLoadStart,&RamfuncsLoadEnd,&RamfuncsRunStart);//快速程序拷入RAM
InitFlash(); //Initialize Plash
InitGpio(); //Initalize GPIO in the DSP2833x_Gpio.c
InitXint1();
DINT; //Clear all interrupts and initialize PIE vector table: Disable CPU interrupts
InitPieCtrl(); //Initialize the PIE control registers in the DSP2833x_PieCtrl.c
IER = 0x0000; // Disable CPU interrupts and clear all CPU interrupt flags
IFR = 0x0000;
InitPieVectTable(); // Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR).
// in DSP2833x_PieVect.c
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.SCIRXINTB = &SCIRXINTB_ISR; //装载中断程序入口地址
PieVectTable.EPWM1_INT = &EPWM1_INT_ISR;
PieVectTable.ECAP1_INT = &ECAP1_INT_ISR;
PieVectTable.XINT1 = &XINT1_ISR;
EDIS; // This is needed to disable write to EALLOW protected registers
InitCpuTimers(); // For this example, only initialize the Cpu Timers
InitSpi(); //初始化Spi模块
InitSci(); //初始化Sci模块
InitEPwm(); //初始化EPwm模块
InitECapture(); //初始化ECap模块
InitAdc(); //初始化Adc模块
InitXintf(); //初始化外部接口
InitUserRegs(); //初始化用户自定义寄存器
#if (CPU_FRQ_150MHZ)
ConfigCpuTimer(&CpuTimer0, 150, 1000000);
ConfigCpuTimer(&CpuTimer1, 150, 1000000);
ConfigCpuTimer(&CpuTimer2, 150, 1000000);
#endif
#if (CPU_FRQ_100MHZ)
ConfigCpuTimer(&CpuTimer0, 100, 1000000);
ConfigCpuTimer(&CpuTimer1, 100, 1000000);
ConfigCpuTimer(&CpuTimer2, 100, 1000000);
#endif
CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
CpuTimer1Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
CpuTimer2Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
IER |= M_INT1; //0x0001,
IER |= M_INT3; //0x0004,
IER |= M_INT4; //0x0008,
IER |= M_INT9; //0x0100,
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
PieCtrlRegs.PIEIER1.bit.INTx4 = 1; // PIE Group 1,
PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // PIE Group 3,
PieCtrlRegs.PIEIER4.bit.INTx1 = 1; // PIE Group 4,
PieCtrlRegs.PIEIER9.bit.INTx3 = 1; // PIE Group 9,
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
for(;;)
{
if(SciuserRegs.flagsci.bit.Recv_byt)
{
recvdelt(); //与触摸屏通信
}
|
感谢楼主!