[Python] Cannot write data to ECAT IO slaves using...

Discussão em 'Python' iniciado por Stack, Abril 30, 2025.

  1. Stack

    Stack Membro Participativo

    I'm experimenting with pyads library and have an application where I need to read and write data from ECAt IO slaves (DI, DO, AI, AO). I have one ECAT slave EL3174-0002 4Ch. Ana. Input, where all variables of all four channels are type INT. Using read_list_by_name works without any problem, but trying to write using write_list_by_name returns ADS error 1793 "Service is not supported by server". On the other hand, writing one by one works - but the performance is bad.

    This is a code snippet that show this:

    if __name__ == "__main__":
    ECAT_IO_ADDRESS = "10.238.65.188.2.1"
    ECAT_IO_PORT = 27905

    var_list = [
    "Term 5 (EL3174-0002).AI Standard Channel 1.Value",
    "Term 5 (EL3174-0002).AI Standard Channel 2.Value",
    ]

    # Create dictionary from list to be used in write_to list
    data_to_write = {name: random.randint(0, 1024) for name in var_list}

    with pyads.Connection(PLC_AMS_NET_ID, ECAT_IO_PORT) as ecat:
    data_read = ecat.read_list_by_name(var_list)
    print("Data read from ECAT AI: ", data_read)
    print("Data prepared to write to ECAT AI: ", data_to_write)
    ret_write = ecat.write_list_by_name(data_to_write)

    #for name, value in data_to_write.items():
    #ecat.write_by_name(name, value)


    This code will produce the following error:

    in adsSyncReadWriteReqEx2
    raise ADSError(err_code)
    pyads.pyads_ex.ADSError: ADSError: Service is not supported by server (1793).


    If I comment that line and uncomment the for-loop, all values are written correctly. I would like to know if this is a bug in the pyads implementation, or the ADS server cannot really support writing data in chunks.

    Thanks in advance.

    I tried to use pyads.connection.Connection.write_list_by_name exactly as stated in the documentation and using the same format that is returned by read_list_by_name.

    Continue reading...

Compartilhe esta Página