pyads: PyADS (3.3.4) Library to read Data from Beckhoff PLC - pyads.pyads_ex.ADSError Parameter Size not correct (1797)

Hi, I want to communicate with the Beckhoff PLC, but i am facing an issue while reading multiple register using “read_list_by_name” pyads api. Reference code :

import pyads
import time
import random 

REMOTE_AMS_NET_ID = '********' #PLC's AMS NET ID
REMOTE_PLC_IP = '*********'       #PLC's IP Address

adr = pyads.AmsAddr(REMOTE_AMS_NET_ID, pyads.PORT_TC3PLC1)
pyads.add_route(REMOTE_AMS_NET_ID, REMOTE_PLC_IP)
plc = pyads.Connection(REMOTE_AMS_NET_ID, pyads.PORT_TC3PLC1, REMOTE_PLC_IP)

var_list = ["GVL_PC_2_PLC.home","GVL_PC_2_PLC.process_complete"]
value = plc.read_list_by_name(var_list)
print(value)

Error Screenshot

Screenshot from 2021-03-25 11-09-17

Please help if you can

Thanks in advance

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (8 by maintainers)

Most upvoted comments

Fun fact: c_ulong is longer on Linux than on Windows:

On Linux:

>>> import ctypes
>>> ctypes.sizeof(c_ulong)
8

On Windows:

>>> import ctypes
>>> ctypes.sizeof(c_ulong)
4