The EL1258 timestamp module enables a high-speed counting solution without requiring a high-performance CPU or a 50µs cycle time. The number of state transitions within each task cycle is stored internally in the EL1258 module, requiring only accumulation in the PLC. The per-channel cost of the EL1258 is approximately one-third that of the economical EL1512 (1kHz) counting module, making this counter solution highly cost-effective, especially for applications with multiple counting channels and less powerful CPUs. Similarly, the EL1259, equivalent to one EL1258 and one EL2258, can also be used with one or all eight input channels as a high-speed counter when needed.
Keywords: High-speed counter, XFC, timestampApplicable Scope:
- Beckhoff controllers with distributed clocks
- PNP counting signals with a frequency not exceeding 1 kHz
- No more than 10 DI state changes per cycle, i.e., no more than 5 pulses
The EL1258 module is designed to record the timestamp of each state transition within a cycle, up to 10 transitions, with the state and timestamp of each transition stored in Event State n and Event Time n, respectively. It is typically used for the XFC TouchProbe function, i.e., position probing. For counting applications, the signal state after transitions or the timestamps of rising/falling edges are not needed—only the number of state transitions matters. Since consecutive rising or falling edges are not possible, the pulse count can be obtained by accumulating the number of state transitions and dividing by 2. Therefore, the only variable the PLC needs to link to is No of Input Events.
To implement the high-speed counter using the EL1258/EL1259 module, the following steps are required in the PLC program:
- Variable Declaration:
- aEL1259_Ch AT %I* : ARRAY[0..3] OF BYTE; // Maps to the Status of the channels
- nCounter : UDINT; // Accumulates the count of rising and falling edges
- nPulses : UDINT; // Accumulates the pulse count
- Code:
nCounter := nCounter + aEL1259_Ch[0]; nPulses := nCounter / 2;
- Process Data Mapping: Link the aEL1259_Ch array to the process data of the EL1259 module to retrieve the number of state transitions (No of Input Events) for the specified channel.
After activating the configuration and running the program, the cumulative pulse count will be displayed in the nPulses variable.Note: As an XFC module, the EL1258 has a response time of less than 1 microsecond. The module provides filtering parameters to ignore pulses with durations that are too short.
The filtering parameter 0x8000:14 (Digital Filter Counter) is not measured in time units but in the number of cycles of the module's internal high-resolution monitoring task, referred to as microcycle. If 0x8000:01 is set to False (i.e., filtering is disabled), it is equivalent to setting 0x8000:14 to 1. This means that any external signal level sustained for longer than one microcycle is processed as a valid signal.Original Manual Description:
If the parameter 0x8000:14 is set to n, the macrocycle duration must be greater than n * microcycle for the signal to be processed, meaning the signal must persist longer than the macrocycle duration to be considered valid. The module's microcycle duration varies depending on the number of channels, and consequently, the macrocycle duration also varies when filtering is enabled. There is no need to manually consult the manual or perform calculations, as the module provides the parameter 0xF900 to read the currently active microcycle and macrocycle values.Example:
The manual provides the following typical macrocycle values:
When setting the PLC cycle (i.e., EtherCAT cycle), it should be at least 20% longer than the macrocycle. The table indicates that for 8 channels, the module can record up to 10 state transitions per cycle (MTSF 10), with a typical internal cycle time of 290 µs. Therefore, the EtherCAT bus cycle should be greater than 290 µs * 120% ≈ 348 µs. The closest valid task cycle to this value is 500 µs, which allows counting of 1 kHz pulses.For alternative counting solutions, if the controller has sufficient performance or there are enough counting channels, a 50 µs PLC cycle with a 10 µs filter time can be used with standard DI modules, leveraging software function blocks for counting. If the signal frequency exceeds 50 kHz, standard counter modules like the EL1501 or encoder modules like the EL5152 should be used.
When setting the PLC cycle (i.e., EtherCAT cycle), it should be at least 20% longer than the macrocycle. The table indicates that for 8 channels, the module can record up to 10 state transitions per cycle (MTSF 10), with a typical internal cycle time of 290 µs. Therefore, the EtherCAT bus cycle should be greater than 290 µs * 120% ≈ 348 µs. The closest valid task cycle to this value is 500 µs, which allows counting of 1 kHz pulses.For alternative counting solutions, if the controller has sufficient performance or there are enough counting channels, a 50 µs PLC cycle with a 10 µs filter time can be used with standard DI modules, leveraging software function blocks for counting. If the signal frequency exceeds 50 kHz, standard counter modules like the EL1501 or encoder modules like the EL5152 should be used.