MC_DigitalCamSwitch

MC_DigitalCamSwitch 1:

The function block MC_DigitalCamSwitch is a digital cam controller with one or several cams on a digital output track.

Position, time and brake cams can be realized through suitable parameterization. Further output tracks can be realized with independent instances of the function block.

In addition to the switching state of the digital output the output data structure contains precise time information for the next switching operations. This information is used for the actual output at an XFC output terminal with a downstream function block (XFC_EL2252_V2 or XFC_EL2262).

MC_DigitalCamSwitch 2: Inputs

VAR_INPUT
    Enable  : BOOL;
    Options : ST_CamSwitchOptions;
END_VAR

Name

Type

Description

Enable

BOOL

The cam controller is activated via the Enable input. The initial state remains unchanged, as long as Enable=FALSE.

Options

ST_CamSwitchOptions

Optional parameter

MC_DigitalCamSwitch 3: / MC_DigitalCamSwitch 4: Inputs/Outputs

VAR_IN_OUT
    Axis         : AXIS_REF; 
    Switches     : CAMSWITCH_REF;
    Output       : OUTPUT_REF; 
    TrackOptions : TRACK_REF; 
END_VAR

Name

Type

Description

Axis

AXIS_REF

The axis data structure of type AXIS_REF addresses an axis unambiguously within the system. Among other parameters, it contains the current axis status, including position, velocity or error state.

Switches

CAMSWITCH_REF

The data structure Switches contains a reference to the parameterization of all cams on the cam track.

Output

OUTPUT_REF

The data structure Output contains the calculated state of the digital output and the associated timestamp for the output at a digital XFC output terminal.

TrackOptions

TRACK_REF

The data structure TrackOptions contains the parameterization for the cam track.

MC_DigitalCamSwitch 5: Outputs

VAR_OUTPUT
    InOperation : BOOL; 
    Busy        : BOOL; 
    Error       : BOOL; 
    ErrorID     : UDINT; 
END_VAR

Name

Type

Description

InOperation

BOOL

InOperation is TRUE, as long as the cam controller is active and the cam track is calculated according to the cam parameterization.

Busy

BOOL

Busy is TRUE as long as the function block has not been completed.

Error

BOOL

Becomes TRUE if an error occurs.

ErrorID

UDINT

If the error output is set, this parameter supplies the Overview of NC Errors.

Example for two digital cam tracks

MC_DigitalCamSwitch 6:

The following switching diagrams result from the cam data. The switching sequence is represented without any time compensation and hysteresis and varies for both directions of travel due to the cam data.

Switching sequence for positive direction of travel

MC_DigitalCamSwitch 7:

Switching sequence for negative direction of travel

MC_DigitalCamSwitch 8: