8 example: manually generated cam, Example: manually generated cam, L-force | plc designer - softmotion – Lenze PLC Designer PLC-Designer (R2-x) SoftMotion User Manual
Page 106

L-force | PLC Designer - SoftMotion
CAM editor
Example: manually generated cam
106
L
DMS 5.2 EN 03/2011 TD17
5.8
Example: manually generated cam
This example illustrates how to create a cam in the IEC program without using the editor:
The cam created now can be entered in the MC_CamTableSelect POU and its output can in
turn be reused for MC_CamIn.
Variable declaration:
CAM: MC_CAM_REF:=(
byType:=2, (* non-equidistant )
byVarType:=2, (* UINT *)
nElements:=128,
xStart:=0,
xEnd:=360);
Table: SMC_CAMTable_UINT_128_1:=(
fEditorMasterMin := 0, fEditorMasterMax := 360,
fTableMasterMin := 0, fTableMasterMax := 65536,
fEditorSlaveMin := 0, fEditorSlaveMax := 360,
fTableSlaveMin := 0, fTableSlaveMax := 65536);
Program part:
(* Create cam (a line for example); unique *)
FOR i:=0 TO 127 DO
Table.Table[i][0]:=Table.Table[i][1]:=REAL_TO_UINT(i / 127.0 * 65536);
END_FOR
(* Link pointers, this must be done in every cycle!!! *)
CAM.pce := ADR(Table);