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.

TMS320F28379D: long型数值错误

Part Number: TMS320F28379D

当我在28377D和28379D上使用long型数值时,数值经常会变成其16位的负数。然而,long型本是32位数值。一般来说,这种出错在数值较小时更容易发生。我买了很多板,这不是单一板的孤立问题。我做了个简单例子来说明我的问题:根据我的code,a的value本应该在-1和1之间来回跳动。但他却经常变为65535和-65535。这样的出错严重影响了我的使用,请TI的工程师予以协助解答,非常感谢!

代码如下:


#include "F28x_Project.h" // Device Headerfile and Examples Include File
#include "F2837xD_Ipc_drivers.h"

long a = 1;
long b= -1;
long c = 1;

void main(void)
{
InitSysCtrl();
#ifdef _STANDALONE
#ifdef _FLASH
// Send boot command to allow the CPU2 application to begin execution
IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
#else
/*
IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
*/
#endif
#endif
#ifdef _FLASH
InitFlash();
#endif

InitGpio(); // Skipped for this example
DINT;
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
while(1)
{
if(a == 1)
{
a = b;
}
DELAY_US(1000);
if(a == -1)
{
a = c;
}
DELAY_US(1000);
}

}