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.

使用TI函数库中的DELAY_US();问题



当程序运行DELAY_US();函数时就跳到了 No source available for "0x8004" 就没反应了。调用 这个延时函数时需要包含哪些文件,或哪里需要设置啊。

我是初学者,希望专家们多多指点啊!



下面将整个主程序复制上来


#include "DSP28x_Project.h" // DSP28x Headerfile

#include "f2802x_common/include/gpio.h"
#include "f2802x_common/include/clk.h"
#include "f2802x_common/include/wdog.h"


GPIO_Handle myGpio;


// main.c
void main(void)
{


myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));


// Configure GPIO 0-3 as outputs
GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose);
GPIO_setMode(myGpio, GPIO_Number_1, GPIO_0_Mode_GeneralPurpose);
GPIO_setMode(myGpio, GPIO_Number_2, GPIO_0_Mode_GeneralPurpose);
GPIO_setMode(myGpio, GPIO_Number_3, GPIO_0_Mode_GeneralPurpose);

GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output);
GPIO_setDirection(myGpio, GPIO_Number_1, GPIO_Direction_Output);
GPIO_setDirection(myGpio, GPIO_Number_2, GPIO_Direction_Output);
GPIO_setDirection(myGpio, GPIO_Number_3, GPIO_Direction_Output);


while(1)
{
GPIO_setHigh(myGpio, GPIO_Number_0);
GPIO_setHigh(myGpio, GPIO_Number_1);
GPIO_setHigh(myGpio, GPIO_Number_2);
GPIO_setLow(myGpio, GPIO_Number_3);
// DELAY_US(500000);

GPIO_setHigh(myGpio, GPIO_Number_0);
GPIO_setHigh(myGpio, GPIO_Number_1);
GPIO_setLow(myGpio, GPIO_Number_2);
GPIO_setHigh(myGpio, GPIO_Number_3);
// DELAY_US(500000);

GPIO_setHigh(myGpio, GPIO_Number_0);
GPIO_setLow(myGpio, GPIO_Number_1);
GPIO_setHigh(myGpio, GPIO_Number_2);
GPIO_setHigh(myGpio, GPIO_Number_3);
// DELAY_US(500000);

GPIO_setLow(myGpio, GPIO_Number_0);
GPIO_setHigh(myGpio, GPIO_Number_1);
GPIO_setHigh(myGpio, GPIO_Number_2);
GPIO_setHigh(myGpio, GPIO_Number_3);
// DELAY_US(5000000);
}



}


  • 楼主程序是跑在FLASH 中还是RAM中?如果是跑在FLASH中的话,要调用以下函数,将DELAY_US();函数搬到RAM里运行,否则PC跳到RAM里去执行DELAY_US()时,由于你没有把DELAY_US()搬到RAM里,因此相当于PC跑飞掉(现象和你描述的一样)。

    // Copy time critical code and Flash setup code to RAM

    // This includes the following ISR functions: EPwm1_timer_isr(), EPwm2_timer_isr()

    // EPwm3_timer_isr and and InitFlash();

    // The  RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart

    // symbols are created by the linker. Refer to the F2808.cmd file.

      MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

    // Call Flash Initialization to setup flash waitstates

    // This function must reside in RAM

      InitFlash();

  • 谢谢你的回答

    我把你的复制到我的主程序中报错了

    将你给的二个函数在初始化后面

    还请教一个问题,我用CCS5使用F28027  请问怎么样将程序烧到flash或RAM里面运行啊?????、

    我用的是TI例子中f2802x_headers\cmd文件夹中CMD文件,建工程时出现的CMD那个文件会报错

    能不能给个详细点的资料啊!!!!