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.
使用 FEE 模块的时候遇到了下面的问题
在正确读取和写入 FEE 数据512次之后、读取的数据始终为0。
我的程序如下、运行周期为50ms。
/ /
/***** 此函数的调用周期为50mS***** /
void testFee (void)
{
Uint8 feeWriteBuffer[8]={0};
Uint8 feeReadBuffer[8]={0};
静态 uint16 looptime=0u;
Uint8 i=0u;
looptime++;
对于(i = 0;i < 8u;++i)
{
feeWriteBuffer[i]=(looptime&0xff);
}
printf ("\r\n\r\n 循环时间=%d"、循环时间);
TI_EVENT(0x01U,&feeWriteBuffer[0] Fee_Write);
printLog ("\r\n 写入费用:"、&feeWriteBuffer[0]、8U);
TI_ReadBuffer[0] Fee_Read (TI_451U、0、&feeReadBuffer[0]、8U);
printLog ("\r\n 读取费用:"、&feeReadBuffer[0]、8U);
}
/ /
对数 如下所示。
循环时间=510
写入费用: Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe 菲-菲-菲
阅读费用: Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe Fe 菲-菲-菲
循环时间=511
写入费用:自动终止 FF ff (FF)
阅读费用: 00 00 00 00 00 00 00 00 00
循环时间=512
写入费用: 00 00 00 00 00 00 00 00 00
阅读费用: 00 00 00 00 00 00 00 00 00
循环时间=513
写入费用:01 01 01 01 01 01 01
尊敬的 David:
感谢您联系 TI 寻求支持。
我已经开始处理您的问题、需要对这个问题进行调试。 我会尽快提供更新。
--
谢谢。此致、
Jagadish。
尊敬的 David:
今天我有机会测试这个问题、你说得对、我最终也能看到相同的问题。
我还注意到、这个问题发生在一个扇区的数据已满(16KB)并且尝试将数据移动到新扇区之后。 此问题在此边界条件下发生。
我还注意到、如果我使用异步读取和写入函数、则不会触发这个问题、我们使用同步函数时会发生问题。
void testFee(void) { uint8 feeWriteBuffer[8]= {0}; uint8 feeReadBuffer[8]= {0}; static uint16 looptime=0U; uint8 i=0U; looptime++; for (i = 0; i < 8U; ++i) { feeWriteBuffer[i]=(looptime&0xff); } printf("\r\nlooptime=%d",looptime); TI_Fee_WriteAsync(0x01U,&feeWriteBuffer[0]); do { TI_Fee_MainFunction(); delay(); Status=TI_Fee_GetStatus(0); } while(Status!=IDLE); printf("\r\nwrite fee:"); for (i=0; i<8; i++) { printf ("%x\t", feeWriteBuffer[i]); } TI_Fee_Read(0x01U,0,&feeReadBuffer[0],8U); do { TI_Fee_MainFunction(); delay(); Status=TI_Fee_GetStatus(0); } while(Status!=IDLE); printf("\r\nread fee:"); for (i=0; i<8; i++) { printf ("%x\t", feeReadBuffer[i]); } }
您能用上面的代码测试一下、并告诉我结果和平均值、同时我将在最后对这种行为进行进一步分析吗?
--
谢谢。此致、
Jagadish。
Jagadish、您好!
感谢您的 快速响应。 我在末端测试这种方法。 得到的结果如下。
写入费用:01 01 01 01 01 01 01
01 阅读费用:00 00 00 00 02 C6 a0 读取费数据操作有无法解释的数据,这就是为什么我采用同步读写函数。 很高兴、我尝试了另一种方法、得到了正确的结果。 void testFee (void) { Uint8 feeWriteBuffer[8]={0}; Uint8 feeReadBuffer[8]={0}; 静态 uint16 looptime=0u; Uint8 i=0u; UINT16状态= 0; looptime++; 对于(i = 0;i < 8u;++i) { feeWriteBuffer[i]=(looptime&0xff); } printf ("\r\n\r\n 循环时间=%d"、循环时间); TI_EVENT(0x01U,&feeWriteBuffer[0] Fee_Write); printLog ("\r\n 写入费用:"、&feeWriteBuffer[0]、8U); 正确 { TI_45V Fee_Main (); FeeDelay (); status=TI_SC70 Fee_Get (0); } while (Status!=idle); TI_ReadBuffer[0] Fee_Read (TI_451U、0、&feeReadBuffer[0]、8U); printLog ("\r\n 读取费用:"、&feeReadBuffer[0]、8U); } 但我不知道差异的原因。 谢谢。此致、 大卫。
尊敬的 David:
很高兴,我尝试了另一种方法,得到了正确的结果。
那么、您上面创建的代码是否不会产生任何问题?
看起来您 Fee_Write 也在为"TI_44c"调用"TI_44c" Fee_Main 函数。
且不带 Fee_Main 54"的"TI_TI_schion" Fee_Read。
--
谢谢。此致、
Jagadish。