Pymodbus to work with Wago PLC through modbus/tcp

584 views
Skip to first unread message

Paul, Hsieh-Fu Tsai

unread,
Sep 9, 2015, 1:54:54 PM9/9/15
to pymodbus
Hi, Guys,
I am very unfamiliar with all these.
But right now i'm interested in using Wago PLC to control a bunch of solenoid pumps for a scientific project.
I have manage to address a 4DO on a Wago 750-881 plc.
these are %QX0.0 to %QX0.3.

I tried to address through 
from pymodbus.client.sync import ModbusTcpClient
client = ModbusTcpClient('192.168.11.3')
client.write_register(0,1)

doesn't work

And i tried 
client.write_register(0x0200, 1)

if i understand the modbus register address to the IEC61131

But these doesn't work.

So i have a few questions

1. Did i misunderstand the modbus register address for the digital output? was it not a IEC61131 annotation conversion to HEX?

2. Did i need some more things to get them to work?

3. is there anyway for easier debugging to find out at which parts are the problems?

4. right now i have only address the module using the codesys software. there is no program written in the codesys. Should there be any to allow the modbus control of the digital output?


Sorry there isn't much detail. But i'm kind of desperate. Greatly appreciated if anyone can give me some hint.

Best regards,
Paul


Stuart Longland

unread,
Sep 10, 2015, 3:58:45 PM9/10/15
to pymo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Paul,
On 10/09/15 03:54, Paul, Hsieh-Fu Tsai wrote:
> I am very unfamiliar with all these. But right now i'm interested
> in using Wago PLC to control a bunch of solenoid pumps for a
> scientific project. I have manage to address a 4DO on a Wago
> 750-881 plc. these are %QX0.0 to %QX0.3.
>
> I tried to address through from pymodbus.client.sync import
> ModbusTcpClient client = ModbusTcpClient('192.168.11.3')
> client.write_register(0,1)

I have no idea what %QX0.0…3 translate to in Modbus either or what a
4DO is.

I note you don't specify a unit ID, so that write_register command is
basically saying:

client.write_register(0,1, unit=0)

Unit ID 0 is basically a broadcast address, not everything is required
to honour it.

I'm not familiar with IEC61131 specifically, there are a few
"standards" regarding Modbus addressing, one being that registers are
offset by 1 and are given as 5 or 6 digit decimal numbers where the
first digit is the register type.

https://en.wikipedia.org/wiki/Modbus#Coil.2C_discrete_input.2C_input_register.2C_holding_register_numbers_and_addresses

I'm not sure what register gets written to with write_register, I
suspect it's supposed to write to a holding register, but the Modbus
standard is silent on whether that's the case and in fact, it's up to
implementers to decide whether the address spaces are separate or not.

My advice would be to use the ipython shell, do your import of
ModbusTcpClient, create an instance and have a fiddle. I found that
to be the most helpful way to discover how to communicate with a
device years ago when I first struck Modbus.

Regards,
- --
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
...it's backed up on a tape somewhere.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJV8eDrAAoJEE36GRQQveO3ekMP/2QNawXtL9R4jHDgqqKHwrcZ
QVYmyM7fyKGLftAUEZhjkcTwDaWDK4xEW6fScZAzElDLB26CgwiHAKsGBmUPtXRH
GxRBTp4hx5p3VszGL5aWm683aghDoFH7he3Erwuh4iyyjFFOy7HOoKHWVoU3soxi
SoNWT9tKuwPzl2AwOPqaZE33llxtAhGtaEyGEWQSSkAVy0GDPhtqkmxZ59CaMMaT
DtCr3wDSOjAWPq27sQ7vvnNmSBhMdic0E5VItn9Zo/N54onsryBPcDe7xL1B3SDR
OwCRCTwsCEDiAo8Gx0WUKrAPG1LkkQx/O58GnDnU9rth+7Xv+6tRhRkWDYjq+okQ
t++gHQYxDP8PTNnpZa7r+p/MAusm8+t2UMiYAD95Uriw3H6nDYzqcJr3wshEZduy
gKRZtGSJK3d0PRAWwUItkTs8oHgf6jnRtd2vFPVNY3678ALkzDD9bYuIjV/jH6h8
pt2xJBBezQ4fJYianE234fJLk6qDYFpfi5xUopllhr3ffAxUCGd6n7sJnC8/GG8l
fVNJd6RJe+hnoClSdskOen1R7VZ3qX9V0tKuLVbCtGcCs7R9JtDkjU4AG3vJZ2UN
DpFsTPfRQbWWoeviONTn3w8URSLdFOW9j2+Jo+nz9inKAstd7kwP8QH5VPb+UlQY
Vq1S1jnpZoQKFop9H9rr
=Wvwd
-----END PGP SIGNATURE-----

Paul, Hsieh-Fu Tsai

unread,
Sep 23, 2015, 3:44:49 AM9/23/15
to pymodbus
Hi Stuart,
Thanks alot for the tip!
I've started to test through ipython notebook.

Best,
Paul
Reply all
Reply to author
Forward
0 new messages