Programming
(Original Document)
Introduction
The module calculates the position reading from an incremental encoderconnected to its inputs. Depending on this position and the cam programtransferred which describes the recipe, the module controls its outputs.
This program contains the minimum number of steps required to ensure that the cam function starts up correctly. It is sufficient here for each step to set the commands required to activate the output to 1. For this example, we have used an IODDT called Ex_cam of type T_CCY_GROUP0.
SFC
This illustration describes an example of SFC.
Step 0 -> 1
(* start cycle? *)
%M0
Action on activation step 1
(* Initializing enable and assignment parameters *)
(* assigning track 0 to output 0 *)
Ex_cam.Group0_And_Bits := 16#0001;
(* Enabling group 0 outputs *)
SET (Ex_cam.outs_Enable);
(* Reset faults *)
SET (Ex_cam.ack_flt);
Step 1 -> 2
(* default? *)
NOT Ex_cam.ch_error
Action on activation step 2
(* Enabling angle recalibration function *)
SET (Ex_cam.preset_ang_Enable);
Step 2 -> 3
(* Counter recalibrated? *)
Ex_cam.ang_ok
Action on activation step 3
(*setting the cam processor to run *)
SET (Ex_cam.pcam_start_stop);
Step 3 -> 4
(* cam processor in RUN? *)
Ex_cam.pcam_on
Action on activation step 4
(* enabling cam *)
SET (Ex_cam. ENAB_GROUP0_BITS.0);
Variables used
Address
Symbol
Comments
%M0
Dcy
Start cycle
%I0.3.0.Err
Ex_cam.ch_error
Channel error bit
%I0.3.0.0
Ex_cam.ang_ok
Valid angle reading
%I0.3.0.3
Ex_cam.pcam_on
Cam processor RUN/STOP
%Q0.3.0.0
Ex_cam.preset_ang_Enable
Enables (re)calibration function on angle value only
%Q0.3.0.5
Ex_cam.pcam_start_stop
Set: Cam processor start/ cam processor reset stop
%Q0.3.0.15
Ex_cam.ack_flt
Command to acknowledge faults present
%Q0.3.0.25
Ex_cam.outs_Enable
Global enabling of track outputs
%QW0.3.0.1
Ex_cam.Group0_And_Bits
8 bits for assigning tracks to group outputs
%QW0.3.0.0
Ex_cam.ENAB_GROUP0_BITS
Enabling cam