SPandya
SPandya

Reputation: 1209

LRC and CRC calculation in nmodbus library

I used nmodbus library in one of the application. I know this question is silly, but in ModbusMaster using nmodbus does it take care LRC and CRC in modbus ASCII and RTU respectively? Or do we have to do it separately?

For example when we use this nmodbus function master1.WriteSingleRegister(slaveId, startAdd, WrValue); it takes only 3 arguments slaveId StartAdd and value to write. So when it send the data packet to the port will it take care of the CRC or LRC as per the protocol?

Also If I want to see the datapacket for Tx and Rx of the port in the same application can see it? I mean is it possible to see the Raw received and transmit data?

Upvotes: 0

Views: 882

Answers (1)

mrsargent
mrsargent

Reputation: 2442

I know for sure that NModbus will generate a CRC for Modbus RTU.

You can read any incoming data to your serial port with the SerialPort.DataReceived event. Here is another tutorial.

Upvotes: 1

Related Questions