fangzhchen / nmodbus

Automatically exported from code.google.com/p/nmodbus
0 stars 0 forks source link

ReadWriteMultipleRegisters has bad CRC calculation #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. ReadWriteMultipleRegisters can't be processed by slave device, because
it generates bad CRC. CRC is the same no mather what data I've send.
2.
3.
-----------------------------------------------------
What is the expected output? What do you see instead?

Example of ReadWriteMultipleRegisters:
I want to read from 6000h 2 registers and write 2 registers to 6000h
Message should be (calculated in test programme):
01,17,60,00,00,02,60,00,00,02,04,8B,BE,F2,00,E0,42
and is (captured on slave)
01,17,60,00,00,02,60,01,00,02,04,12,34,56,78,40,2E

-----------------------------------------------------
What version of the product are you using? On what operating system?

1.11.0.0 .NET 3.5
VB.NET Express Edition on Windows XP SP3 (both with most recent security
updates)

-----------------------------------------------------
Please provide any additional information below.

When you calculate CRC just from this 01,17 you also get 40,2E.
It looks like, that in function ReadWriteMultipleRegisters CRC is
calculated just from device address and function number.

Original issue reported on code.google.com by Sharke...@gmail.com on 27 Oct 2009 at 7:17

GoogleCodeExporter commented 8 years ago
There is error in implementation of this function. CRC is calculated from 
address and
function code only - message is not complete before calculating CRC. If you load
source files and go debugging step - by - step, you can find where this error 
happens.
Secondly, there are errors when reading device response, in function
ResponseBytesToRead - readWriteMultipleRegisters is not supported so you have 
to add
it to the list.

Original comment by juremoc...@gmail.com on 15 Nov 2009 at 12:30