St-Language Program Example; Using An St Program In A Function Block - Omron CX-PROGRAMMER V8.1 Operation Manual

Function blocks/ structured text
Table of Contents

Advertisement

ST-language Program Example

Variable type
Input variable
Input variable
Input variable
Input variable
Output variable
Output variable
5-6

ST-language Program Example

5-6-1

Using an ST Program in a Function Block

Converting an Integer
to BCD and
Outputting It as a Text
String
166
• ST-language Algorithm
If bCheck is true, function block 2 is called to calculate the average value.
The 3 values data1, data2, and data3 are passed to function block 2 input
variables input1, input2, and input3 respectively. The result of the calcula-
tion (average) is returned to AVG.
Note The following diagram shows the Average_FB function block called
with specification method A (both function block's variables listed).
IF bCheck = TRUE THEN
Average(input1:=data1,input2:=data2,input3:=data3,aver-
age=>AVG);
ELSE
RETURN;
END_IF;
Function Block 2
• Variable Table
Variable name
EN
BOOL
input1
INT
input2
INT
input3
INT
ENO
BOOL
average
INT
• ST-language Algorithm
Calculates the average value of input1, input2, and input3 and stores the
result in average.
average:=(input1+input2+input3)/3;
(BOOL)
EN
(INT)
Input_Num
(STRING)
Output_String−Output_String
Input Variable
INT Input_Num;
Input-Output Variable
STRING Output_String;
Internal Variable
WORD Num_BCD;
(*Check Input_BCD input parameter (BCD data)*)
IF(Input_BCDNum>=0 & Input_BCD<=16#Num<=9999) THEN
Data type
---
Received from data1
Received from data2
Received from data3
---
Passed to AVG
FB
(BOOL)
ENO
(STRING)
Section 5-6
Passage to/from FB1

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CX-PROGRAMMER V8.1 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Sysmac ws02-cxpc1-v8Sysmac cx-programmer 8.1

Table of Contents

Save PDF