Sample program 2 - short-circuit detection (voltage-controlled)
Program description and function
This sample program has the same function as sample program 1. Here, too, a short-circuit is to be detected with the help of the LED output of the EL2596.
However, this sample program 2 uses the “Voltage Control” operation mode, so that a specified voltage is output at the LED output.
For this purpose, as described in the chapter Commissioning, the values for the supply and output voltage, as well as the maximum output current must also be specified in the CoE data.
The specified output values are then output at the output of the LED terminal. “Voltage Control” mode must be selected as the output mode (CoE index 0x8004:01).
“Standard digital output (with info data)” is used as the predefined PDO.
In the sample program, diagnostic data are read from the diagnostic messages of the terminal. To do this, the NetID of the EtherCAT network and the ID of the EL2596 must be specified in the global variable list (GVL).
The NetID can be displayed in TwinCAT under the EtherCAT Master on the “EtherCAT” tab. The ID must be specified in the GVL as sNetID in inverted commas as a string.
The ID of the slave can also be found in the EtherCAT master. The “Online” tab must be selected in order to do this. This value must then be specified as nSlaveAddr.
The sample program can then be started. To use the sample program, the included visualization should be opened.
- If the program is started and the terminal is not in an error state, “ReadyToActivate” is active and the lamp in the visualization is green.
- The desired voltage at the output must be set in the “Set Output Voltage” box. This can also be changed while the short-circuit detection is running.
- The short-circuit detection can then be started in the visualization via the “Start” button.
- The output is then switched on from the PLC, so that the “Output” lamp also turns green.
- The “Output Voltage” and “Output Current” text boxes display the present values of the output.
- If a falling edge occurs on the “ReadyToActivate” bit in the PLC program, the reading of the diagnostic information from the CoE objects 0xA000 and 0x10F3 is started. The output switches off immediately.
- Any short-circuit that has occurred is recognizable from the diagnostic data, and the “Shortcircuit” lamp in the visualization lights up red.
- If there is no longer a short-circuit at the LED output, the EL2596 must be reset manually via the “Reset” button, which is linked to the “Reset” bit of the EL2596.
- The LED output is then reactivated.
- The short-circuit detection can be stopped manually via the “Stop” button; the LED output is then switched off.
Limiting the peak current in case of short-circuit If a short-circuit occurs at the LED output, currents >6 A can flow for a short time. In order to limit the peak output current, a resistor in the low ohm range can be connected in series with the component on which a short-circuit is to be detected. |