28335芯片main函数5部走,GPIO配置例子

随便打开一个TI的例子(controlSUITE软件),在它的main函数里都可以看到以下5部:直接copy

// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
   InitSysCtrl();
系统初始化,上两篇文章已经说过了

// Step 2. Initialize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
   // InitGpio(); Skipped for this example
对要用到的管脚进行配置,在GPIO例子中,直接跳过,但是在main函数后边对管脚进行配置。一般最简单的例子是就是点亮LED就会了

// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
   DINT;
汇编语言,清中断

// Initialize 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();
初始化PIE向量,以后研究

// Disable CPU interrupts and clear all CPU interrupt flags:
   IER = 0x0000;
   IFR = 0x0000;
清CPU中断,清CPU中断标志位

// 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();

初始化PIE向量表,PIE是个什么东西?


// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP2833x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
初始化外设

// Step 5. User specific code:

写自己的代码


TI这样做,我们就学,一般5步直接抄就行。需要改的跳到相应的文件去去改。这样的话,现在就是研究一下GPIO的配置方法,然后点灯,跑灯。

你可能感兴趣的:(28335芯片main函数5部走,GPIO配置例子)