Iec 61131-3 Second edition 2003-01 Programmable controllers – Part 3: Programming languages


Table 18 - Variable initial value assignment features


Download 1.35 Mb.
Pdf ko'rish
bet38/158
Sana17.06.2023
Hajmi1.35 Mb.
#1528208
1   ...   34   35   36   37   38   39   40   41   ...   158
Bog'liq
ourdev 569653

Table 18 - Variable initial value assignment features
No.
Feature/examples
1
 a
Initialization of directly represented variables
VAR AT %QX5.1 : BOOL :=1;
AT %MW6 : INT := 8 ;
END_VAR
Boolean type, initial value = 1
Initializes a memory word to integer 8
2
 a
Initialization of directly represented retentive variables
VAR RETAIN
AT %QW5 : WORD := 16#FF00 ;
END_VAR
At cold restart, the 8 most significant bits of
the 16-bit string at output word 5 are to be
initialized to 1 and the 8 least significant bits
to 0
3
 a
Location and initial value assignment to symbolic variables
VAR
VALVE_POS AT %QW28 : INT := 100;
END_VAR
Assigns output word 28 to the
integer variable VALVE_POS, with
an initial value of 100
4
 a
Array location assignment and initialization
VAR OUTARY AT %QW6 :
ARRAY[0..9] OF INT := [10(1)];
END_VAR
Declares an array of 10 integers to be
allocated to contiguous output locations
starting at %QW6, each with an initial
value of 1
Copyright International Electrotechnical Commission 
Provided by IHS under license with IEC
Not for Resale
No reproduction or networking permitted without license from IHS
--``````-`-`,,`,,`,`,,`---


– 44 –
61131-3 
 IEC:2003(E)
Table 18 - Variable initial value assignment features
No.
Feature/examples
5
Initialization of symbolic variables
VAR
MYBIT : BOOL := 1 ;
OKAY : STRING[10] := 'OK';
END_VAR
Allocates a memory bit to the Boolean
variable MYBIT with an initial value of 1
Allocates memory to contain a string with a
maximum length of 10 characters. After
initialization, the string has a length of 2 and
contains the two-byte sequence of characters
'OK' (decimal 79 and 75 respectively), in an
order appropriate for printing as a character
string

Download 1.35 Mb.

Do'stlaringiz bilan baham:
1   ...   34   35   36   37   38   39   40   41   ...   158




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling