Hi experts,
When I was doing the experiment about the encoder, I couldn't understand the meaning of some TI codes,mainly including PM_tformat_receiveData () function and PM_tformat_setupCommand()function :
The main questions are as follows:
1.How to calculate the bitIndex and wordNo values?
.
uint16_t PM_tformat_receiveData(uint16_t tformatDataID)
{
uint32_t len, bitIndex, wordNo;
uint16_t word1;
word1 = 1;
switch(tformatDataID)
{
case (PM_TFORMAT_DATAID2):
len = 8;
bitIndex = 13;
wordNo = 1;
tformatData.controlField = tformat_getBits (len, wordNo, bitIndex);
wordNo = wordNo + (10 + (16 - bitIndex) ) / 16;
bitIndex = 16 - ((10 + (16 - bitIndex)) % 16) ;
tformatData.statusField = tformat_getBits (len, wordNo, bitIndex);
wordNo = wordNo + (10 + (16 - bitIndex) ) / 16;
bitIndex = 16 - ((10 + (16 - bitIndex)) % 16) ;
tformatData.dataField0 = tformat_getBits (len, wordNo, bitIndex);
wordNo = wordNo + (10 + (16 - bitIndex) ) / 16;
bitIndex = 16 - ((10 + (16 - bitIndex)) % 16) ;
tformatData.crc = tformat_getBits (len, wordNo, bitIndex);
}
2.What does 0X903F mean here?How is it calculated?

Best regards
Johnson Alanl