Unity TCP Open Block Library Users Manual
Unity TCP Open Block Library Users Manual
TCP Open
Block Library
33002551.01
September 2004
Table of Contents
Part I General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 1
Chapter 2
11
12
13
16
Chapter 3
General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
General points and principles of Open TCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chapter 4
Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Notes and Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Chapter 5
Description of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
At a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operating Rules for Open TCP EFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Principle governing socket operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
General Structure of an Open TCP communication EF . . . . . . . . . . . . . . . . . . .
Structure of Open TCP management parameters. . . . . . . . . . . . . . . . . . . . . . . .
Management parameters: communication and operation reports. . . . . . . . . . . .
The client/server model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example of client/server applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
28
29
31
32
34
36
38
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Appendices
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Appendix A
System objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
At a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
System bit introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Description of system bits %S15 to %S21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Description of system words %SW12 to %SW18 . . . . . . . . . . . . . . . . . . . . . . . 100
Glossary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Index
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
At a Glance
Document Scope
This document describes the functions and function blocks of the TCP Open library.
This document is valid for Unity Pro Version 2.0.
Validity Note
The data and illustrations found in this document are not binding. We reserve the
right to modify our products in line with our policy of continuous product development. The information in this document is subject to change without notice and
should not be construed as a commitment by Schneider Electric.
Product Related
Warnings
Schneider Electric assumes no responsibility for any errors that may appear in this
document. If you have any suggestions for improvements or amendments or have
found errors in this publication, please notify us.
No part of this document may be reproduced in any form or by any means, electronic
or mechanical, including photocopying, without express written permission of
Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when
installing and using this product. For reasons of safety and to ensure compliance
with documented system data, only the manufacturer should perform repairs to
components.
When controllers are used for applications with technical safety requirements,
please follow the relevant instructions.
Failure to use Schneider Electric software or approved software with our hardware
products may result in injury, harm, or improper operating results.
Failure to observe this product related warning can result in injury or equipment
damage.
User Comments
We welcome your comments about this document. You can reach us by e-mail at
TECHCOMM@modicon.com
General
I
Introduction
Overview
This section contains general information about the TCP Open library.
What's
in this Part?
Chapter Name
Page
11
19
General
10
1
Introduction
Overview
This chapter describes the different block types and their applications.
What's
in this Chapter?
Page
Block types
12
FFB Structure
13
EN and ENO
16
11
Block types
Block types
Different block types are used in Unity Pro. The general term for all block types is
FFB.
There are the following types of block:
l Elementary Function (EF)
l Elementary Function Block (EFB)
l Derived Function Block (DFB)
l Procedure
Elementary
Function
Elementary functions (EF) have no internal status.. If the input values are the same,
the value at the output is the same for all executions of the function, e.g. the addition
of two values gives the same result at every execution.
An elementary function is represented in the graphical languages (FDB and LD) as
a block frame with inputs and an output. The inputs are always represented on the
left and the outputs always on the right of the frame The name of the function, i.e.
the function type, is shown in the center of the frame.
The number of inputs can be increased with some elementary functions.
Elementary
function block
Elementary function blocks (EFB) have an internal status. If the inputs have the
same values, the value on the output can have another value during the individual
executions. For example, with a counter, the value on the output is incremented.
An elementary function block is represented in the graphical languages (FDB and
LD) as a block frame with inputs and outputs. The inputs are always represented on
the left and the outputs always on the right of the frame The name of the function
block, i.e. the function block type, is shown in the center of the frame. The instance
name is displayed above the frame.
Derived
function block
Derived function blocks (DFBs) have the same properties as elementary function
blocks. They are created by the user in the programming languages FBD, LD, IL
and/or ST.
Procedure
12
FFB Structure
Structure
Each FFB is made up of an operation (name of the FFB), the operands required for
the operation (formal and actual parameters) and an instance name for elementary/
derived function blocks.
Call of a function block in the FBD programming language:
Instance name
Operation
Operand
(FFB name)
Formal
parameter
Actual
parameter
MY_TON
TON
ENABLE
EXAMP
TIME1
EN
IN
PT
ENO
Q
ET
ERROR
OUT
TIME2
Operands
13
Operation
The operation determines which function is to be executed with the FFB, e.g. shift
register, conversion operations.
Operand
The operand specifies what the operation is to be executed with. With FFBs, this
consists of formal and actual parameters.
Formal/actual
parameters
Inputs and outputs are required to give values to the FFB or to take values from the
FFB. These are called formal parameters.
Objects are connected to the formal parameters which contain the current process
states. These are called actual parameters.
During program runtime, the actual parameters are used to pass the process values
to the FFB and output them after processing.
The data type of the actual parameters must match the data type of the input/output
(formal parameters). The only exceptions are generic inputs/outputs, for which the
data types are determined by the actual parameters. If all actual parameters are
literals, the correct data type for the function block will be selected.
In text languages IL and ST, FFBs can be called in formal and in informal form.
Details can be found in the Reference manual.
Example of a formal function call:
out:=LIMIT (MN:=0, IN:=var1, MX:=5) ;
Example of an informal function call:
out:=LIMIT (0, var1, 5) ;
Note: Take note that the use of EN and ENO is only possible for formal calls.
14
VAR_IN_OUT
variable
FFBs are often used to read a variable on an input (input variables), to process them
and output the changed value of the same variable again (output variables).
This is special case for an input/output variable and is also called VAR_IN_OUT
variable.
The input and output variable are linked in the graphic languages (FBD and LD)
using a line showing that they belong together.
Function block with VAR_IN_OUT variable in FBD:
MY_EXAMP1
EXAMP1
Input1
Input2
Comb_IN_OUT
IN1
IN2
IO1
OUT1
OUT2
IO1
Output1
Output2
Comb_IN_OUT
15
EN and ENO
Description
FunctionBlock_2
ENO
OUT
EN
IN1
IN2
ENO
OUT
ENO
OUT
FunctionBlock_2
OUT1
EN
IN1
IN2
ENO
OUT
16
l Functions/Procedures
As defined in IEC61131-3, the outputs from deactivated functions (EN-input set
to "0") is undefined. (The same applies for procedures.)
Nevertheless here is an explanation of the output statuses for this case:
l EN/ENO-handling with function/procedure blocks that (only) have one
connection as output parameter:
Function/Procedure_1
EN
IN1
IN2
Function/Procedure_2
ENO
OUT
ENO
OUT
EN
IN1
IN2
ENO
OUT
Function/Procedure_2
OUT1
EN
IN1
IN2
ENO
OUT
"Unconditional" or "conditional" calls are possible with each FFB. The condition is
realized by pre-linking the input EN.
l EN connected
conditional calls (the FFB is only processed if EN = 1)
l EN not used or set to TRUE
unconditional calls (FFB is always processed)
17
Note for LD
In LD, each FFB must be connected with the left power rail using a Boolean input.
Normally, the EN input is used for this purpose.
If the EN input is not connected to the left power rail, it cannot be used or it must be
permanently set to TRUE because otherwise the FFB will never be processed.
Note for IL
and ST
The use of EN and ENO is only possible in the text languages for a formal FFB call,
e.g.
MY_BLOCK (EN:=enable, IN1:=var1, IN2:=var2,
ENO=>error, OUT1=>result1, OUT2=>result2);
Assigning the variables to ENO must be done with the operator =>.
With an informal call, EN and ENO cannot be used.
18
Not all blocks are available on all hardware platforms. The blocks which are
available on your hardware platform can be found in the following tables.
Advanced
Block type
Premium
Quantum
FCT_ACCEPT
Procedure
FCT_BIND
Procedure
FCT_CLOSE
Procedure
FCT_CONNECT
Procedure
FCT_LISTEN
Procedure
FCT_RECEIVE
Procedure
FCT_SELECT
Procedure
FCT_SEND
Procedure
FCT_SETSOCKOPT
Procedure
FCT_SHUTDOWN
Procedure
FCT_SOCKET
Procedure
Legend:
+
available
not available
19
20
II
At a Glance
Subject
of this Part
This part introduces the Open TCP service which can be used with Elementary
Functions (EF) in Unity Pro.
What's
in this Part?
Chapter Name
Page
General
23
Warnings
25
Description of Operation
27
43
21
22
General
3
General points and principles of Open TCP
At a Glance
Open TCP for Premium is a set of Elementary Functions (EFs) and Derived Function
Blocks (DFB) in order to provide TCP/IP services in an automation application on
Premium PLCs.
The TCP Open EFs and DFBs are installed from a CD. Once installed in Unity Pro,
they appear in the TCP Open library in the Advanced family.
These preset functions can be used for TCP/IP Client/Server applications without
having to have any knowledge of programming languages such as C ++ or Java.
Programming is carried out directly using the EFs and DFBs in the desired automation language (ST, LD, FBD or IL).
This Open TCP is available on the following modules:
23
General
24
Warnings
4
Notes and Warnings
At a Glance
Notes
To use the Open TCP EF library you must have a minimum working knowledge of
TCP/IP applications and of how a socket system operates.
The implementation of Client/Server services follows certain programming rules
which you must understand.
WARNING
Prerequisites for implementation of Open TCP EFs.
The implementation and maintenance of Open TCP should only be
performed by qualified personnel, with the necessary skills to handle
sockets. This document should not be considered to represent
adequate training for someone who is not otherwise qualified to develop
TCP/IP services.
Although all reasonable precautions have been taken to ensure that the
information provided here is accurate and authoritative, no
responsibility is assumed by Schneider Electric for any consequences
arising from the use of this document.
Failure to follow this precaution can result in death, serious injury,
or equipment damage.
25
Warnings
Responsibilities
26
Description of Operation
5
At a Glance
Subject
of this Chapter
This chapter describes the principles governing the operations and implementation
of a TCP/IP service using preset Open TCP EFs.
What's
in this Chapter?
Page
28
29
31
32
34
36
38
27
Operation
Open TCP EFs are executed asynchronously with the PLC cycle. Each EF call
triggers a transaction with the Ethernet module concerned (TSX ETY 5103 or
TSX ETY 110WS).
The transaction starts at the end of the PLC cycle and may take several cycles to
complete. It is therefore necessary to manage the sequencing of calls so as not to
saturate the module or request an action before the previous one is complete.
It is possible to call several TCP/IP services in the same PLC cycle. However, it is
not certain that they will be processed in the chronological order in which they were
called.
Note: we advise you to wait until the execution of one function is complete before
requesting a new service on the same socket.
For example, wait for the FCT_SOCKET EF to be returned before calling the
FCT_BIND EF, and wait for the FCT_BIND EF to be returned before calling the
FCT_LISTEN EF.
EFs Supplied
The number of Open TCP functions supplied, as well as the manner in which they
are used have been deliberately reduced in order to simplify the implementation of
these services.
In addition to this, certain parameters are a requirement of the TSX ETY 5103
module. These limitations are detailed as part of the description of the FCT_SOCKET
(See FCT_SOCKET: Creation of a new socket, p. 89) function.
28
Operation
The socket is the basic element of TCP communication. It is the socket which
transports data.
The TCP/IP function library only provides sockets for flow management and
connection between two devices.
Note: In the Premium architecture, the socket descriptors are assigned numbers 1
to 32. Numbers 1 to 16 are assigned to listening sockets. Numbers 17 to 32 are
assigned to connected sockets.
A socket is created by the FCT_SOCKET (See FCT_SOCKET: Creation of a
new socket, p. 89) function which returns a number. This number is then used
to access this socket.
Establishing
a Connection
The following table describes the different steps that need to be created on the
server in order to establish a connection.
Step
Action
Associate the created socket with an address (Port number and IP address)
using the FCT_BIND (See FCT_BIND: Binds a socket number to an
IP address and a port, p. 55 ) function.
29
Operation
Exchanging
Data over a
TCP Connection
Once a connection has been established, data can be transferred. Transfers are
carried out using the FCT_SEND (See FCT_SEND: Sending data to a
specified socket, p. 77) and FCT_RECEIVE (See FCT_RECEIVE:
Retrieves data available on a socket, p. 69) functions. The diagram
below shows how these exchanges work.
Connection
Application
Managing
Sockets
TCP
TCP
Send
buffers
Receive
buffers
Receive
buffers
Send
buffers
Application
30
Operation
l An interface number
l Specific parameters
l Management parameters.
Interface Number
This interface number is coded over one integer. It corresponds to the slot number
of the ETY module in the main rack.
Note: only rack 0 can take an Ethernet module which uses Open TCP
communication functions.
Specific
Parameters
These parameters are specific to each function. There may be more than one, in
which case they are separated by commas. They are described in the chapters
specific to each function.
Management
Parameters
31
Operation
The management parameters are grouped together in a array of four integers. The
values contained in this array are used to control the communication functions.
Structure
Activity bit
The table below describes the data structure of the communication management
table:
Word order
Reserved
Activity bit
operation report
communication report
Reserved
Length
32
Operation
Operation Report
Communication
Report
Length
The length parameter is used with the FCT_SEND (See FCT_SEND: Sending
data to a specified socket, p. 77) and FCT_RECEIVE (See
FCT_RECEIVE: Retrieves data available on a socket, p. 69)
functions.
You must indicate the number of bytes to send when you use the FCT_SEND
function and when you are receiving data (FCT_RECEIVE function), the system
writes the number of bytes received.
33
Operation
Communication
Report
This report is common to all functions. It is significant when the activity bit changes
from 1 to 0.
Reports whose value is between 16#01 and 16#FE concern errors detected by the
processor which executed the function.
The different values of this report are indicated in the following table:
Value
16#00
Exchange successful
16#01
16#05
16#06
16#07
16#0B
16#0E
16#FF
Message refused
Note: The function can detect an error in the parameters before activating the
exchange. In this case, the activity bit remains at 0 and the report is initialized with
the values corresponding to the fault.
34
Operation
Operation Report
This report byte describes the result of interaction of the function with the TCP/IP
stack of the network module.
It is significant only if the communication report has the following values:
If this report has a value equal to 16#00, the operation report is specific to each
function. It is described in the chapters devoted to these functions.
If the communication report has the value 16#FF, the operation report has the
following values:
Value
16#0B
Inadequate system resources (too many EFs in the same PLC cycle)
16#0C
35
Operation
The client/server model consists of two entities, one of which acts as a server, and
which responds to requests and the other of which is a client, which makes the
request.
The client/server model operates according to a specific protocol which must be
implemented at either end of the connection.
This protocol is described in the following paragraphs.
Note: if you are developing your own client/server application , you are responsible
for testing and managing the connections.
Description
36
l
l
l
l
Operation
Illustration
FCT_SOCKET()
FCT_SOCKET()
FCT_BIND(Si)
FCT_BIND(Si)
FCT_CONNECT()
FCT_LISTEN(Si)
FCT_SEND()
FCT_RECEIVE()
FCT_ACCEPT(Si)
FCT_SELECT()
FCT_RECEIVE(Sj)
Processing
FCT_SEND(Sj)
NO
End?
Processing
YES
FCT_CLOSE()
Key:
Si is assigned to the address: IP_a, Port_a
Sj is assigned to the external socket with the address: IP_b, Port_b
37
Operation
38
Operation
Example 1
The diagram below describes how a server application operates when processing
two connections requested by two clients.
FCT_SOCKET()
FCT_SOCKET()
FCT_BIND(Si)
FCT_BIND(Si)
FCT_CONNECT()
FCT_SEND()
FCT_LISTEN(Si)
FCT_SELECT()
FCT_ACCEPT(Si)
FCT_RECEIVE(Sj)
FCT_RECEIVE(Sj)
FCT_SEND(Sj)
FCT_SEND(Sj)
FCT_RECEIVE(Sk)
FCT_SELECT(Sj)
FCT_SEND(Sk)
FCT_RECEIVE()
Processing
NO
End
YES
FCT_CLOSE()
FCT_BIND(Si)
FCT_CONNECT()
NO
FCT_SEND()
FCT_RECEIVE()
Event
on Si
YES
Processing
NO
FCT_ACCEPT(Si)
NO
END?
YES
FCT_CLOSE(Sj)
FCT_CLOSE(Sk)
End
YES
FCT_CLOSE()
Key:
Si is assigned to the address: IP_a, Port_a
Sj is assigned to the external socket with the
address: IP_b, Port_b
Sk is assigned to the address IP_c, Port_c
39
Operation
Example 2
40
The diagram below describes how a server application operates when processing
two connections requested by the same client. The first disconnection was not made
in accordance with correct TCP procedure (e.g.: power failure). The socket is
considered to still be connected as long as the client has not made a new
connection.
Operation
FCT_SOCKET()
FCT_SOCKET()
FCT_BIND(Si)
FCT_BIND(Si)
FCT_CONNECT()
FCT_SEND()
FCT_LISTEN(Si)
FCT_SELECT()
FCT_ACCEPT(Si)
FCT_RECEIVE(Sk)
FCT_RECEIVE(Sj)
FCT_BIND(Si)
FCT_CONNECT()
FCT_SELECT()
FCT_SEND()
FCT_SEND(Sk)
FCT_RECEIVE()
NO
Evt or
socket +1
END?
Processing
NO
YES
YES
End
FCT_ACCEPT(Si)
FCT_CLOSE(Sk)
YES
FCT_CLOSE()
FCT_CLOSE(Sj)
41
Operation
Example 3
The diagram below describes how a server application operates when processing
two connections requested by the same client. The first disconnection was not made
in accordance with correct TCP procedure (e.g.: power failure). As long nothing has
been sent by the server, the socket is still considered to be connected.
FCT_SOCKET()
FCT_SOCKET()
FCT_BIND(Si)
FCT_CONNECT()
FCT_SEND()
FCT_LISTEN(Si)
FCT_ACCEPT(Si)
FCT_SELECT()
FCT_ACCEPT(Si)
FCT_RECEIVE(Sj)
FCT_RECEIVE(Sk)
FCT_SEND(Sj)
FCT_SEND(Sk)
FCT_CONNECT()
Evt
FCT_SELECT()
FCT_SEND()
FCT_RECEIVE()
NO
FCT_CLOSE(Sj)
END?
Processing
NO
FCT_SELECT()
YES
End
Evt
FCT_CLOSE(Sk)
YES
YES
FCT_CLOSE()
Key:
Si is assigned to the address: IP_a, Port_a
Sj is assigned to the external socket with the address: IP_b, Port_b
Sk is assigned to the address IP_b, Port_b, a new socket is created on receiving the second request from the client.
42
Operating modes
and performance
At a Glance
Subject
of this Chapter
This chapter is intended to provide you with an introduction to the operating modes,
the basic notions required for debugging and the performance characteristics of the
TSX ETY 5103 module (Ethernet module supporting Open TCP functions).
What's
in this Chapter?
Page
44
Performance
46
47
43
l
l
l
l
Sending the
configuration
to the module
44
l
l
l
l
l
Operating
mode after
configuration
Once a configuration has been defined, the module operates in the following way:
Step
Action
The module is ready to process the Open TCP communication functions of the
application.
WARNING
Pay attention to restart management.
The programmer must test the system bits %S0 and %S1 in his
application in order to re-create the connections if a warm or cold start
has been performed.
Failure to follow this precaution can result in death, serious injury,
or equipment damage.
45
Performance
Number of
simultaneous
connections
Data Exchanges
The maximum chunk of data that can be sent in one PLC cycle is 240 bytes. This
limitation is due to the X-bus mechanism for data transfer between the module and
the processor.
As a result, if you wish to transfer a message of 8 Kbytes, you have to breakdown
your message into blocks of 240 bytes. If you want to guarantee the order in which
the blocks are sent so as to be able to reconstitute the whole message, you must
send one block for each cycle, meaning that it will take 35 PLC cycles in total
(8*1024/240).
Example: for a PLC cycle of 50 ms, this will take 1.75 seconds.
Note: these calculations are based on use of a single socket. If you are managing
several clients you must take into account the number of connected sockets.
For a message oriented protocol, a lower level interface has to manage the
fragmentation process. Here, performance depends on the number of FCT_SEND or
FCT_RECEIVE functions executed in the same PLC cycle.
These performances can be reduced depending on the degree to which the
TSX ETY 5103 module is used for other communications tasks (IO Scanning,
Global Data etc.).
46
In online mode, Unity Proware can be used to debug the application using the
application-specific debug screens.
The module debug screen can be used to do this. However, you should note that:
IP
Communication
Tests
You can use the communication test window to test IP communication with client
devices if the IP address of the client is declared as a remote device (used by the
private profile).
The list of IP addresses configured is used to select the station with which to
communicate by activating a "ping", which feeds back as a status the loop-back or
the time out of the message.
47
48
Advanced
III
Introduction
Overview
This section describes the elementary functions and elementary function blocks of
the Advanced family.
What's
in this Part?
Chapter Name
Page
51
55
59
10
63
11
67
12
69
13
73
14
77
15
81
16
85
17
89
49
Advanced
50
FCT_ACCEPT: Accepts
a connection request
Description
Function
Description
Representation
in FBD
Representation:
FCT_ACCEPT
Module_Number
Socket_Number
Clie_Index
Gest_Index
Management_Param
INTE
SOCK
ICLIE
IGST
GEST
CLIE
Client_Address
GEST
Management_Param
51
FCT_ACCEPT
Representation
in LD
Representation:
FCT_ACCEPT
EN
Module_Number
INTE
Socket_Number
SOCK
Clie_Index
ICLIE
Gest_Index
IGST
Management_Param
GEST
ENO
CLIE
Client_Address
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_ACCEPT Socket_Number, Clie_Index, Gest_Index,
Management_Param, Client_Address
Representation
in ST
Representation:
FCT_ACCEPT(Module_Number, Socket_Number, Clie_Index,
Gest_Index, Management_Param, Client_Address);
52
FCT_ACCEPT
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Clie_Index
INT
Gest_Index
INT
Type
Client_Address
Comment
Type
Management_Param
Comment
53
FCT_ACCEPT
54
Description
Function
Description
The FCT_BIND function is used to assign a port number and an internet address to
a socket.
A socket is created without an address and cannot be used to receive data (except
for connection requests) until it is assigned one. The internet address is fixed by the
network module to its local configured IP address. The user is not allowed to use
some Port numbers because they are already used by the network module. These
port numbers are:
l
l
l
l
l
l
l
l
l
l
55
FCT_BIND
Representation
in FBD
Representation:
FCT_BIND
Module_Number
Socket_Number
Port_Number
Gest_Index
Management_Param
Representation
in LD
INTE
SOCK
PORT
IGST
GEST
GEST
Management_Param
Representation:
FCT_BIND
EN
Module_Number
INTE
Socket_Number
SOCK
Port_Number
PORT
Gest_Index
IGST
Management_Param
GEST
ENO
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_BIND Socket_Number, Port_Number, Gest_Index,
Management_Param
Representation
in ST
Representation:
FCT_BIND(Module_Number, Socket_Number, Port_Number,
Gest_Index, Management_Param);
56
FCT_BIND
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Port_Number
INT
Gest_Index
INT
Type
Comment
Management_Param
ARRAY [0... 3]
OF INT
57
FCT_BIND
58
FCT_CLOSE: Deletes
the specified socket
Description
Function
Description
Note: If the socket number is not indicated or is 0, all open sockets are deleted.
As the sockets were opened with the SO_LINGER option when using FCT_SOCKET,
the FCT_CLOSE function is not blocked, even if the queues have not yet been sent
or been acknowledged.
This is called a "hard" or "abortive" close, because the socket's virtual circuit is reset
immediately, and any unsent data is lost.
Any call to the FCT_RECEIVE function to the other side of the circuit will fail with the
error message: connection reset (16#36).
The additional parameters EN and ENO may be configured.
Representation
in FBD
Representation:
FCT_CLOSE
Module_Number
Socket_Number
Gest_Index
Management_Param
INTE
SOCK
IGST
GEST
GEST
Management_Param
59
FCT_CLOSE
Representation
in LD
Representation:
FCT_CLOSE
EN
Module_Number
INTE
Socket_Number
SOCK
Gest_Index
IGST
Management_Param
GEST
ENO
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_CLOSE Socket_Number, Gest_Index, Management_Param
Representation
in ST
Representation:
FCT_CLOSE(Module_Number, Socket_Number, Gest_Index,
Management_Param);
60
FCT_CLOSE
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Gest_Index
INT
Type
Comment
Management_Param
61
FCT_CLOSE
62
FCT_CONNECT: Establishes
a connection with an IP address
10
Description
Function
Description
Representation
in FBD
Representation:
FCT_CONNECT
Module_Number
Socket_Number
INTE
SOCK
Serv_Index
Gest_Index
Server_Address
Management_Param
ISRV
IGST
SERV
GEST
SERV
GEST
Server_Address
Management_Param
63
FCT_CONNECT
Representation
in LD
Representation:
FCT_CONNECT
EN
Module_Number
INTE
Socket_Number
SOCK
ENO
Serv_Index
ISRV
Gest_Index
IGST
Server_Address
SERV
SERV
Server_Address
Management_Param
GEST
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_CONNECT Socket_Number, Serv_Index,
Gest_Index,Server_Address, Management_Param
Representation
in ST
Representation:
FCT_CONNECT(Module_Number, Socket_Number, Serv_Index,
Gest_Index,Server_Address, Management_Param);
64
FCT_CONNECT
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Serv_Index
INT
Gest_Index
INT
Type
Comment
Server_Address
ARRAY [0... 2]
OF INT
Management_Param
ARRAY [0... 3]
OF INT
65
FCT_CONNECT
66
FCT_LISTEN: Configuration
of a socket await connection
11
Description
Function
Description
Representation
in FBD
Representation:
FCT_LISTEN
Module_Number
Socket_Number
Gest_Index
Management_Param
INTE
SOCK
IGST
GEST
GEST
Management_Param
67
FCT_LISTEN
Representation
in LD
Representation:
FCT_LISTEN
EN
Module_Number
INTE
Socket_Number
SOCK
Gest_Index
IGST
Management_Param
GEST
ENO
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_LISTEN Socket_Number, Gest_Index, Management_Param
Representation
in ST
Representation:
FCT_LISTEN(Module_Number, Socket_Number, Gest_Index,
Management_Param);
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Gest_Index
INT
68
Parameter
Type
Comment
Management_Param
ARRAY [0... 3]
OF INT
12
Description
Function
Description
The FCT_RECEIVE function looks for the data available on the socket. The
maximum length of data to read is 240 bytes.
It returns the numbers of bytes received; this value should always be tested because
this is the only way to check the actual number of data bytes stored in the user
buffer.
Representation:
FCT_RECEIVE
Module_Number
Socket_Number
Pbuf_Index
Gest_Index
Management_Param
INTE
SOCK
IBUF
IGST
GEST
PBUF
Received_Data
GEST
Management_Param
69
FCT_RECEIVE
Representation
in LD
Representation:
FCT_RECEIVE
EN
Module_Number
INTE
Socket_Number
SOCK
Pbuf_Index
IBUF
Gest_Index
IGST
Management_Param
GEST
ENO
PBUF
Received_Data
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_RECEIVE Socket_Number, Pbuf_Index, Gest_Index,
Management_Param, Received_Data
Representation
in ST
Representation:
FCT_RECEIVE(Module_Number, Socket_Number, Pbuf_Index,
Gest_Index, Management_Param, Received_Data);
70
FCT_RECEIVE
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Pbuf_Index
INT
Gest_Index
INT
Type
Received_Data
Comment
Type
Management_Param
Comment
71
FCT_RECEIVE
72
FCT_SELECT: Multiplexes
requests over sockets
13
Description
Function
Description
The FCT_SELECT function is used to multiplex I/O requests among multiple sockets.
It indicates which sockets have events to process using an array of two integers.
In the TSX premium architecture, the socket descriptors are assigned a number
from 1 to 32:
l Numbers 1 from 16 are assigned to sockets created by the socket function. They
are listening sockets.
l Numbers 17 from 32 are assigned to sockets created by the accept function.
They are connected sockets.
The first word of the array corresponds to the listening sockets (bit 0 corresponds to
socket 0) and the second word corresponds to the connected sockets.
The additional parameters EN and ENO may be configured.
Representation
in FBD
Representation:
FCT_SELECT
Module_Number
Mask_Index
Gest_Index
Management_Param
INTE
IMASK
IGST
GEST
MASK
GEST
Socket_Activity
Management_Param
73
FCT_SELECT
Representation
in LD
Representation:
FCT_SELECT
EN
Module_Number
Mask_Index
INTE
ENO
MASK
Socket_Activity
IMASK
Gest_Index
IGST
Management_Param
GEST
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_SELECT Mask_Index, Gest_Index, Management_Param,
Socket_Activity
Representation
in ST
Representation:
FCT_SELECT(Module_Number, Mask_Index, Gest_Index,
Management_Param, Socket_Activity);
74
FCT_SELECT
Description
of Parameters
Type
Comment
Module_Number
INT
Mask_Index
INT
Gest_Index
INT
Type
Comment
Management_Param
ARRAY [0... 3]
OF INT
Type
Comment
Socket_Activity
ARRAY [0... 1]
OF INT
75
FCT_SELECT
76
14
Description
Function
Description
The FCT_SEND function is used to send data to a foreign socket. The maximum
length of data to send is 240 bytes.
Representation:
FCT_SEND
Module_Number
Socket_Number
INTE
SOCK
Pbuf_Index
Gest_Index
Data_to_Send
Management_Param
IBUF
IGST
PBUF
GEST
GEST
Management_Param
77
FCT_SEND
Representation
in LD
Representation:
FCT_SEND
EN
Module_Number
INTE
Socket_Number
SOCK
Pbuf_Index
IBUF
Gest_Index
IGST
Data_to_Send
PBUF
Management_Param
GEST
ENO
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_SEND Socket_Number, Pbuf_Index, Gest_Index,Data_to_Send,
Management_Param
Representation
in ST
Representation:
FCT_SEND(Module_Number, Socket_Number, Pbuf_Index,
Gest_Index,Data_to_Send, Management_Param);
78
FCT_SEND
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Pbuf_Index
INT
Gest_Index
INT
Data_to_Send
ARRAY [0... n]
OF INT
Type
Comment
Management_Param
ARRAY [0... 3]
OF INT
79
FCT_SEND
80
FCT_SETSOCKOPT: Sets
the options associated
with the socket
15
Description
Function
Description
The FCT_SETSOCKOPT function sets options associated with the specified socket.
Some options are set automatically when the socket is created by the FCT_SOCKET
(See FCT_SOCKET: Creation of a new socket, p. 89) function.
The following options are available:
l DONT_ROUTE: indicates that the outgoing data should not be routed. Packets
directed at unconnected nodes are dropped.
Representation:
FCT_SETSOCKOPT
Module_Number
Socket_Number
INTE
SOCK
Option_Type
Gest_Index
Management_Param
OPT
IGST
GEST
GEST
Management_Param
81
FCT_SETSOCKOPT
Representation
in LD
Representation:
FCT_SETSOCKOPT
EN
Module_Number
INTE
Socket_Number
SOCK
Option_Type
OPT
Gest_Index
IGST
Management_Param
GEST
ENO
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_SETSOCKOPT Socket_Number, Option_Type, Gest_Index,
Management_Param
Representation
in ST
Representation:
FCT_SETSOCKOPT(Module_Number, Socket_Number, Option_Type,
Gest_Index, Management_Param);
82
FCT_SETSOCKOPT
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Option_Type
INT
Gest_Index
INT
Type
Comment
Management_Param
83
FCT_SETSOCKOPT
84
FCT_SHUTDOWN: Disables
transmission on the socket
16
Description
Function
Description
Note: the function does not close the socket, and resources assigned to the socket
will not be freed until the FCT_CLOSE is sent. However you should not attempt to
reuse the socket after the FCT_SHUTDOWN function has been executed.
The additional parameters EN and ENO may be configured.
Representation
in FBD
Representation:
FCT_SHUTDOWN
Module_Number
Socket_Number
Shutdown_Option
Gest_Index
Management_Param
INTE
SOCK
HOW
IGST
GEST
GEST
Management_Param
85
FCT_SHUTDOWN
Representation
in LD
Representation:
FCT_SHUTDOWN
EN
Module_Number
INTE
Socket_Number
SOCK
Shutdown_Option
HOW
Gest_Index
IGST
Management_Param
GEST
ENO
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_SHUTDOWN Socket_Number, Shutdown_Option, Gest_Index,
Management_Param
Representation
in ST
Representation:
FCT_SHUTDOWN(Module_Number, Socket_Number, Shutdown_Option,
Gest_Index, Management_Param);
86
FCT_SHUTDOWN
Description
of Parameters
Type
Comment
Module_Number
INT
Socket_Number
INT
Socket number
Shutdown_Option
INT
Gest_Index
INT
Type
Comment
Management_Param
ARRAY [0... 3]
OF INT
87
FCT_SHUTDOWN
88
FCT_SOCKET: Creation
of a new socket
17
Description
Function
Description
The FCT_SOCKET function creates a new socket and returns its socket number. The
socket is a TCP/IP communication entity.
It is created as a STREAM TCP socket with the following options:
l SO_LINGER without timeout. This option controls the action taken when unsent
data is queued on a socket and a FCT_CLOSE function is performed.
Representation:
FCT_SOCKET
Module_Number
Gest_Index
Management_Param
INTE
IGST
GEST
SOCK
GEST
Socket_Number
Management_Param
89
FCT_SOCKET
Representation
in LD
Representation:
FCT_SOCKET
EN
Module_Number
INTE
Gest_Index
IGST
Management_Param
GEST
ENO
SOCK
Socket_Number
GEST
Management_Param
Representation
in IL
Representation:
LD Module_Number
FCT_SOCKET Gest_Index,Management_Param, Socket_Number
Representation
in ST
Representation:
FCT_SOCKET(Module_Number, Gest_Index, Management_Param,
Socket_Number);
90
FCT_SOCKET
Description
of Parameters
Type
Comment
Module_Number
INT
Gest_Index
INT
Type
Comment
Socket_Number
INT
Type
Comment
Management_Param
ARRAY [0... 3]
OF INT
91
FCT_SOCKET
92
Appendices
Introduction
Overview
What's in this
Appendix?
Chapter Name
System objects
Page
95
93
Appendices
94
System objects
A
At a Glance
Subject
of this Chapter
This chapter describes the system bits and words of Unity Pro language.
Note: The symbols, associated with each bit object or system word, mentioned in
the descriptive tables of these objects, are not implemented as standard in the
software, but can be entered using the data editor.
They are proposed in order to ensure the homogeneity of their names in the different
applications.
What's
in this Chapter?
Page
96
97
100
95
System objects
96
The Premium, Atrium and Quantum PLCs use %Si system bits which indicate the
state of the PLC, or they can be used to control how it operates.
These bits can be tested in the user program to detect any functional development
requiring a set processing procedure.
Some of these bits must be reset to their initial or normal state by the program.
However, the system bits that are reset to their initial or normal state by the system
must not be reset by the program or by the terminal.
System objects
Bit
Symbol
Function
Description
Initial
state
Quantum Premium
Atrium
%S15
STRINGERROR
Character
string fault
YES
YES
%S16
IOERRTSK
Task input/
output fault
YES
YES
%S17
CARRY
Rotate shift
output
Normally at 0.
During a rotate shift operation, this takes the
state of the outgoing bit.
YES
YES
97
System objects
Bit
Symbol
Function
Description
%S18
OVERFLOW
Overflow or
arithmetic
error
YES
YES
%S19
OVERRUN
Task period
overrun
(periodical
scanning)
YES
YES
98
Initial
state
Quantum Premium
Atrium
System objects
Bit
Symbol
Function
Description
Initial
state
Quantum Premium
Atrium
%S20
INDEXOVF
Index
overflow
YES
YES
%S21
1RSTTASKRUN
First task
cycle
YES
YES
CAUTION
%S16 for Quantum PLCs
On Quantum, communication errors from modules (NOM, NOE, NWM,
CRA, CRP) and MMS modules are not reported on bits %S10 and
%S16.
It is entirely your responsibility to ensure that these system bits are used
correctly
Failure to follow this precaution can result in injury or equipment
damage.
99
System objects
Word
Symbol
Function
Description
%SW12
UTWPORTADDR
Uni-Telway
terminal
port
address
%SW13
XWAYNETWADDR
Main
address of
the station
%SW14
OSCOMMVERS
Initial
state
NO
YES
254
Indicates the following for the main network
(16#00FE)
(Fipway or Ethway):
l the station number (least significant
byte) from 0 to 127,
l the network number (most significant
byte) from 0 to 63,
(value of the micro-switches on the
PCMCIA card).
NO
YES
Commercia
l version of
PLC
processor
YES
YES
%SW15
OSCOMMPATCH
PLC
processor
patch
version
YES
YES
%SW16
OSINTVERS
Firmware
version of
PLC
processor
YES
YES
100
Quantum Premium
Atrium
System objects
Word
Symbol
Function
Description
%SW17
FLOATSTAT
YES
YES
%SD18
100MSCOUNTER
Absolute
time
counter
YES
YES
Initial
state
Quantum Premium
Atrium
101
System objects
102
Glossary
%I
%IW
According to the IEC standard, %IW indicates an analog input -type language object.
%KW
According to the IEC standard, %KW indicates a constant word-type language object.
%M
%MW
According to the IEC standard, %MW indicates a memory word-type language object.
%Q
%QW
103
Glossary
ADDR_TYPE
This predefined type is used as output for ADDR function. This type is ARRAY[0..5]
OF Int. You can find it in the libset, in the same family than the EFs which use it.
ANL_IN
ANL_IN is the abbreviation of Analog Input data type and is used when processing
analog values. The %IW adresses for the configured analog input module, which
were specified in the I/O component list, are automatically assigned data types and
should therefore only be occupied with Unlocated Variables.
ANL_OUT
ANL_OUT is the abbreviation of Analog Output data type and is used when
processing analog values. The %MW adresses for the configured analog input
module, which were specified in the I/O component list, are automatically assigned
data types and should therefore only be occupied with Unlocated Variables.
104
Glossary
ANY
There is a hierarchy between the different types of data. In the DFB, it is sometimes
possible to declare which variables can contain several types of values. Here, we
use ANY_xxx types.
The following diagram shows the hierarchically-ordered structure:
ANY
ANY_ELEMENTARY
ANY_MAGNITUDE_OR_BIT
ANY_MAGNITUDE
ANY_NUM
ANY_REAL
REAL
ANY_INT
DINT, INT, UDINT, UINT
TIME
ANY_BIT
DWORD, WORD, BYTE, BOOL
ANY_STRING
STRING
ANY_DATE
DATE_AND_TIME, DATE, TIME_OF_DAY
EBOOL
ANY_DERIVED
ANY_ARRAY
ANY_ARRAY_ANY_EDT
ANY_ARRAY_ANY_MAGNITUDE
ANY_ARRAY_ANY_NUM
ANY_ARRAY_ANY_REAL
ANY_ARRAY_REAL
ANY_ARRAY_ANY_INT
ANY_ARRAY_DINT
ANY_ARRAY_INT
ANY_ARRAY_UDINT
ANNY_ARRAY_UINT
ANY_ARRAY_TIME
ANY_ARRAY_ANY_BIT
ANY_ARRAY_DWORD
ANY_ARRAY_WORD
ANY_ARRAY_BYTE
ANY_ARRAY_BOOL
ANY_ARRAY_ANY_STRING
ANY_ARRAY_STRING
ANY_ARRAY_ANY_DATE
ANY_ARRAY_DATE_AND_TIME
ANY_ARRAY_DATE
ANY_ARRAY_TIME_OF_DAY
ANY_ARRAY_EBOOL
ANY_ARRAY_ANY_DDT
ANY_STRUCTURE
ANY_DDT
ANY_IODDT
ANY_FFB
ANY_EFB
ANY_DFB
105
Glossary
ARRAY
Base 10 literals
A literal value in base 10 is used to represent a decimal integer value. This value can
be preceded by the signs "+" and "-". If the character "_" is employed in this literal
value, it is not significant.
Example:
-12, 0, 123_456, +986
Base 16 Literals
Base 2 Literals
A literal value in base 2 is used to represent a binary integer. The base is determined
by the number "2" and the sign "#". The signs "+" and "-" are not allowed. For greater
clarity when reading, you can use the sign "_" between bits.
Example:
2#1111_1111 or 2#11111111 (in decimal 255)
2#1110_0000 or 2#11100000 (in decimal 224)
Base 8 Literals
A literal value in base 8 is used to represent an octal integer. The base is determined
by the number "8" and the sign "#". The signs "+" and "-" are not allowed. For greater
clarity when reading, you can use the sign "_" between bits.
Example:
8#3_77 or 8#377 (in decimal 255)
8#34_0 or 8#340 (in decimal 224)
106
Glossary
BCD
BOOL
BOOL is the abbreviation of Boolean type. This is the elementary data item in
computing. A BOOL type variable has a value of either: 0 (FALSE) or 1 (TRUE).
A BOOL type word extract bit, for example: %MW10.4.
BYTE
When 8 bits are put together, this is callad a BYTE. A BYTE is either entered in
binary, or in base 8.
The BYTE type is coded in an 8 bit format, which, in hexadecimal, ranges from
16#00 to 16#FF
DATE
The DATE type coded in BCD in 32 bit format contains the following information:
Limits
Comment
Year
[1990,2099]
Year
Month
[01,12]
Day
[01,31]
[01,30]
[01,29]
[01,28]
107
Glossary
DATE_AND_
TIME
see DT
DBCD
DDT
DFB
DINT
108
Glossary
DT
Limits
Comment
Year
[1990,2099]
Year
Month
[01,12]
Day
[01,31]
[01,30]
[01,29]
[01,28]
Hour
[00,23]
Minute
[00,59]
Second
[00,59]
109
Glossary
DWORD
Lower limit
Upper limit
Hexadecimal
16#0
16#FFFFFFFF
Octal
8#0
8#37777777777
Binary
2#0
2#11111111111111111111111111111111
Representation examples:
Data content
00000000000010101101110011011110
16#ADCDE
00000000000000010000000000000000
8#200000
00000000000010101011110011011110
2#10101011110011011110
EBOOL
EBOOL is the abbrevation of Extended Boolean type. It can be used to manage rising
or falling edges, as well as forcing.
An EBOOL type variable takes up one byte of memory.
EF
110
Glossary
EFB
Elementary
Function
see EF
EN
ENO
ENO means Error NOtification, this is the output associated to the optional input EN.
If ENO is set to 0 (caused by EN=0 or in case of an execution error),
l the outputs of function blocks remain in the status they were in for the last correct
executed scanning cycle and
l the output(s) of functions and procedures are set to "0".
FBD
FFB
Collective term for EF (Elementary Function), EFB (Elementary Function Block) and
DFB (Derived Function block)
Function
see EF
Function Block
Diagram
see FBD
111
Glossary
GRAY
Gray or "reflected binary" code is used to code a numerical value being developed
into a chain of binary configurations that can be differentiated by the change in
status of one and only one bit.
This code can be used, for example, to avoid the following random event: in pure
binary, the change of the value 0111 to 1000 can produce random numbers between
0 and 1000, as the bits do not change value altogether simultaneously.
Equivalence between decimal, BCD and Gray:
Decimal
BCD
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Gray
0000 0001 0011 0010 0110 0111 0101 0100 1100 1101
IEC 61131-3
IL
INF
-INF
-3.402824e+38
INF
-1.1754944e-38
0.0
1.1754944e-38
3.402824e+38
Glossary
INT
Integer Literals
Integer literal are used to enter integer values in the decimal system. The values can
have a preceding sign (+/-). Individual underlines (_ ) between numbers are not
significant.
Example:
-12, 0, 123_456, +986
IODDT
Keyword
LD
Located
variables
A located variable is a variable for which it is possible to know its position in the PLC
memory. For example, the variable Water_pressure, is associated with%MW102.
Water_pressure is said to be localized.
113
Glossary
Multiple Token
Operating mode of an SFC. In multitoken mode, the SFC may possess several
active steps at the same time.
Naming
conventions
(Identifier)
NAN
Used to indicate that a result of an operation is not a number (NAN = Not A Number).
Example: calculating the square root of a negative number.
Note: The IEC 559 standard defines two classes of NAN: quiet NAN (QNAN) and
signaling NaN (SNaN) QNAN is a NAN with the most significant fraction bit set and a
SNAN is a NAN with the most significant fraction bit clear (Bit number 22). QNANs
are allowed to propagate through most arithmetic operations without signaling an
exception. SNAN generally signal an invalid-operation exception whenever they
appear as operands in arithmetic operations (See %SW17 and %S18).
114
Glossary
Network
l In LD:
Procedure
115
Glossary
REAL
INF
-1.1754944e-38
0.0
1.1754944e-38
3.402824e+38
l
l
l
l
Note: The IEC 559 standard defines two classes of NAN: quiet NAN (QNAN) and
signaling NaN (SNaN) QNAN is a NAN with the most significant fraction bit set and a
SNAN is a NAN with the most significant fraction bit clear (Bit number 22). QNANs
are allowed to propagate through most arithmetic operations without signaling an
exception. SNAN generally signal an invalid-operation exception whenever they
appear as operands in arithmetic operations (See %SW17 and %S18).
Real Literals
with Exponent
116
Glossary
SFC
Single Token
Operating mode of an SFC chart for which only a single step can be active at any
one time.
ST
STRING
TIME
The type TIME expresses a duration in milliseconds. Coded in 32 bits, this type
makes it possible to obtain periods from 0 to 2 32-1 milliseconds.
The units of type TIME are the following: the days (d), the hours (h), the minutes (m),
the seconds (s) and the milliseconds (ms). A literal value of the type TIME is
represented by a combination of previous types preceded by T#, t#, TIME# or
time#.
Examples: T#25h15m, t#14.7S, TIME#5d10h23m45s3ms
Time literals
The units of type TIME are the following: the days (d), the hours (h), the minutes (m),
the seconds (s) and the milliseconds (ms). A literal value of the type TIME is
represented by a combination of previous types preceded by T#, t#, TIME# or
time#.
Examples: T#25h15m, t#14.7S, TIME#5d10h23m45s3ms
TIME_OF_DAY
see TOD
117
Glossary
TOD
Limits
Comment
Hour
[00,23]
Minute
[00,59]
Second
[00,59]
Example: TOD#23:59:45.
Token
TOPO_ADDR_
TYPE
This predefined type is used as output for READ_TOPO_ADDR function. This type
is an ARRAY[0..4] OF Int. You can find it in the libset, in the same family than the
EFs which use it.
118
Glossary
UDINT
UINT
UINT is the abbreviation of Unsigned integer format (coded on 16 bits). The lower
and upper limits are as follows: 0 to (2 to the power of 16) - 1.
Example:
0, 65535, 2#1111111111111111, 8#177777, 16#FFFF.
Unlocated
variable
Variable
Memory entity of the type BOOL, WORD, DWORD, etc., whose contents can be modified
by the program during execution.
119
Glossary
WORD
The WORD type is coded in 16 bit format and is used to carry out processing on bit
strings.
This table shows the lower/upper limits of the bases which can be used:
Base
Lower limit
Upper limit
Hexadecimal
16#0
16#FFFF
Octal
8#0
8#177777
Binary
2#0
2#1111111111111111
Representation examples
120
Data content
0000000011010011
16#D3
1010101010101010
8#125252
0000000011010011
2#11010011
B
AC
Index
Symbols
%S15, 97
%S16, 97
%S17, 97
%S18, 98
%S19, 98
%S20, 99
%S21, 99
%SD18, 101
%SW12, 100
%SW13, 100
%SW14, 100
%SW15, 100
%SW16, 100
%SW17, 101
Numerics
100MSCOUNTER, 101
1RSTTASKRUN, 99
Block types, 12
C
CARRY, 97
Client/server example
Open TCP, 38
Client/server model
Open TCP, 36
Conditional FFB Call, 17
Configuration of a socket to await connection
FCT_LISTEN, 67
Creation of a socket
FCT_SOCKET, 89
121
Index
Debugging
Open TCP, 47
Deletes the socket
FCT_CLOSE, 59
Derived function block, 12
Diagnostics
Open TCP, 47
Disables transmission on the socket
FCT_SHUTDOWN, 85
Management parameters
Open TCP, 32
Management table
Open TCP, 32
Multiplexes requests over sockets
FCT_SELECT, 73
E
Elementary Function, 12
Elementary function block, 12
EN, 16
ENO, 16
Establishes IP connection
FCT_CONNECT, 63
F
FCT_ACCEPT, 51
FCT_BIND, 55
FCT_CLOSE, 59
FCT_CONNECT, 63
FCT_LISTEN, 67
FCT_RECEIVE, 69
FCT_SELECT, 73
FCT_SEND, 77
FCT_SETSOCKOPT, 81
FCT_SHUTDOWN, 85
FCT_SOCKET, 89
FLOATSTAT, 101
O
Open TCP
Client/server example, 38
Client/server model, 36
Debugging, 47
Diagnostics, 47
Management table, 32
Operating modes of the network module,
44
Performance, 46
Report, 32
Reports, 34
Operating modes of the network module
Open TCP, 44
OSCOMMPATCH, 100
OSCOMMVERS, 100
OSINTVERS, 100
OVERFLOW, 98
OVERRUN, 98
P
Performance
Open TCP, 46
Procedure, 12
INDEXOVF, 99
IOERRTSK, 97
Report
Open TCP, 32
Reports
Open TCP, 34
Retrieves data from a socket
FCT_RECEIVE, 69
122
Index
S
Sending data to a specified socket
FCT_SEND, 77
Sets the socket options
FCT_SETSOCKOPT, 81
Socket/IP binding
FCT_BIND, 55
STRINGERROR, 97
U
Unconditional FFB Call, 17
UTWPORTADDR, 100
X
XWAYNETWADDR, 100
123
Index
124