do you have the bytes in the correct order?
if not, try changing it to: FOR X=11 TO 0 STEP -1
do you have the bytes in the correct order?
if not, try changing it to: FOR X=11 TO 0 STEP -1
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
There are only 11 bytes in the packet.
Change it to ...
For X = 0 to 10
Then you should get $0FD2 for the CRC.
<br>
DT
I changed the loop to 10 and got a CRC of 0F D2,
but the Modbus Poll simulator still shows a CRC error.
I am processing the bytes in the CRC calculation code in the same order that I am transmitting them - seem reasonable to me.
According to this page ...
http://www.lammertbies.nl/comm/info/...lculation.html
0FD2 is the correct CRC for CRC-16 (Modbus) using [0F 03 08 13 24 13 88 13 5B 00 01].
enterd as hex.
Could the simulator be using a different CRC polynomial?
<br>
DT
Also,
If I enter [0F 03 00 00 00 04] as sent from the host above, it shows 0x2745 for the CRC, which is the same thing the host sent.
So that has to be the right algorithm.
<br>
DT
He He,
You gotta watch out for those "Little Endians" ...
They'll shoot you in the butt with an arrow if your not looking.
Glad I could help,
DT
FYI - here's a screen shot of my Modbus Poll simulator screen and setup:
Hope the image shows OK
Bookmarks