Manual NOVOS und thanos EVO
Seite 52 Thermokon Sensortechnik GmbH
9.2.3 Transmission Mode RTU
In the transmission mode RTU, telegrams are separated by transmission pauses.
The period of the transmission pauses for the separation of telegrams is depending on the set baud rate and amounts to
3.5 x Word Transmission Time (11 Bit). With 9600 Baud at least 4 ms and with 19200 at least 2ms must elapse between two telegrams.
9.2.3.1 Telegram Structure
9.2.3.2 Calculation of CRC-Checksum
The CRC checksum (Cyclical Redundancy Check) is calculated by the sender by means of all bytes transmitted and is attached to the
message. Then, the receiver calculates the CRC checksum again and compares the same with the checksum received. If the values are
not matching, a transmission error must be assumed and the data received are rejected. The low-order byte of the 16-bit checksum is
sent in the telegram in the next-to-last position and the high-order byte at the last position.
Calculation of Checksum (programming example in C):
crc = 0xFFFF; // CRC-Check, Init
for(i = 0; i < telegram_length-2; i++)
crc = crc_calc(crc, telegram_data[i]);
crc_low = crc & 0x00FF; // Low-Byte
crc_high = (crc & 0xFF00) >> 8; // High-Byte
// Calculate CRC
unsigned int crc_calc(unsigned int crc_temp, unsigned int data)
{
unsigned int Index_CC=0;
unsigned int LSB=0;
crc_temp = ( ( crc_temp ^ data) | 0xFF00) & (crc_temp | 0x00FF) ;
for(Index_CC = 0; Index_CC<8; Index_CC++)
{
LSB = (crc_temp & 0x0001);
crc_temp >>= 1;
if(LSB)
crc_temp = crc_temp ^ 0xA001; // calculation polynominal for CRC16
}
return(crc_temp);
}
1 Byte
1 Byte
0 - 100 Byte