MCV_CamSwitch

The MCV_CamSwitch FB detects the output of a cam-controlled switch that is assigned to an axis. The cam range is freely definable.

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

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

Block diagram

FB parameters

VAR_IN_OUT

Variable name

Data type

Description

Axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Enable

BOOL

Activates the cam-driven switch.

FirstOnPosition

LREAL

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

Default unit [0.1µm or 10-4 °]

LastOnPosition

LREAL

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

Default unit [0.1µm or 10-4 °]

CompTime

LREAL

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

Default 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/switch-off position that is changed by the compensation time.

0: Command position of the axis (ACTIVE_POS)

1: Actual position of the axis (CURRENT_POS)

VAR_OUTPUT

Variable name

Data type

Description

Active

BOOL

Indicates that the cam-controlled switch is active.

State

BOOL

Output of the cam-driven switch.

The output is TRUE when

  1. the value of the axis position lies between the “FirstOnPosition” and “LastOnPosition”.
  2. The axis position at time t0 before and the next t1 behind the range between the “FirstOnPosition“ and the “LastOnPosition“. The signal is then TRUE for at least 1 PLC cycle.

Error

BOOL

Is TRUE if an error occurs in the FB.

ErrorID

WORD

Error identifier

Pulsed

BOOL

For visualisation purposes. If the "State" output is TRUE, the "Pulsed" output is also TRUE for 1 s.

Behaviour of the FB:

Impact of the compensation time on the switching times
Impact of the compensation time on the switching times

Case 1: “FirstOnPosition“ < “LastOnPosition“

Behaviour of the "State" output when “FirstOnPosition” < “LastOnPosition”
Behaviour of the "State" output when “FirstOnPosition” < “LastOnPosition”

Case 2: “FirstOnPosition“ > “LastOnPosition“

Behaviour of the "State" output when “FirstOnPosition” > “LastOnPosition”
Behaviour of the "State" output when “FirstOnPosition” > “LastOnPosition”