This section initiates and uses the Modulo Loop Counter Mode functions and objects.
Illustration of the Labelling _Program Section
This section below is part of the MAST task. It has no condiction defined for it so it is permanently executed:
(*Functions Enabling*)
(*Authorizes Input SYNC to synchronize and start the counting function*)
Encoder.VALID_SYNC:=Waiting_First_Part;
IF Waiting_First_Part
THEN nb_box := 0;
END IF;
(*Once the first part has passed below the sensor, the other functions are enabled.*)
IF Waiting_Other_Parts
THEN
(*Authorizes captures into the Capture 0 register*)
Encoder.VALID_CAPT_0:=1;
(*Authorizes comparators to produce its results*)
Encoder.COMPARE_ENABLE:=1;
(*Call Event task when Counter Roll over*)
Encoder.EVT_MODULO_ENABLE:=1;
(*Enable the output block functions*)
Encoder.OUTPUT_BLOCK_0_ENABLE:=1;
Encoder.OUTPUT_BLOCK_1_ENABLE:=1;
ELSE
(*Function disabling when the conveyor is stopped*)
Encoder.VALID_CAPT_0:=0
Encoder.COMPARE_ENABLE:=0
Encoder.EVT_MODULO_ENABLE:=0
Encoder.OUTPUT_BLOCK_0_ENABLE:=0
Encoder.OUTPUT_BLOCK_1_ENABLE:=0
END IF
(*Definition of the lower and upper threshold values*)
Encoder.LOWER_TH_VALUE:=First_Labelling_Point;
Encoder.UPPER_TH_VALUE:=Second_Labelling_Point;
(*Process Deflection Watching*)
IF Encoder.CAPT_0_VALUE>deflection_parameter=true
THEN last_box_late:=1; (*Default light set ON*)
ELSE last_box_late:=0; (*Default light set OFF*)
END IF
(*If the next part arrives just in the right time, the green indicator lights on*)
IF Encoder.CAPT_0_VALUE = 0
THEN Last_Box_On_Target :=1 (*Green light set ON*)
ELSE Last_Box_On_Target :=0 (*Green light set OFF*)
END IF
Procedure for Creating an ST Section
The table below shows the procedure for creating an ST section for the application.
|
Step
|
Action
|
|
1
|
In Project Browser\Program\Tasks, double-click on MAST,
|
|
2
|
Right-click on Section then select New section. Give your section a name and select ST language.
|
|
3
|
The name of your section appears and can now be edited by double-clicking on it.
|
|
4
|
To use the I/O object, right-click in the editor then click on Data selection and on  .
Click on  on the front of the I/O derived variable Encoder and the list of the I/O objects appears.
Click on the one you need and confirm with OK.
|
NOTE: In the Data selection windows, the IODDT checkbox must be checked to have access to the I/O derived variable Encoder.