GE MM300 manual Error Checking, CRC-16 Algorithm

Page 7

COMMUNICATIONS GUIDE

RS485 INTERFACE (MODBUS RTU)

Master Request Transmission:

SLAVE ADDRESS: 1 byte

FUNCTION CODE: 1 byte

DATA: variable number of bytes depending on FUNCTION CODE

CRC: 2 bytes

Slave Response Transmission:

SLAVE ADDRESS: 1 byte

FUNCTION CODE: 1 byte

DATA: variable number of bytes depending on FUNCTION CODE

CRC: 2 bytes

SLAVE ADDRESS: This is the first byte of every transmission. This byte represents the user- assigned address of the slave device that is to receive the message sent by the master. Each slave device must be assigned a unique address and only the addressed slave will respond to a transmission that starts with its address. In a master request transmission the SLAVE ADDRESS represents the address of the slave to which the request is being sent. In a slave response transmission the SLAVE ADDRESS represents the address of the slave that is sending the response.

FUNCTION CODE: This is the second byte of every transmission. Modbus defines function codes of 1 to 127.

DATA: This will be a variable number of bytes depending on the FUNCTION CODE. This may be Actual Values, Setpoints, or addresses sent by the master to the slave or by the slave to the master.

CRC: This is a two byte error checking code.

Error Checking

The RTU version of Modbus includes a two byte CRC-16 (16 bit cyclic redundancy check) with every transmission. The CRC-16 algorithm essentially treats the entire data stream (data bits only; start, stop and parity ignored) as one continuous binary number. This number is first shifted left 16 bits and then divided by a characteristic polynomial (11000000000000101B). The 16 bit remainder of the division is appended to the end of the transmission, MSByte first. The resulting message including CRC, when divided by the same polynomial at the receiver will give a zero remainder if no transmission errors have occurred.

If a MM300 Modbus slave device receives a transmission in which an error is indicated by the CRC-16 calculation, the slave device will not respond to the transmission. A CRC-16 error indicates than one or more bytes of the transmission were received incorrectly and thus the entire transmission should be ignored in order to avoid the MM300 performing any incorrect operation.

The CRC-16 calculation is an industry standard method used for error detection. An algorithm is included here to assist programmers in situations where no standard CRC-16 calculation routines are available.

CRC-16 Algorithm

Once the following algorithm is complete, the working register “A” will contain the CRC value to be transmitted. Note that this algorithm requires the characteristic polynomial to be reverse bit ordered. The MSBit of the characteristic polynomial is dropped since it does not affect the value of the remainder. The following symbols are used in the algorithm:

—>: data transfer

A: 16 bit working register

MM300 MOTOR MANAGEMENT SYSTEM – COMMUNICATIONS GUIDE

3

Image 7
Contents MM300 Page Table of Contents MM300 Motor Management System Communications Guide MM300 Motor Management System Communications Guide Data Frame Format and Data Rate Electrical InterfaceData Packet Format CRC-16 Algorithm Error CheckingMM300 supported functions TimingFunction Code 03H Slave Response Bytes Example Description Function Code 04HMaster/slave packet format for function code 03H Master Transmission Bytes Example DescriptionMaster/slave packet format for function code 04H Function Code 05HMaster/slave packet format for function code 05H CRC CB B9 Function Code 06HMaster/slave packet format for function code 06H DataFunction code 7 bitmask Function Code 07HMaster/slave packet format for function code 07H Diag Code Function Code 08HFunction Code 10H Master/slave packet format for function code 08HMaster/slave packet format for function code 10H Error ResponsesActual Values Modbus memory mapREAL-TIME Clock General TimersTrip Counters Current Metering CONTACT/VIRTUAL INPUTS/OUTPUTS StatusSecurity Status MotorPower Metering User MAP Values FLA RTD Maximium TemperatureMotor Starting Learned Data GCP Factory TestStatus Buffer Event RecorderCommunication Setpoints CommandsCommunication Settings FlexlogicCurrent Sensing REAL-TIME CLOCK/DAYLIGHT SavingsVoltage Sensing Motor Data SetupProcess Interlock RS485 Interface Modbus RTU Open Control Circuit Communication SetupUser MAP Addresses Mechanical JAM Reset SetupThermistor CPU RTD OPEN/SHORT Circuit REQUIRED=IOGFLA Underpower IOA + IOC or IOA + IOBGround Fault Undercurrent REQUIRED=IOALoad Increase Phase Undervoltage REQUIRED=IOBPhase Overvoltage REQUIRED=IOB Phase Reversal REQUIRED=IOBRestart Block MaintenanceFlexlogic Timers Start InhibitCommunications Guide RS485 Interface Modbus RTU Communications Guide RS485 Interface Modbus RTU Contact Input Assignment Auto / Manual Control Contact OutputsFlexlogic Equation Unsigned Long Value Unsigned ValueUnsigned VALUE, 1 Decimal Place Unsigned VALUE, 2 Decimal PlacesLSB Unsigned Long VALUE, 3 Decimal PlacesDate MM/DD/YYYY MSBOn / YES OFF / noOFF USER2 USER1USER3 No Event/Trip To Date RS485 Interface Modbus RTU RS485 Interface Modbus RTU Not XOR Latch NOR Nand Timer Assign RS485 Interface Modbus RTU Definition RS485 Interface Modbus RTU WED SUNMON TUEVbn Direct Bit FC180 FC181 FC182 FC183 RS485 Interface Modbus RTU Performing Commands Using Function Code 10H Master/slave packet format for performing commands Using the User Definable Memory MapCRC 7E CE RS485 Interface Modbus RTU Ethernet interface LED Profibus Output DataFieldbus interface external connections Profibus Profibus LED indicationsF1B Profibus DP-DiagnosticsSystem Standard Diagnostics Bytes 1 through Profibus Input DataCommunications Guide Fieldbus Interface Class Object DeviceNet CommunicationsFieldbus interface external connections DeviceNet DeviceNet LED indicationsMessage Router Class Code 02H Identity Object Class Code 01HDeviceNet Object Class Code 03H Identity Object, Class Code 03h, Instance 01h, Attributes Connection Object, Class Code 05h, ServicesAttribute Access Name Data Type Value Description DeviceNet Connection Object Class Code 05HDeviceNet Motor Data Poll, Explicit Object Class Code A0H Motor Data Object, Class Code A0h, ServicesMotor Data Object, Class Code A0h, Attributes Item Description Size in Bytes Format Attribute Description Size in Bytes Explicit Motor Analog Data Object, Class Code B0h, Services0FH Attribute Item Description Size Format Bytes Data Formats, Explicit Motor Analog Data ObjectFieldbus Interface Data Value, Class B1h Explicit Motor Control Object, Class Code B1h, ServicesDeviceNet Explicit Motor Object, Class Code B1H Explicit Motor Control Object, Class Code B1h, AttributesFieldbus Interface