0% found this document useful (0 votes)
116 views

SCL Code PDF

This document contains a function block program for a PLC that sorts boxes by weight. The program defines inputs like recipe number, weight sensor value, and scale status. It also defines outputs to control rollers and display the weight. The program uses the recipe number to set flags to control which rollers are activated for different box sizes. It stores the weight in an array, then uses weight thresholds to determine which roller flags to set based on the box size. The weight is also converted to a display integer value.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

SCL Code PDF

This document contains a function block program for a PLC that sorts boxes by weight. The program defines inputs like recipe number, weight sensor value, and scale status. It also defines outputs to control rollers and display the weight. The program uses the recipe number to set flags to control which rollers are activated for different box sizes. It stores the weight in an array, then uses weight thresholds to determine which roller flags to set based on the box size. The weight is also converted to a display integer value.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Totally Integrated

Automation Portal

Sorting_weight_Udemy / PLC_1 [CPU 1212C AC/DC/Rly] / Program blocks


Block_1 [FC1]
Block_1 Properties
General
Name Block_1 Number 1 Type FC Language SCL
Numbering automatic
Information
Title Author Comment Family
Version 0.1 User-defined
ID

Block_1
Name Data type Default value Comment
Input
recipe Int
count Int present counts of counter
weight Real sensor
at_scale Bool on the sensor
Output
left roller Bool
right roller Bool
weight_display DInt
temp Array[0..2] of Real
temp[0] Real
temp[1] Real
temp[2] Real
InOut
Temp
Sorting Array[0..5] of Bool
Sorting[0] Bool
Sorting[1] Bool
Sorting[2] Bool
Sorting[3] Bool
Sorting[4] Bool
Sorting[5] Bool
Constant
Return
Block_1 Void

0001 //Recipe Logic


0002 IF #recipe = 0 THEN
0003 #Sorting[0] := 0;
0004 #Sorting[1] := 0;
0005 #Sorting[2] := 0;
0006 #Sorting[3] := 1;
0007 #Sorting[4] := 1;
0008 #Sorting[5] := 0;
0009 END_IF;
0010
0011 IF #recipe = 1 THEN
0012 #Sorting[0] := 0;
0013 #Sorting[1] := 1;
0014 #Sorting[2] := 1;
0015 #Sorting[3] := 0;
0016 #Sorting[4] := 0;
0017 #Sorting[5] := 0;
0018 END_IF;
0019
0020 IF #recipe = 2 THEN
0021 #Sorting[0] := 1;
0022 #Sorting[1] := 0;
0023 #Sorting[2] := 0;
0024 #Sorting[3] := 0;
0025 #Sorting[4] := 0;
0026 #Sorting[5] := 1;
0027 END_IF;
0028
0029 IF #recipe > 2 OR #recipe < 0 THEN
0030 #recipe := 0;
0031 END_IF;
0032
0033 //Storing Box information
0034 IF #at_scale = 1 THEN
0035 #temp[#count] := #weight;
0036 END_IF;
0037
0038 //Large Box
0039 IF #temp[#count] > 7.0 AND #temp[#count] < 8.0 THEN
0040 #"left roller" := #Sorting[0];
0041 #"right roller" := #Sorting[1];
0042 END_IF;
0043
0044 //Medium Box
0045 IF #temp[#count] > 4.5 AND #temp[#count] < 5.5 THEN
Totally Integrated
Automation Portal

0046 #"left roller" := #Sorting[2];


0047 #"right roller" := #Sorting[3];
0048 END_IF;
0049
0050 //Small Box
0051 IF #temp[#count] > 3.5 AND #temp[#count] < 4.5 THEN
0052 #"left roller" := #Sorting[4];
0053 #"right roller" := #Sorting[5];
0054 END_IF;
0055 //For displaying Weight on Panel
0056 #weight_display := REAL_TO_DINT(#weight * 10.0) ;
0057
0058

Symbol Address Type Comment


#"left roller" Bool
#"right roller" Bool
#at_scale Bool on the sensor
#count Int present counts of counter
#recipe Int
#Sorting Array
#temp Array
#weight Real sensor
#weight_display DInt

You might also like