The capture function stores the current counter value upon an external input signal.
Each Encoder have 2 registers of capture (CAP0 and CAP1). Those registers can be used in 2 ways:
oUp to 2 position captures
o1 distance capture
Using this function requires to:
oconfigure optional Capture inputs: CAP
ouse EXPERTGetCapturedValue function block to retrieve the captured value in your application.
This graphic illustrates how the position capture works (only one register is shown):
Stage |
Action |
---|---|
1 |
When En_Cap = 0, the function is not operational. |
2 |
When EN_Cap = 1, the edge on CAP captures the current counter value and puts it into the Capture register, and triggers the rising edge of Cap_Flag. |
3 |
Get the stored value using EXPERTGetCapturedValue. |
4 |
While Cap_Flag = 1, any new edge on the physical input CAP is ignored. |
5 |
The rising edge of Encoder function block input ACK_Cap triggers the falling edge Cap_Flag output. A new capture is authorized. |
When using an encoder, the distance capture allows to get the difference between each edge of CAP input as shown in the following diagram:
Stage |
Action |
---|---|
1 |
The rising edge of CAP captures the current counter value and puts it into the first capture register. |
2 |
The falling edge of CAP captures the current counter value and puts it into the second Capture register, and triggers the rising edge of Cap0_Flag. |
3 |
Get the stored value using EXPERTGetCapturedValue. The EXPERTGetCapturedValue function block can get: othe position at the rising edge othe position at the falling edge odistance value |
4 |
While Cap0_Flag = 1, any new edge on the physical input CAP is ignored. |
5 |
The rising edge of Encoder function block input ACK_Cap triggers the falling edge Cap_Flag output. A new capture is authorized. |
NOTE: In the case of a rotary axis, the distance is always positive even if the position at the falling edge is smaller than the position at the rising edge.