You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On receive the regular CRC-16 of the jeenodes is correctly calculated on the FLM side, but on transmit a different modbus CRC-16 is used to transmit the messages back to the Jeenodes. This requires some additional code on the jeenode to check message integrity.
// Compute the MODBUS RTU CRCuint16_tmodbus_crc (volatileuint8_tbuf[], intlen)
{
uint16_tcrc=0xFFFF;
for (intpos=-1; pos<len; pos++) {
if (pos==-1) {
crc ^= (uint16_t)0x2D; // Added the sync byte
}
else {
crc ^= (uint16_t)buf[pos]; // XOR byte into least sig. byte of crc
}
for (inti=8; i!=0; i--) { // Loop over each bitif ((crc&0x0001) !=0) { // If the LSB is setcrc >>= 1; // Shift right and XOR 0xA001crc ^= 0xA001;
}
else// Else LSB is not setcrc >>= 1; // Just shift right
}
}
// Note, this number has low and high bytes swapped, so use it accordingly (or swap bytes)uint8_ttemp_high_value= (uint8_t)(crc >> 8); // Save high byte valuecrc <<= 8; // Store low byte value in high bytecrc=crc | temp_high_value;
returncrc;
}
The text was updated successfully, but these errors were encountered:
On receive the regular CRC-16 of the jeenodes is correctly calculated on the FLM side, but on transmit a different modbus CRC-16 is used to transmit the messages back to the Jeenodes. This requires some additional code on the jeenode to check message integrity.
The text was updated successfully, but these errors were encountered: