MC_DigitalCamSwitch (FB)

 

FUNCTION_BLOCK MC_DigitalCamSwitch

This function block is analogous to switching on a motor shaft: The func­tion block commands a group of discrete output bits to switch in analogy to a set of mechanical cam controlled switches connected to an axis. Forward and backward movements are allowed.

Note

Changing the VAR_IN_OUT-parameters requires a new rising edge of the Enable input.

Notice

This functionality is sometimes called PLS – Phase or Position or Programmable Limit Switch.

Example

Assume the following parameter values set:

Parameter

Type

Switch01

Switch02

Switch03

Switch04

TrackNumber

INT

1

1

1

2

FirstOnPosition [u]

REAL

2000

2500

4000

3000

LastOnPosition [u]

REAL

3000

3000

1000

-

AxisDirection

INT

1=Pos

2=Neg

0=Both

0=Both

CamSwitchMode

INT

0=Position

0=Position

0=Position

1=TIME

Duration

TIME

-

-

-

1350

Assume further, that no on/off compensation nor hysteresis is employed. The figure demonstrates the behavior of the outputs, when the axis is moving continuously in positive direction. The axis is a modulo axis with a modulo length of 5000 u.

Example of DigitalCamSwitch

DigitalCamSwitchExample1.png

Now assume that on compensation (-125ms) and off compensation (+250ms) are employed.

Detailed description of Switch01

DigitalCamSwitchExample2.png

The resulting behavior of the outputs, when the axis is moving continu­ously in negative direction without on/off compensation and without hysteresis.

Example in negative direction

DigitalCamSwitchExample3.png

InOut:

Scope

Name

Type

Initial

Comment

Inout

Axis

AXIS_REF_SM3

Reference to axis the switches are connected to

Switches

MC_CAMSWITCH_REF

Reference to switching actions

Outputs

MC_OUTPUT_REF

Reference to signal outputs that are directly related to the referenced tracks

TrackOptions

MC_TRACK_REF

Reference to structure containing track related properties, e.g. the on/off compensations per output/track.

Input

Enable

BOOL

FALSE

TRUE: Enables execution of function block.

EnableMask

DWORD

16#FFFFFFFF

32 bits of BOOL enabling the different tracks. Least significant data is related to the lowest TrackNumber.

TappetMode

MC_TAPPETMODE

tp_mode_auto

Mode for position outputs

Output

InOperation

BOOL

FALSE

TRUE: Commanded tracks have been enabled.

Busy

BOOL

FALSE

TRUE: Execution of function block has not been finished yet.

Error

BOOL

FALSE

TRUE: Error has occurred within the function block.

ErrorID

SMC_ERROR

0

Error identification

SwitchCorrupted

INT

Signalizes potential problems that arise from compensation times: Compensation times may lead to the case that the extrapolated position passes one switching point several times before passing the other switching point again. As a consequence, a non-inverted switch may become inverted (and the other way around). In this case, this variable indicates the switch in concern. There are two possible reasons:

  • noisy velocity-values,

  • "big" difference between on- and off-compensation.

-1 means that such behaviour hasn't occured.