Distances and/or lengths can be measured with this module. This requires a touch probe function in the controller used. The touch probe function saves the current encoder position with a digital signal. Saving can occur with the positive and/or negative edge of the signal.
The module calculates the distance and length from the measured position. Windows can be specified in which a valid measurement is awaited so that interfering edges can be hidden.
Note:Before the module can be executed, all relevant parameters must be initialized with the TB_TPmeasure_Init technology block. Allowed drives are bmaXX 4400 and 5000.
Recommended task: | Event |
Libraries used: | ARITHMETIC_xxbd00 or higher TECH_TYPES_xxbd05 or higher |
Marking: | Data type: | Description: |
---|---|---|
_PMdata | PM_Type | Data from the TB_TPmeasure_Init initialization module. |
Marking: | Data type: | Description: |
---|---|---|
x_Enable | BOOL | When the input x_Enable = TRUE, the module is initialized. If the initialization was successful, the module is enabled. This is indicated when output x_Active = TRUE. After enabling, the first edge/mark is sought. When x_Enable = FALSE, x_1stEdge and x_Active are reset. |
x_Ack | BOOL | Acceptance acknowledgment of the measured data. When x_Ack = TRUE, then x_Valid = FALSE and the measured distance (and length) is set to -1. |
x_Counterclockwise | BOOL | Before enabling the FB with x_Enable, it must be set with this input, in which direction the measurement of lenght will be done. With direction is meant, if the connected encoder on d_EncPos, counting positive in clockwise direction, or is running in counterclockwise direction. TRUE: Counterclockwise FALSE: Clockwise If changing this variable in continous process, the FB needs on LH edge on x_Enable for reinit all values. |
di_DefDist | DINT | Specification value of the expected edge distance of the LH edges (or the HL edges) in user units (e.g. printing mark spacing). |
di_DefSize | DINT | Specification value of expected edge length of LH to HL edge (or HL to LH edge) in user units (e.g. printing mark length). |
di_WinDist | DINT | Permissible deviation (window width) of the edge distance of the LH edges (or the HL edges) in user units. Distances with di_DefDist ± di_WinDist are accepted. If nothing is connected, the interfering mark detection is deactivated and all found edges are detected. |
di_WinSize | DINT | Permissible deviation (window width) of the edge distance of LH to HL edge or HL to LH edge in user units. Widths with di_DefSize ± di_WinSize are accepted. If nothing is connected, the interfering mark detection is deactivated and all found edges are detected. |
ud_Units | UDINT | Number of user units for the corresponding encoder revolutions (u_Revolution). |
u_Revolution | UINT | Number of encoder revolutions for the corresponding user units (ud_Units). |
d_EncPos | DWORD | Encoder actual value of touch probe encoder. Format is 32-bit angle. |
d_TP_PosLH | DWORD | Measured position of LH edge. Format: 16-bit revolution, 16-bit angle. |
d_TP_PosHL | DWORD | Measured position of HL edge. Format: 16-bit revolution, 16-bit angle. |
Marking: | Data type: | Description: |
---|---|---|
x_Active | BOOL | TRUE: Module is active; initialization occurred without incident. |
x_1stEdge | BOOL | First valid edge detected. x_1stEdge remains TRUE until x_Enable = FALSE. |
x_Valid | BOOL | TRUE: Valid values at di_ActDist (and di_ActSize). Reset with x_Ack = TRUE. |
di_ActDist | DINT | Depending on mode and measurement: Measured OR last valid OR maximum distance of LH edges or HL edges in user units. |
di_ActSize | DINT | Depending on mode and measurement: Measured OR last valid OR minimum length of the LH to HL edge (or the HL to LH edge) in user units. |
x_TP_Err | BOOL | TRUE: Faulty measurement, i.e. no edge found within window. Remains TRUE until valid measurement occurs or x_Enable = FALSE. |
u_TP_ErrCnt | UINT | Number of faulty measurements in succession. Reset upon the first valid measurement. |
x_Error | BOOL | TRUE: Error detected. See error table. |
i_Error | INT | Error number. See error table. |
s_ErrTxt | STRING | Error text. See error table. |
i_Error | Description: |
---|---|
0 | No error active. |
-10 | Reservated. |
-20 | No sensor signal detected. Error is set if two default distances (di_DefDist) have already been traversed, but no mark has yet been detected. |
-999 | No technology license. Use PLC with technology license. |
x_1stEdge | x_Valid | x_TP_Err | Comments |
---|---|---|---|
FALSE | FALSE | FALSE | After enable (x_Enable = TRUE). |
TRUE | FALSE | FALSE | First mark/length detected. |
TRUE | TRUE | FALSE | Valid measurement. |
TRUE | TRUE-> FALSE | FALSE | Acknowledgement (x_Ack = TRUE). |
TRUE | TRUE | TRUE | Faulty measurement -> last measured value or default value. |
TRUE | TRUE-> FALSE | TRUE | Acknowledgement (x_Ack = TRUE). |
TRUE | FALSE | TRUE | False LH to HL distance (length) in window. Output minimum length. |
TRUE | FALSE | TRUE-> FALSE | Acknowledgement (x_Ack = TRUE). |
TRUE-> FALSE | FALSE | FALSE | Reset (x_Enable = FALSE). |