0.60

ReferenceHardwareEtherCATWrite task

EtherCAT write task

Write command channel values to the output PDOs of EtherCAT modules.

An EtherCAT write task writes the values of command channels to the output PDOs of one or more modules on one network. For example, a valve on a schematic can switch an output of an EL2004 module.

Each output also has a state channel. The state channel shows the last command that the task wrote. The Driver does not read the state back from the module.

Before you start, you need configured modules.

PDO channels

Each channel writes one entry of an output PDO. The channel selects the entry by its CoE address: an index and a sub-index. The Console lists the entries of a module with their addresses. For example, an EL2004 names all four outputs Output, at 0x7000:01, 0x7010:01, 0x7020:01, and 0x7030:01.

The data type of a channel must be a number type of the same size as its entry, in whole bytes. Each EL2004 output is 1 bit, so it takes uint8 or int8.

All modules in a task must be on the same port. The network cycles at least as fast as the Execution rate, so a higher rate sends new commands to the modules sooner. When the task stops, its outputs go to zero, unless another running write task commanded them. See how the Driver runs a network.

Create an EtherCAT write task

When you create command channels with a client library, give each one its own index channel. A writer that holds several commands on one index must write all of them in every frame.

Enterprise
  1. In the devices toolbar, right-click a module and select Create write task.
  2. Set Execution rate and State update rate.
  3. Click Add channel, then select the module in Slave device. A new channel starts with the module of the last channel.
  4. Select an entry in Entry. Data type then shows the type of the entry.
  5. Click (Start).

The Console creates a command channel and a state channel for each output. It names them after the identifier of the module and the name of the entry. If the module has more than one entry with that name, the Console adds the PDO name, or the address when the module gives no PDO name. For a module with the identifier do1 and no PDO names, the Output entry at 0x7000:01 gives do1_Output_7000_01_cmd, do1_Output_7000_01_cmd_time, and do1_Output_7000_01_state, with the index do1_state_time.

Task options

Console label Python field Default Notes
Execution rate execution_rate 1000 Hz The lowest rate of the network on the port. Up to 10 kHz.
State update rate state_rate 25 Hz How often the task writes the state channels.
Data saving data_saving_disabled On See data saving.
Auto start auto_start Off Starts the task each time the Driver starts.

Channel reference

Each channel has a device, the key of the module (Slave device), a cmd_channel, and a state_channel. A state_channel of 0 means no state channel. Each table shows the Console label of a setting, with its Python field under it.

Entry

Python EntryWriteChannelTypeScript entry

Writes one output entry at its CoE address.

Setting Default Notes
Entry index, sub_index The CoE address, such as 0x7000:01.
Data type data_type A number type of the same size as the entry.

A task from an earlier release can also hold an unresolved channel (UnresolvedWriteChannel). It has the name of an entry, but no address. See troubleshooting.

Troubleshooting

A channel from an earlier release has no entry

Earlier releases could select an entry by its name. If the module has more than one entry with that name, or none, the upgrade cannot find the address of the entry. The Console marks the channel with an error, and the task does not start. The error reads “… matches more than one output entry …” or “… matches no output entry …”.

Select an entry for the channel in Entry. The first entry in the list with that name is the one that the task wrote before, and it keeps the old channels.

“All slaves must be on the same network”

The task uses modules on two ports. Create one task for each port.

“Slave … has no output entry at …”

The module has no output entry at the address of the channel. Select an entry from the list again. In code, use an address that the Console lists, or find the entry by its name.

“Data type … does not fit entry …”

The data type of the channel has a different size from the entry. Select a number type of the same size, such as uint8 for a 1-bit output. From code, the Driver reports “data type … is … but entry … holds …”.

“More than one channel uses entry …”

Two channels of the task use the same entry. Select a different entry for one of them. From code, the Driver reports “another channel already uses entry …”.

For other problems, see Configure an EtherCAT device and Troubleshoot hardware.