MCV_CamSwitch

The MCV_CamSwitch function block realises the output of a cam-controlled switch that is assigned to an axis. The cam's range can be defined freely.

The function blocks internal calculations are based on a modulo coordinate system with the value range [0, 3600000] 0,1 µm or 10-4°.

The prerequisite that no more than half the modulo value range is covered by the axis in each PLC cycle must also be fulfilled.

Block diagram

MCV_CamSwitch 1:

Parameters of the function block

VAR_IN_OUT

 

Axis

AXIS_REF

Axis reference.

VAR_INPUT

 

Enable

BOOL

Activates the cam-driven switch.

 

FirstOnPosition

DINT

Position of the axis at which the output of the cam-driven switch changes from FALSE to TRUE, if the axis is rotating in a positive direction.

Default unit [0,1µm or 10-4 °]

 

LastOnPosition

DINT

Position of the axis at which the output of the cam-driven switch changes from TRUE to FALSE, if the axis is rotating in a positive direction.

Default unit [0,1µm or 10-4 °]

 

CompTime

DINT

Compensation time by which the switch-on phase of the cam-driven switch is advanced or delayed.

Unit [1ms]

 

PosType

INT

Selection whether command position or actual position of the axis should be used for comparison with the input variables and for calculation of the switch-on position / switch-off position that is changed by the compensation time.

0: Actual position of the axis (ACTIVE_POS)

1: Command position of the axis
(CURRENT_POS)

VAR_OUTPUT

 

Active

BOOL

Indicates the current state of the cam-driven switch.

 

State

BOOL

Output of the cam-driven switch.

The output is TRUE, if:

Case 1:
‘FirstOnPosition’ < ‘LastOnPosition
The value of the axis position lies between ‘FirstOnPosition’ and ‘LastOnPosition’.

Case 2:
‘ FirstOnPosition’ > ‘LastOnPosition
The value of the axis position lies at time t0in front of and at the following time t1behind the range spanned by ‘FirstOnPosition’ and ‘LastOnPosition’ The signal remains for at least one PLC cycle at TRUE.

 

Error

BOOL

Indicates if an error has occurred.

 

ErrorID

WORD

Error identification.

 

Pulsed

BOOL

For visualization purposes. If "State" = TRUE, "Pulsed" is assigned TRUE for one second.

Behavior of the function block

Case 1: FirstOnPosition’<‘LastOnPosition

MCV_CamSwitch 3:
Figure 3-2: Behavior of the "State" output when ‘FirstOnPosition’ < ‘LastOnPosition’

Case 2: FirstOnPosition’>‘LastOnPosition

MCV_CamSwitch 4:
Figure 3-3: Behavior of the "State" output when ‘FirstOnPosition’ < ‘LastOnPosition’