MC_DigitalCamSwitch

MC_DigitalCamSwitch 1:

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 or XFC_EL2262).

Inputs

VAR_INPUT
    Enable  : BOOL;
    Options : ST_CamSwitchOptions;
END_VAR

Enable

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

Options

Optional parameters

Options.

EncoderIndex

If more than one encoder is connected to the axis, the encoder index [0 – 9] can be defined here. The first encoder has the index 0.

Options.

UseAcceleration

UseAcceleration can be set to TRUE in order to incorporate the acceleration of the axis into the position calculation. UseAcceleration can be advantageous if the setpoint values of the acceleration can be used. UseAcceleration may be disadvantageous with encoder axes that supply a noisy position signal, because the acceleration is also erroneous.

Outputs

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

InOperation

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

Busy

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

Error

Becomes TRUE if an error occurs.

ErrorID

If the error output is set, this parameter supplies the error number

Inputs/outputs

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

Axis

Axis data structure

Switches

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

Output

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

TrackOptions

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

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

Example for two digital cam tracks

MC_DigitalCamSwitch 2:

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 3:

Switching sequence for negative direction of travel

MC_DigitalCamSwitch 4: