CAMSWITCH_REF
The data type CAMSWITCH_REF refers to a data structure with cam parameters for a digital cam controller MC_DigitalCamSwitch, MC_DigitalCamSwitch_MultiEdge or MC_DigitalCamSwitch_EL5131.
TYPE CAMSWITCH_REF :
STRUCT
NumberOfSwitches : UDINT;
pSwitches : POINTER TO MC_CamSwitch;
SizeOfSwitches : UDINT;
END_STRUCT
END_TYPEName | Type | Description |
|---|---|---|
NumberOfSwitches | UDINT | Number of array elements used. Can be less than the maximum number. |
pSwitches | POINTER TO MC_CamSwitch | Pointer to the digital cam array. |
SizeOfSwitches | UDINT | Maximum size of the digital cam array. |
The actual data structure used for the parameterization of a digital cam switch is typically an ARRAY OF MC_CamSwitch. CAMSWITCH_REF points to this structure and uniquely defines the size of the structure and the number of cams actually used.
The upper limit for the number of cams is set to 1,000 here. If the application requires a larger number of cams and to generally optimize computational load, only a subset of the cams within the temporal “vicinity” of the current position should be passed to the MC_DigitalCamSwitch , MC_DigitalCamSwitch_MultiEdge, or MC_DigitalCamSwitch_EL5131.
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(* 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
