我是用的是TMS320F2808开发板,软件是CCS3.3,用的研旭的LED闪烁例程,直接下载到RAM里仿真是没问题的,然后按照教程替换cmd文件,烧写到Flash里,led就不闪烁了,只亮第一盏,不知道到底是什么问题,代码如下:
#include "DSP280x_Device.h" // DSP280x Headerfile Include File
#include "DSP280x_Examples.h" // DSP280x Examples Include File
// Select the example to compile in. Only one example should be set as 1
// the rest should be set as 0.
#define led1 GpioDataRegs.GPADAT.bit.GPIO0
#define led2 GpioDataRegs.GPADAT.bit.GPIO1
#define led3 GpioDataRegs.GPADAT.bit.GPIO2
#define led4 GpioDataRegs.GPADAT.bit.GPIO3
#define led5 GpioDataRegs.GPADAT.bit.GPIO4
#define led6 GpioDataRegs.GPADAT.bit.GPIO5
#define led7 GpioDataRegs.GPADAT.bit.GPIO6
#define led8 GpioDataRegs.GPADAT.bit.GPIO7
void Gpio_init(void);
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP280x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP280x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); Skipped for this example
// 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 DSP280x_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 DSP280x_DefaultIsr.c.
// This function is found in DSP280x_PieVect.c.
InitPieVectTable();
Gpio_init();
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP280x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
// Step 5. User specific code:
led1=1;
DELAY_US(500);
led2=1;
DELAY_US(500);
led3=1;
DELAY_US(500);
led4=1;
DELAY_US(500);
led5=1;
DELAY_US(500);
led6=1;
DELAY_US(500);
led7=1;
DELAY_US(500);
led8=1;
DELAY_US(500);
while(1)
{
led1=~led1;
led2=~led2;
led3=~led3;
led4=~led4;
led5=~led5;
led6=~led6;
led7=~led7;
led8=~led8;
DELAY_US(80000);
}
}
void Gpio_init(void)
{
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; // Enable pullup on GPIO0
GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0; // Enable pullup on GPIO1
GpioCtrlRegs.GPAPUD.bit.GPIO2 = 0; // Enable pullup on GPIO2
GpioCtrlRegs.GPAPUD.bit.GPIO3 = 0; // Enable pullup on GPIO3
GpioCtrlRegs.GPAPUD.bit.GPIO4 = 0; // Enable pullup on GPIO4
GpioCtrlRegs.GPAPUD.bit.GPIO5 = 0; // Enable pullup on GPIO5
GpioCtrlRegs.GPAPUD.bit.GPIO6 = 0; // Enable pullup on GPIO6
GpioCtrlRegs.GPAPUD.bit.GPIO7 = 0; // Enable pullup on GPIO7
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; // GPIO0
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0; // GPIO1
GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 0; // GPIO2
GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 0; // GPIO3
GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 0; // GPIO4
GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 0; // GPIO5
GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0; // GPIO6
GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 0; // GPIO7
GpioCtrlRegs.GPADIR.bit.GPIO0 = 1; //output gpio0
GpioCtrlRegs.GPADIR.bit.GPIO1 = 1; //output gpio1
GpioCtrlRegs.GPADIR.bit.GPIO2 = 1; //output gpio2
GpioCtrlRegs.GPADIR.bit.GPIO3 = 1; //output gpio3
GpioCtrlRegs.GPADIR.bit.GPIO4 = 1; //output gpio4
GpioCtrlRegs.GPADIR.bit.GPIO5 = 1; //output gpio5
GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; //output gpio6
GpioCtrlRegs.GPADIR.bit.GPIO7 = 1; //output gpio7
EDIS;
}