App_TweLiteプログラムの変更箇所
(1)追加関数
//!!!!****変更3
void PutAM2321(uint8 *(pu8Dest));
//***変更3
void PutAM2321(uint8 *(pu8Dest))
{
uint8 u8Address;
uint8 u8Length=1;
bool_t bOk = TRUE;
uint8 pu8Data[256];
volatile long x;
long TD;
long HD;
bOk &= bSMBusWrite(0x5C, 0, 0, NULL);
for(x = 0; x < 1600; x++){;}
u8Address=0x03;
u8Length=2;
pu8Data[0]=0x00;
pu8Data[1]=0x04;
bOk &= bSMBusWrite(0x5C, u8Address, u8Length, pu8Data);
for(x = 0; x < 1600; x++){;}
u8Length=8;
bOk &= bSMBusSequentialRead(0x5C, u8Length, pu8Dest);
HD=pu8Dest[2]*256+pu8Dest[3];
vfPrintf(&sSerStream, "Humidity(x0.1%%)=%d\r\n",HD);
TD=pu8Dest[4]*256+pu8Dest[5];
vfPrintf(&sSerStream, "Temperature(x0.1Degree)=%d\r\n",TD);
}
(2)static int16 i16TransmitIoData(bool_t bQuick, bool_t bRegular)の修正
//***変更3
uint8 pu8Dest[256];
pu8Dest[0]=0xAA;
PutAM2321(pu8Dest);
S_OCTET(pu8Dest[2]);
S_OCTET(pu8Dest[3]);
S_OCTET(pu8Dest[4]);
S_OCTET(pu8Dest[5]);
を追加
(3)static void vReceiveIoData(tsRxDataApp *pRx) の修正
//***変更3
uint8 HH = G_OCTET();
uint8 HL = G_OCTET();
uint8 TH = G_OCTET();
uint8 TL = G_OCTET();
//***変更3
long TD;
long HD;
HD=HH*256+HL;
vfPrintf(&sSerStream, "Humidity(x0.1%%)=%d\r\n",HD);
TD=TH*256+TL;
vfPrintf(&sSerStream, "Temperature(x0.1Degree)=%d\r\n",TD);
を追加