我有一个类型 为 t_rtnVals 的 union 和一个指针。 在一个状态机中,我对 UNION 进行分配,然后希望将它们推出 UART 。
在这里可以看到几个赋值...val 是 volatile uint8_t、pFram 是 volatile uint16_t
我的问题是在 TX ISR 中、我想将每个半字节移出为显示字符、因此我要执行以下操作: 我不断收到 以下错误:
说明资源路径位置类型
#31表达式必须具有整型
有人能告诉我如何解决这个问题,因为我必须转移到运输每个半字节……有时我将发送4个半字节的块,而其他时间它将是2个半字节的块
if (charToSend)
{
applicationUART.pSysCommsA->UCAxTXBUF = (*(&prtnVals) >> (4*charToSend - 4) & 0x0F);
charToSend--;
}
prtnVals->i2cValues = val[byteSentCntr];
for (no_ConfPts = 0; no_ConfPts < REGISTER_DUMP; no_ConfPts++)
{
prtnVals->memRecall = *(pFRAM + no_ConfPts);
applicationUART.pSysCommsA->UCAxIE |= UCTXIE;
}
union rtnVals
{
uint16_t moisture; //a/d moisture data
uint16_t memRecall; //msp configuration data
uint8_t i2cValues; //C02 sensor data
uint16_t temperature; //a/d temp data
};
union rtnVals t_rtnVals = {0};
union rtnVals *prtnVals = &t_rtnVals;