gianni-sch / pymodbus

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

Updating float values on a Modbus TCP async server #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I'm rather new with the Modbus TCP protocol.

I'm running an updating thread for the server's context (as shown in the 
library example), and the data i'm trying to transmit is float type. 

When sending 22.34 to the address 0, my modbus TCP client only gets 22. So I 
applied to the 22.34 value the builder.add_32bit_float command in order to 
translate the number to a 32bit float and send it over to the client.

I get this: ['R\xb8', '\xb2A']

When I connect the client,i get the following error log: 

struct.error: cannot convert argument to integer
DEBUG:pymodbus.server.async:Client Disconnected: [Failure instance: Traceback 
(failure with no frames): <class 'struct.error'>: cannot convert argument to 
integer
]

I would really appreciate any help with this regard.

Please find attached the files I'm using.

Thanks

Original issue reported on code.google.com by melvin...@gmail.com on 2 Jul 2014 at 2:41

Attachments:

GoogleCodeExporter commented 9 years ago
Looking at your code you are kind of jumping out of the interface and also, you 
are not correctly encoding the remaining float values from the write. Have you 
gotten this working correctly yet or do you still need help?

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

GoogleCodeExporter commented 9 years ago
I have managed to make it work! Thank you very much for your help anyway!

Kind regards.

Original comment by melvin...@gmail.com on 5 Jan 2015 at 3:56

GoogleCodeExporter commented 9 years ago

Original comment by Bashw...@gmail.com on 5 Jan 2015 at 4:06