TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28379D: long型数值错误

Part Number:TMS320F28379D

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

代码如下:


(function(id)
{
var v = document.getElementById(id);var op = v.style.position, ol = v.style.left, or = v.style.right, fe = [];
var nodeLimit = 50;
checkVideo = function() {
if (!v.canPlayType || v.error) {
var bound = 0;
while (v.childNodes.length > 0 && bound < nodeLimit) {
bound++;
if (v.childNodes[0].nodeName != 'SOURCE') {
v.parentNode.insertBefore(v.childNodes[0], v);
}
}
v.parentNode.removeChild(v);
} else if (v.readyState == 0) {
window.setTimeout(checkVideo, 249);
}
},
checkVideoRendered = function() {
if (v.networkState == 1 && v.readyState == 4) {
v.style.position = op;
v.style.left = ol;
v.style.right = or;
for (var i = 0; i < fe.length; i++) {
fe[i].parentNode.removeChild(fe[i]);
}
} else {
window.setTimeout(checkVideoRendered, 249);
}
}
if (navigator.userAgent.indexOf('iPad') == -1 && navigator.userAgent.indexOf('iPhone') == -1 && navigator.userAgent.indexOf('iPod') == -1) {
window.setTimeout(checkVideo, 249);
}
})('v_7675a9e113044af48b400a8095c541fb');
#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);
}

}

Susan Yang:

请您关注

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000-microcontrollers—internal/f/c2000-microcontrollers—internal-forum/1010465/tms320f280045-calculation-results-abnormal 

以及

https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_C2000_642983

,

user5926996:

我会继续关注这个帖子的。但是您提供的解决方法“”使用unsigned long“”或者“”int“”,这些方法我试验过,确实能一定程度解决,但我目前无法接受,因为我需要用到long型的正负范围,我还要用到IQmath,所以我有必要使用long型而不是其他。

,

Susan Yang:

好的,我们会持续关注这个问题

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28379D: long型数值错误
分享到: 更多 (0)