monthop / pymodbus

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

crc check in ModbusRtuFramer #73

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In class<ModbusRtuFramer> func<checkFrame> :

crc = self.__buffer[frame_size - 2:frame_size]

will have something like this :

crc = '\x01'
or 
crc = '\x10'
& or so on..

so crc is unicode and it's length will always be ONE.
---> len(\xhh) is always 1 <---

then what do we expect in 
crc_val = (ord(crc[0]) << 8) + ord(crc[1])

it raises error and gets out of try: returning false

What steps will reproduce the problem?
1.while reading a data from slave 
2.while writing a data to slave

What version of the product are you using? On what operating system?
I used latest build of pymodbus downloaded from 
https://github.com/bashwork/pymodbus on win7 32Bit

Original issue reported on code.google.com by rushabh....@gmail.com on 9 Dec 2013 at 10:43

GoogleCodeExporter commented 9 years ago
It is binary data that is coming over the pipe, it isn't converted to unicode 
anywhere so the crc shouldn't be truncated:

binary(\x00\x01) != binary(\x01)

Can you give me an example of this happening?

Original comment by Bashw...@gmail.com on 5 Jan 2015 at 7:42