CAMSWITCH_REF

The data type CAMSWITCH_REF refers to a data structure with cam parameters for a digital cam controller MC_DigitalCamSwitch.

TYPE CAMSWITCH_REF :
STRUCT
    NumberOfSwitches : UDINT; 
    pSwitches        : POINTER TO MC_CamSwitch; 
    SizeOfSwitches   : UDINT; 
END_STRUCT
END_TYPE

The actual data structure for parameterization of a digital cam controller is usually an ARRAY OF MC_CamSwitch. CAMSWITCH_REF refers to this structure via a pointer and clearly defines the size of the structure and the number of actual cams.

A variable of type CAMSWITCH_REF is initialized as illustrated in the following example:

VAR
    CamSwitchArray : ARRAY[1..3] OF MC_CamSwitch;
    CamSwitchRef   : CAMSWITCH_REF;
END_VAR

MC_CamSwitch

(* real number of defined digital cams *)
CamSwitchRef.NumberOfSwitches := 1; (* 1..3 *)
(* pointer to the digital cam data array *)
CamSwitchRef.pSwitches        := ADR(CamSwitchArray);
(* maximum size of the digital cam data array *)
CamSwitchRef.SizeOfSwitches   := SIZEOF(CamSwitchArray);

Example with two cam tracks

CAMSWITCH_REF 1: