274 • Keyboard Commands
Key Combinations
'Extras' 'Zoom Action/Transition' |
<Alt>+<Enter> |
|
|
Move back to the editor from the SFC Overview |
<Enter> |
|
|
|
|
Work with the PLC Configuration |
|
Open and close organization elements |
<Enter> |
|
|
Place an edit control box around the name |
<Spacebar> |
|
|
'Extras' 'Edit Entry' |
<Enter> |
|
|
|
|
Work with the Task Configuration |
|
Place an edit control box around the taskor filename |
<Spacebar> |
|
|
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32
11Data Types
11.1 Standard Data types
You can use standard data types and user-defined data types when programming. Each identifier is assigned to a data type which dictates how much memory space will be reserved and what type of values it stores.
BOOL type variables may be given the values TRUE and FALSE. 8 bits of memory space will be reserved.
(see also: BOOL constants)
BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, and UDINT are all integer data types.
Each of the different number types covers a different range of values. The following range limitations apply to the integer data types:
Type |
Lower limit |
Upper limit |
Memory space |
BYTE |
0 |
255 |
8 Bit |
|
|
|
|
WORD |
0 |
65535 |
16 Bit |
|
|
|
|
DWORD |
0 |
4294967295 |
32 Bit |
|
|
|
|
SINT: |
-128 |
127 |
8 Bit |
|
|
|
|
USINT: |
0 |
255 |
8 Bit |
|
|
|
|
INT: |
-32768 |
32767 |
16 Bit |
|
|
|
|
UINT: |
0 |
65535 |
16 Bit |
|
|
|
|
DINT: |
-2147483648 |
2147483647 |
32 Bit |
|
|
|
|
UDINT: |
0 |
4294967295 |
32 Bit |
|
|
|
|
As a result when larger types are converted to smaller types, information may be lost.
see also : Numerical Constants
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32
276 • Data Types
Standard Data types
REAL is a so-called floating-point type. REAL is required to represent rational numbers. 32 bits of memory space is reserved for REAL.
see also Appendix F: REAL constants
A STRING type variable can contain any string of characters. The size entry in the declaration determines how much memory space should be reserved for the variable. It refers to the number of characters in the string and can be placed in parentheses or square brackets. If no size specification is given, the default size of 80 characters will be used.
Example of a String Declaration with 35 characters:
str:STRING(35):='This is a String';
see also : STRING constants
The data types TIME, TIME_OF_DAY (abb. TOD), DATE and
DATE_AND_TIME (abb. DT) are handled internally like DWORD.
Time is given in milliseconds in TIME and TOD, time in TOD begins at 12:00 A.M.
Time is given in seconds in DATE and DT beginning with January 1, 1970 at 12:00 A.M.
See in the following the time data formats used to assign values for time constants:
TIME constants:
always made up of an initial "t" or "T" (or "time" or "TIME" spelled out) and a number sign "#".
This is followed by the actual time declaration which can include days (identified by "d"), hours (identified by "h"), minutes (identified by "m"), seconds (identified by "s") and milliseconds (identified by "ms"). Please note that the time entries must be given in this order according to length (d before h before m before s before m before ms) but you are not required to include all time increments.
Examples of correct TIME constants in a ST assignment:
TIME1 := T#14ms;
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32
Data Types • 277
Standard Data types
TIME1 := T#100S12ms; (*The highest component may be allowed to exceed its limit*)
TIME1 := t#12h34m15s;
the following would be incorrect:
TIME1 := t#5m68s; |
(*limit exceeded in a lower |
component*) |
|
TIME1 := 15ms; |
(*T# is missing*) |
TIME1 := t#4ms13d; |
(*Incorrect order of entries*) |
DATE Constants:
beginning with a "d", "D", "DATE" or "date" followed by "#". You can then enter any date with format Year-Month-Day.
Examples:
DATE#1996-05-06
d#1972-03-29
TIME_OF_DAY Constants, for storing times of the day:
begin with "tod#", "TOD#", "TIME_OF_DAY#" or "time_of_day#" followed by a time with the format: Hour:Minute:Second. Seconds can be entered as real numbers or you can enter fractions of a second.
Examples:
TIME_OF_DAY#15:36:30.123
tod#00:00:00
DATE_AND_TIME Constants, combination of date and the time of day:
begin with "dt#", "DT#", "DATE_AND_TIME#" or "date_and_time#". Place a hyphen after the date followed by the time.
Examples:
DATE_AND_TIME#1996-05-06-15:36:30
dt#1972-03-29-00:00:00
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32
278 • Data Types
11.2 Defined Data Types
One-, two-, and three-dimensional fields (arrays) are supported as elementary data types. Arrays can be defined both in the declaration part of a POU and in the global variable lists.
Syntax:
<Field_Name>:ARRAY [<ll1>..<ul1>,<ll2>..<ul2>] OF <elem. Type>.
ll1, ll2, ll3 identify the lower limit of the field range; ul1, ul2 and ul3 identify the upper limit. The range values must be integers.
Example:
Card_game: ARRAY [1..13, 1..4] OF INT;
Initializing Arrays:
Example for complete initialization of an array:
arr1 : ARRAY [1..5] OF INT := 1,2,3,4,5;
arr2 : ARRAY [1..2,3..4] OF INT := 1,3(7); (* short for 1,7,7,7 *)
arr3 : ARRAY [1..2,2..3,3..4] OF INT := 2(0),4(4),2,3; (* short for 0,0,4,4,4,4,2,3 *)
Example of the initialization of an array of a structure:
TYPE STRUCT1
STRUCT
p1:int;
p2:int;
p3:dword;
END_STRUCT
ARRAY[1..3] OF STRUCT1:= (p1:=1;p2:=10;p3:=4723),(p1:=2;p2:=0;p3:=299), (p1:=14;p2:=5;p3:=112);
Example of the partial initialization of an Array:
arr1 : ARRAY [1..10] OF INT := 1,2;
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32