DSP

28335入门总结(1)

2019-07-13 11:06发布

这个时候回过头来看整个DSP的程序框架已经很清晰了,对于工程项目中哪些文件需要哪些文件不需要也不会那么迷惘。再次惠顾一下main函数及整个程序框架:.h类型的头文件:对每个寄存器的地址进行声明,因为我们编写程序的时候不想写成0X0056(寄存器地址)=0x0001(数据);这样太不方便。
2、下面的文件作用:这是TI为我们搭建好的平台框架。要了解它我们从main函数去看:
在main函数里边第一步InitSysCtrl()系统初始化,该函数就在DSP2833x_SysCtrl.c,可以根据自己的需要关开相应的时钟。第二步:InitGpio()在DSP2833x_Gpio.c中,可以根据自己需要更改相应的GPIO管脚属性;第三步:中断相关:// Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the DSP2833x_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in DSP2833x_DefaultIsr.c. // This function is found in DSP2833x_PieVect.c. InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.ECAP1_INT = &ecap1_isr; EDIS; // This is needed to disable write to EALLOW protected register第四步:初始化外设:但是DSP2833x_InitPeripherals.c这个文件没有找到,所以要用到的外设只能逐个初始化。// Step 4. Initialize all the Device Peripherals: // This function is found in DSP2833x_InitPeripherals.c // InitPeripherals(); // Not required for this example InitEPwmTimer(); // For this example, only initialize the ePWM Timers InitECapture();外设的初始化函数在相应的文件中有写好的初始化函数,可以直接调用。所以可以看到以上的文件的作用。