davidLin7692 / pymodbus

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

Transaction Failed when trying to Read Registers #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I tried connecting to the system and the response was true. But I'm having 
serious problems doing anything after that. I cannot even access the registers 
due to Transaction Errors.

from pymodbus.client.sync import ModbusTcpClient

import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)

client = ModbusTcpClient('192.168.2.70', port=502)

testconnect = client.connect()
print testconnect

RR = client.read_holding_registers(4000,2)

This is the logging I get from the script;

"""True
DEBUG:pymodbus.client.sync:Running transaction 1
DEBUG:pymodbus.client.sync:Transaction failed. (timed out) 
DEBUG:pymodbus.client.sync:Transaction failed. (timed out) 
DEBUG:pymodbus.client.sync:Transaction failed. (timed out)"""

I am using pymodbus 0.9.0 with Python27 on a Windows machine

What can I do to get past this spot.....

Original issue reported on code.google.com by toe...@gmail.com on 15 Aug 2012 at 9:08

GoogleCodeExporter commented 9 years ago
Are you sure that you can actually connect to the box?

1. try to ping the machine in question
2. try to telnet to the modbus port (502) and see if you can connect
3. try one of the reference implementation included (modpoll)

Let me know what you find.

Original comment by Bashw...@gmail.com on 4 Sep 2012 at 4:07

GoogleCodeExporter commented 9 years ago
Hello,

Thanks for the response. I was able to ping and telnet to the meter unit
which was also obvious with the response from the "testconnect" command.

I was able to write another python program that calls the modpoll.exe
software to access the registers and get my output. But the problem I have
is that, I am writing this program to install on a device that can only run
python programs and not executable(.exe) programs. I am running the program
from a PC at the moment but will be transferring it to the device once I
can get it to run striclty using python libraries.

Original comment by toe...@gmail.com on 4 Sep 2012 at 4:23

GoogleCodeExporter commented 9 years ago
Thanks for the response. I was able to ping and telnet to the meter unit which 
was also obvious with the response from the "testconnect" command.

I was able to write another python program that calls the modpoll.exe software 
to access the registers and get my output. But the problem I have is that, I am 
writing this program to install on a device that can only run python programs 
and not executable(.exe) programs. I am running the program from a PC at the 
moment but will be transferring it to the device once I can get it to run 
striclty using python libraries.

Original comment by toe...@gmail.com on 4 Sep 2012 at 4:23

GoogleCodeExporter commented 9 years ago
I'm not really sure what to tell you besides try the latest version from github 
and try again with one of the simple examples that I have provided. The timeout 
exception is coming from the python socket library which is below the pymodbus 
library. Maybe try a simple python script to connect a socket object to the 
modbus port and see if something isn't wrong with your python installation or 
system.

Original comment by Bashw...@gmail.com on 13 Jan 2013 at 7:35

GoogleCodeExporter commented 9 years ago
Hello i have subj problem too:

http://stackoverflow.com/questions/23887184/pymodbus-tcpclient-timeout

Original comment by dss181 on 28 May 2014 at 12:09