1. Communication Modes
The client supports two different modes of communication with the voraus EtherCAT Master:
Cyclic communication mode (default): The developer needs to trigger the PDO reading and writing explicitly, changing the PDO values will have no effect otherwise. In this mode, all PDO values are sent in one OPC UA call, which reduces network overhead.
Instant communication mode: Whenever a PDO input value is requested or a PDO output value changed, the client executes the corresponding OPC UA read and write calls instantly in the background. This mode can increase network overhead.
1.1. Cyclic Communication Mode
The PDO input values are read from the voraus EtherCAT Master when voraus_ecat.EtherCAT.read_pdo_inputs()
is called. In order to read the current PDO output values from the master, use
voraus_ecat.EtherCAT.read_pdo_outputs(). The method voraus_ecat.EtherCAT.read_pdos() reads all input
and output values within one request. Afterwards, the values can be accessed. Setting a PDO output value will not affect
the EtherCAT devices until voraus_ecat.EtherCAT.write_pdos() is called.
1 ethercat = EtherCAT(inputs=Inputs(), outputs=Outputs())
2
3 with ethercat.connection("opc.tcp://localhost:4840"):
4 # Do configration here.
5 # Set the master to operational state.
6 ethercat.set_op_state()
7 try:
8 while True:
9 ethercat.read_pdos()
10 # Communicate with the EtherCAT bus in cyclic communication mode.
11 ethercat.write_pdos()
12 except KeyboardInterrupt:
13 ...
1.2. Instant Communication Mode
In instant communication mode, a PDO input get call triggers an OPC UA value read call instantly. Setting a PDO
output using the set call leads to an OPC UA value write without any additional calls needed.