PATH_CAMSWITCH_REF

The data type PATH_CAMSWITCH_REF refers to a data structure with cam parameters for a digital cam controller MC_PathDigitalCamSwitch_MultiEdge.

TYPE PATH_CAMSWITCH_REF :
STRUCT
    NumberOfSwitches : UDINT; 
    pSwitches        : POINTER TO MC_PathCamSwitch; 
    SizeOfSwitches   : UDINT; 
END_STRUCT
END_TYPE

Name

Type

Description

NumberOfSwitches

UDINT

Number of array elements used, can be less than the maximum number.

pSwitches

POINTER TO MC_PathCamSwitch

Pointer to an array of switches, transferred with ADR.

SizeOfSwitches

UDINT

Maximum size of the array.

The actual data structure for parameterization of a digital cam controller is usually an ARRAY OF MC_PathCamSwitch. PATH_CAMSWITCH_REF refers to this structure via a POINTER and clearly defines the size of the structure and the number of cams that were actually used.

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

VAR
    CamSwitchArray   : ARRAY[1..3] OF MC_PathCamSwitch;
    CamSwitchRef     : PATH_CAMSWITCH_REF;
END_VAR

(* 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);