MODBUS-TK Reading floating point values from slave in the master

321 views
Skip to first unread message

abhinandan shiv

unread,
Jun 20, 2017, 7:37:10 AM6/20/17
to modbus-tk

 have created modbus slave to write data to the registers. I am able to write both float values and integer values from the slave side.

In the modbus master I am able to access only the integer values but not able to read float values.

I went through this https://github.com/ljean/modbus-tk/issues/72 but that didn't solve my problem.


For the integer values reading I can use the below code and read the values.


master = modbus_tcp.TcpMaster()

master.set_timeout(time_out_period)

result = master.execute(slave = 100, function_code = 3 , starting_address = 0, quantity_of_x = 25) 



But for the float values I used both the above and below code.


master = modbus_tcp.TcpMaster()

master.set_timeout(time_out_period)

result = master.execute(slave = 100, function_code = 3 , starting_address = 0, quantity_of_x = 25 , data_format='>f')

Reply all
Reply to author
Forward
0 new messages