
- •Important Comments
- •Legal Principles
- •Copyright
- •Personnel Qualification
- •Intended Use
- •Symbols
- •Font Conventions
- •Number Notation
- •Scope
- •Abbreviations
- •Scope of Delivery
- •System Configuration
- •Installation
- •Uninstall
- •Start
- •Important Informations
- •WAGO-I/O-PRO 32 V2.2 Overview
- •What is WAGO-I/O-PRO 32
- •Overview of WAGO-I/O-PRO 32 Functions
- •How is a project structured?
- •How do I set up my project?
- •How can I test my project?
- •Debugging
- •Additional Online Functions
- •Additional WAGO-I/O-PRO 32 Features
- •Summary
- •Project Components
- •Project
- •POU (Program Organization Unit)
- •Function
- •Function Block
- •Function Block Instances
- •Calling a function block
- •Program
- •Action
- •Resources
- •Libraries
- •Data types
- •Visualization
- •Languages
- •Instruction List (IL)
- •Modifiers and operators in IL
- •Structured Text (ST)
- •Expressions
- •Valuation of expressions
- •Assignment operator
- •Calling function blocks in ST
- •RETURN instruction
- •IF instruction
- •CASE instruction
- •FOR loop
- •WHILE loop
- •REPEAT loop
- •EXIT instruction
- •Sequential Function Chart (SFC)
- •Step
- •Action
- •Entry or exit action
- •Active step
- •IEC step
- •Qualifier
- •Implicit variables in SFC
- •SFC Flags
- •Alternative branch
- •Parallel branch
- •Jump
- •Function Block Diagram (FBD)
- •The Continuous Function Chart Editor (CFC)
- •Ladder Diagram (LD)
- •Contact
- •Coil
- •Function blocks in the Ladder Diagram
- •Set/Reset coils
- •Debugging, Online Functions
- •Sampling Trace
- •Debugging
- •Breakpoint
- •Single step
- •Single Cycle
- •Change values online
- •Monitoring
- •Simulation
- •The Standard
- •Programming Example
- •Controlling a Traffic Signal Unit
- •Create POU
- •What does TRAFFICSIGNAL do?
- •What does WAIT do?
- •What does SEQUENCE do?
- •What does PLC_PRG do?
- •"TRAFFICSIGNAL" declaration
- •"TRAFFICSIGNAL" body
- •Connecting the standard.lib
- •"WAIT" declaration
- •"WAIT" body
- •"SEQUENCE" first expansion level
- •Create a SFC diagram
- •Actions and transition conditions
- •"SEQUENCE" second expansion level
- •The result
- •TRAFFICSIGNAL simulation
- •Visualizing a Traffic Signal Unit
- •Creating a new visualization
- •Insert element in Visualization
- •The other traffic lights
- •The TRAFFICSIGNAL case
- •The second traffic signal
- •The ON switch
- •Font in the visualization
- •Components of WAGO-I/O-PRO 32
- •The Main Window
- •Menu bar
- •Tool bar
- •Object Organizer
- •Screen divider
- •Work space
- •Message window
- •Status bar
- •Context Menu
- •Options
- •'Project' 'Options'
- •Options for Load & Save
- •Options for User information
- •Options for Editor
- •Autodeclaration
- •Autoformat
- •Declarations as tables
- •Print margins
- •Comment
- •Tab-Width
- •Font
- •Mark
- •Bitvalues
- •Options for the Desktop
- •Options for Colors
- •Options for Directories
- •Options for Log
- •Options for Build
- •Passwords
- •'Sourcedownload'
- •Options for 'Symbol Configuration'
- •Options for 'Macros'
- •Managing Projects
- •'File' 'New'
- •'File' 'Open'
- •'File' 'Close'
- •'File' 'Save'
- •'File' 'Save as'
- •'File' 'Save/Mail Archive'
- •'File' 'Print'
- •'File' 'Printer setup'
- •'File' 'Exit'
- •'Project' 'Build'
- •'Project' 'Rebuild all'
- •'Project' 'Clean all'
- •'Project' 'Translate into another language'
- •Create translation file
- •Editing of the translation file
- •Translate Project (into another Language)
- •'Project' 'Document'
- •'Project' 'Export'
- •'Project' 'Import'
- •'Project' 'Merge'
- •'Project' 'Compare'
- •'Extras' 'Next difference'
- •'Extras' 'Previous difference'
- •'Extras' 'Accept change'
- •'Extras' 'Accept changed item'
- •'Extras' 'Accept properties'
- •'Extras' 'Accept access rights'
- •'Project' 'Project info'
- •'Project' 'Global Search'
- •'Project' 'Global replace'
- •'Project' 'Check'
- •Unused Variables
- •Overlapping memory areas
- •Access conflict
- •Multiple writes to output
- •User groups
- •'Project' 'Passwords for user groups'
- •Managing Objects in a Project
- •Object
- •Folder
- •'New Folder'
- •'Expand nodes' 'Collapse nodes'
- •'Project' 'Object Delete'
- •'Project' 'Object Add'
- •'Project' 'Object Rename'
- •'Project' 'Object Convert'
- •'Project' 'Object Copy'
- •'Project' 'Object Open'
- •'Project' 'Object Access rights'
- •'Project' 'Object properties'
- •'Project' 'Add Action'
- •'Project' 'Open Instance'
- •'Project' 'Show Call Tree'
- •'Projekt' 'Show cross reference'
- •General Editing Functions
- •'Edit' 'Undo'
- •'Edit' 'Redo'
- •'Edit' 'Cut'
- •'Edit' 'Copy'
- •'Edit' 'Paste'
- •'Edit' 'Delete"
- •'Edit' 'Find'
- •'Edit' 'Find next'
- •'Edit' 'Replace'
- •'Edit' 'Input Assistant'
- •Unstructured Display
- •Stuctured Display
- •'Edit''Declare Variable'
- •'Edit' 'Next error'"
- •'Edit' 'Previous error'"
- •'Edit' 'Macros'
- •General Online Functions
- •'Online-Change' Functionality
- •'Online' 'Login'
- •If the system reports
- •'Online' 'Logout'
- •'Online' 'Download'
- •'Online' 'Run'
- •'Online' 'Stop'
- •'Online' 'Reset'
- •'Online' 'Reset (cold)'
- •'Online' 'Reset (original)'
- •'Online' 'Toggle Breakpoint'
- •'Online' 'Breakpoint Dialog Box'
- •'Online' 'Step over'
- •'Online' 'Step in'
- •'Online' 'Single Cycle'
- •'Online' 'Write values'
- •'Online' 'Force values'
- •'Online' 'Release force'
- •'Online' 'Write/Force' Dialog'
- •'Online' 'Show Call Stack'
- •'Online' 'Flow Control'"
- •'Online' 'Simulation'
- •'Online' 'Communication Parameters'
- •Principle of a gateway system
- •What the communications parameters dialog on the local PC shows
- •Setting up the desired gateway server and channel
- •Setting up a new channel for the local gateway server
- •Tips for editing the parameters in the communications parameters dialogue
- •Quick check in the event of unsuccessful connection attempt to the gateway
- •'Online' 'Sourcecode download'
- •'Online' 'Create bootproject'
- •'Online' 'Write file to controller'
- •'Online' 'Load file from controller'
- •'Window' 'Log'
- •Menu Log
- •Storing the project log
- •Window set up
- •'Window' 'Tile Horizontal'
- •'Window' 'Tile Vertical'
- •'Window' 'Cascade'
- •'Window' 'Arrange Symbols'
- •'Window' 'Close All'
- •'Window' 'Messages'
- •Help when you need it
- •'Help' 'Contents and Index'
- •Main Help Window
- •Index Window
- •Context Sensitive Help
- •The Editors
- •Print margins
- •Comment
- •Zoom to POU
- •Open instance
- •Declaration Editor
- •Declaration Part
- •Input Variable
- •Output Variable
- •Input and Output Variables
- •Local Variables
- •Remanent variables
- •Constants, Typed Literals
- •External variables
- •Keywords
- •Variables declaration
- •AT Declaration
- •'Insert' 'Declarations keywords'
- •'Insert' 'Type'
- •Syntax Coloring
- •Shortcut Mode
- •Autodeclaration
- •Line Numbers in the Declaration Editor
- •Declarations as tables
- •'Insert' 'New Declaration'
- •Pragma instructiion
- •Declaration Editors in Online Mode
- •The Text Editors
- •'Insert''Operators'in text editors
- •'Insert''Operand'in text editors
- •'Insert''Function' in text editors
- •'Insert''Function Block' in text editors
- •Calling POUs with output parameters in text editors
- •The text editors in Online mode
- •'Extras' 'Monitoring Options'
- •Breakpoint Positions in Text Editor
- •How do you set a breakpoint?
- •Deleting Breakpoints
- •What happens at a breakpoint?
- •Line Number of the Text Editor
- •The Instruction List Editor
- •IL in Online mode
- •The Editor for Structured Text
- •The Graphic Editors
- •Zoom
- •Network
- •Label
- •Network Comments,'Extras' 'Options'
- •'Insert' 'Network (after)' or 'Insert' "Network (before)"
- •The network editors in the online mode
- •The Function Block Diagram Editor
- •Cursor positions in FBD
- •How to set the cursor in FBD
- •'Insert' 'Assign' in FBD
- •'Insert' 'Jump' in FBD
- •'Insert' 'Return' in FBD
- •'Insert' 'Box' in FBD
- •'Insert' 'Input'
- •'Insert' 'Output'
- •'Extras' 'Negate
- •'Extras' 'Set/Reset'
- •Cutting, Copying, Pasting, and Deleting in FBD
- •The Function Block Diagram in the Online Mode
- •The Ladder Editor
- •Cursor Positions in the LD Editors
- •'Insert' 'Contact'in LD
- •'Insert' 'Parallel Contact'
- •'Insert' 'Function Block in LD'
- •'Insert''Coil' in LD
- •POUs with EN Inputs
- •'Insert' 'Box with EN in LD'
- •'Insert' 'Function Block with EN'
- •'Insert' 'Function with EN'
- •'Insert' 'Insert at blocks in LD
- •'Insert' 'Jump' in LD
- •'Insert' 'Return' in LD
- •'Extras' 'Paste after' in LD
- •'Extras' 'Paste below'in LD
- •'Extras' 'Paste above' in LD
- •'Extras' 'Negate' in LD
- •'Extras' 'Set/Reset' in LD
- •The Ladder Diagram in the Online Mode
- •The Sequential Function Chart Editor
- •Marking Blocks in the SFC
- •'Insert' 'Step Transition (before)'
- •'Insert' 'Step Transition (after)'
- •'Insert' 'Alternative Branch (right)'
- •'Insert' 'Alternative Branch (left)'
- •'Insert' "Parallel Branch (right)"
- •'Insert' 'Parallel Branch (left)'
- •'Insert' 'Jump'
- •'Insert' 'Transition-Jump'
- •'Extras' 'Paste Parallel Branch (right)'
- •'Extras' 'Add label to parallel branch'
- •Delete a label
- •'Extras' 'Paste after'
- •'Extras' 'Zoom Action/Transition'
- •'Extras' "Clear Action/Transition"
- •'Extras' 'Step Attributes'
- •'Extras' 'Time Overview'
- •'Extras' 'Options'
- •'Extras' 'Associate Action'
- •Sequential Function Chart in Online Mode
- •The Continuous Function Chart Editor (CFC)
- •Cursor positions in the CFC
- •'Insert' 'Box' in the CFC
- •‚Insert' ‚Input' in CFC
- •'Insert' 'Output'in CFC
- •'Insert' 'Jump'in CFC
- •'Insert' 'Label' in CFC
- •'Insert' 'Return' in CFC
- •'Insert' 'Comment' in CFC
- •'Insert' 'Input of box' in CFC
- •'Extras' 'Negate' in CFC
- •'Extras' 'Set/Reset' in CFC
- •'Extras' 'EN/ENO' in CFC
- •‚Extras' ‚Properties...' in CFC
- •Selecting elementsin CFC
- •Moving elementsin CFC
- •Copying elementsin CFC
- •Creating connections
- •Deleting connections
- •Changing connections
- •'Extras' 'Connection marker'
- •Insert inputs/outputs "on the fly"
- •Order of execution
- •'Extras' 'Order' 'Display'
- •'Extras' 'Order' 'Order topologically'
- •'Extras' 'Order' 'One forwards'
- •'Extras' 'Order' 'One backwards'
- •'Extras' 'Order' 'To the beginning'
- •'Extras' 'Order' 'To the end'
- •'Extras' 'Order' 'Order everything according to data flow''
- •'Extras' 'Create macro''
- •'Extras' 'Jump into Macro'
- •'Extras' 'Expand macro'
- •'Extras' 'Back one macro level', 'Extras' 'Back all macro level'
- •Feedback paths in CFC
- •CFC in Online mode
- •Overview of the Resources
- •Global Variables
- •Editing Global Variables
- •Several Variables Lists
- •Global Variables
- •Create a Global Variable List
- •Editing Global Variable Lists
- •Editing Remanent Global Variables Lists
- •Global Constants
- •Variable Configuration
- •‚Insert' 'All Instance Paths'
- •Document Frame
- •Document Frame
- •'Extras' 'Make Docuframe File'
- •'Extras' 'Link Docu File'
- •PLC Browser
- •PLC Configuration
- •PLC Selection
- •Task Configuration
- •Which task is being processed?
- •Working in the Task Configuration
- •'Insert' 'Insert Task' or 'Insert' 'Append Task'
- •'Insert' 'Insert Program Call' or 'Insert' 'Append Program Call'
- •'Extras' 'Edit Entry'
- •'Extras' 'Set Debug Task'
- •Sampling Trace
- •'Extras' 'Trace Configuration'
- •'Extra' 'Start Trace'
- •'Extra' 'Read Trace'
- •'Extra' 'Auto Read'
- •'Extra' 'Stop Trace'
- •Selection of the Variables to be Displayed
- •Display of the Sampling Trace
- •'Extras' 'Cursor Mode'
- •'Extras' 'Multi Channel'
- •'Extras' 'Show grid'
- •'Extras' 'Y Scaling'
- •'Extras' 'Stretch'
- •'Extras' 'Compress'
- •'Extras' 'Save Trace'
- •'Extras' 'Load Trace'
- •Watch and Receipt Manager
- •Watch and Receipt Manager
- •Watch and Receipt Manager in the Offline Mode
- •'Insert' 'New Watch List'
- •'Extras' 'Rename Watch List'
- •'Extras' 'Save Watch List'
- •'Extras' 'Load Watch List'
- •Watch and Receipt Manager in the Online Mode
- •'Extra' 'Monitoring Active'
- •'Extras' 'Write Receipt'
- •'Extras' 'Read Receipt'
- •Force values
- •Library Manager
- •Using the Library Manager
- •Standard Library
- •User-defined Libraries
- •'Insert' 'Additional Library'
- •Remove Library
- •Visualization
- •Visualization
- •Create Visualization
- •Visualization Elements, Insert
- •Visualization Elements, Insert
- •'Insert' 'Rectangle'
- •'Insert' 'Rounded Rectangle'
- •'Insert' 'Ellipse'
- •'Insert' 'Polygon'
- •'Insert' 'Line'
- •'Insert' 'Curve'
- •'Insert' 'Bitmap'
- •'Insert' 'Visualization'
- •'Insert' 'Button'
- •Working with Visualization Elements
- •Selecting Visualization Elements
- •Modifying Visualization Elements
- •Dragging Visualization Elements
- •Copying Visual Elements
- •Changing the Selection and Insert Mode
- •Status Bar in the Visualization
- •Visualization Elements, Configure
- •'Extras' 'Configure'
- •Placeholder
- •'Extras' 'Placeholder list'
- •Shape
- •Text
- •Line width
- •Colors
- •Motion absolute
- •Motion relative
- •Variables
- •Input
- •ToolTip
- •Bitmap
- •Visualization
- •Additional Visualization Element Functions
- •'Extras' 'Send to Front'
- •'Extras' 'Send to Back'
- •'Extras' 'Select Background Bitmap'
- •'Extras' 'Clear Background Bitmap'
- •'Extras' 'Align'
- •'Extras' 'Select All'
- •'Extras' 'Select Mode'
- •'Extras' 'Element list'
- •'Extras' 'Settings'
- •Operation over the keyboard - in online mode
- •'File' 'Print' in online mode
- •Visualizations in libraries
- •DDE Interface
- •DDE Communication with WAGO-I/O-PRO 32
- •Activating the DDE Interface
- •General Approach to Data
- •Which variables can be read?
- •Linking variables using WORD
- •Linking variables using EXCEL
- •Accessing variables with Intouch
- •Keyboard Commands
- •Use of Keyboard
- •Key Combinations
- •Data Types
- •Standard Data types
- •Data types
- •BOOL
- •Integer Data Types
- •REAL
- •STRING
- •Time Data Types
- •Defined Data Types
- •ARRAY
- •Function Checkbounds
- •Pointer
- •Enumeration
- •Structures
- •References
- •Subrange types
- •The IEC Operators
- •The IEC Operators
- •Arithmetic Operators
- •INDEXOF
- •SIZEOF
- •Bitstring Operators
- •Bit-Shift Operators
- •Selection Operators
- •LIMIT
- •Comparison Operators
- •Address Operators
- •Content Operator
- •Calling Operator
- •Type Conversion Functions
- •BOOL_TO Conversions
- •TO_BOOL Conversions
- •Conversion between Integral Number Types
- •REAL_TO Conversions
- •TIME_TO/TIME_OF_DAY Conversions
- •STRING_TO Conversions
- •TRUNC
- •Numeric Functions
- •SQRT
- •ASIN
- •ACOS
- •ATAN
- •EXPT
- •Standard Library Elements
- •String functions
- •LEFT
- •RIGHT
- •CONCAT
- •INSERT
- •DELETE
- •REPLACE
- •FIND
- •Bistable Function Blocks
- •SEMA
- •Trigger
- •R_TRIG
- •F_TRIG
- •Counter
- •CTUD
- •Timer
- •The UTIL.LIB Library
- •UTIL.LIB Library
- •BCD conversion
- •Bit/byte functions
- •EXTRACT
- •PACK
- •PUTBIT
- •UNPACK
- •Mathematical help functions
- •DERIVATIVE
- •INTEGRAL
- •STATISTICS_INT
- •STATISTICS_REAL
- •VARIANCE
- •Controllers
- •Signal generators
- •BLINK
- •Function manipulators
- •CHARCURVE
- •RAMP_INT
- •RAMP_REAL
- •Analogue value processing
- •HYSTERESIS
- •LIMITALARM

Data Types • 283
Defined Data Types
Week.Monday
11.2.1.6References
You can use the user-defined reference data type to create an alternative name for a variable, constant or function block.
Create your references as objects in the Object Organizer under the register card Data types. They begin with the keyword TYPE and end with END_TYPE.
Syntax:
TYPE <Identifier>: <Assignment term>;
END_TYPE
Example:
TYPE message:STRING[50];
END_TYPE;
11.2.1.7Subrange types
A subrange type is a type whose range of values is only a subset of that of the basic type. The declaration can be carried out in the data types register, but a variable can also be directly declared with a subrange type:
Syntax for the declaration in the 'Data types' register:
TYPE <Name> : <Inttype> (<ug>..<og>) END_TYPE;
<Name> |
must be a valid IEC identifier, |
<Inttype> |
is one of the data types SINT, USINT, INT, UINT, DINT, |
|
UDINT, BYTE, WORD, DWORD (LINT, ULINT, |
|
LWORD). |
<ug> |
Is a constant which must be compatible with the basic type |
|
and which sets the lower boundary of the range types. The |
|
lower boundary itself is included in this range. |
<og> |
Is a constant that must be compatible with the basic type, and |
|
sets the upper boundary of the range types. The upper |
|
boundary itself is included in this basic type. |
Examples: |
|
TYPE
SubInt : INT (-4095..4095);
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

284 • Data Types
Defined Data Types
END_TYPE
Direct declaration of a variable with a subrange type:
VAR
i : INT (-4095..4095);
ui : UINT (0..10000);
END_VAR
If a constant is assigned to a subrange type (in the declaration or in the implementation) that does not fall into this range (e.g. 1:=5000), an error message is issued.
In order to check for observance of range boundaries at runtime, the functions
CheckRangeSigned or CheckRangeUnsigned must be introduced. In these, boundary violations can be captured by the appropriate method and means (e.g. the value can be cut out or an error flag can be set.). They are implicitly called as soon as a variable is written as belonging to a subrange type constructed from either a signed or an unsigned type.
Example: In the case of a variable belonging to a signed subrange type (like i, above), the function CheckRangeSigned is called; it could be programmed as follows to trim a value to the permissible range:
FUNCTION CheckRangeSigned : DINT
VAR_INPUT
value, lower, upper: DINT; END_VAR
IF (value < lower) THEN
CheckRangeSigned := lower;
ELSIF(value > upper) THEN
CheckRangeSigned := upper;
ELSE
CheckRangeSigned := value;
END_IF
In calling up the function automatically, the function name CheckRangeSigned is obligatory, as is the interface specification: return value and three parameters of type DINT
When called, the function is parameterized as follows:
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Data Types • 285
Defined Data Types
-value: the value to be assigned to the range type
-lower: the lower boundary of the range
-upper: the upper boundary of the range
-Return value: this is the value that is actually assigned to the range type An assignment i:=10*y implicitly produces the following in this example:
i := CheckRangeSigned(10*y, -4095, 4095);
Even if y for example has the value 1000, then i still has only the value 4095 after this assignment.
The same applies to the function CheckRangeUnsigned: function name and interface must be correct.
FUNCTION CheckRangeUnsigned : UDINT
VAR_INPUT
value, lower, upper: UDINT; END_VAR
Note:
If neither of the functions CheckRangeSigned or CheckRangeUnsigned is present, no type checking of subrange types occurs during runtime! The variable i could then take on any value between –32768 and 32767 at any time!
Attention:
If neither of the functions CheckRangeSigned or CheckRangeUnsigned is present like described above, there can result an endless loop if a subrange type is used in a FOR loop. This will happen when the range given for the FOR loop is as big or bigger than the range of the subrange type !
Example:
VAR
ui : UINT (0..10000); END_VAR
FOR ui:=0 TO 10000 DO
...
END_FOR
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

286 • Data Types
Defined Data Types
The FOR loop will never be finished, because ui cannot get bigger than 10000.
Also take care of the definition of the CheckRange functions when you define the incremental value of a FOR loop !
WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32