Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Software > Programming
Minimize Text   Default    Enlarge Text
 

Print
E-mail

CP1L-EL/EM: TCP Active Open Socket Function Block


TCP Active Open Socket
Name Open_Socket: TCP Active Open Socket
 
Basic Function Request for open Socket 1, 2 or 3 and Output the opened Socket Number
Symbol  
Originates from Tsunagi Lab Europe
Created by OEE-HQ HvB (creation and testing)
File Name Open_Socket.cxf
Applicable models CPU Unit CP1L-EL or CP1L-EM
CX-Programmer Version 9.40 or higher
Conditions for usage None.
Function Description TCP Active Open_Socket Function Block opens one of the three Sockets that is available and Outputs the opened Socket Number. If all three of the Sockets are occupied the No Sockets available flag will be high.
Kind of FB definition Connect Always ON type
  Connect the EN input to the Always ON Flag (P_ON)
  The same instance cannot be used in two or more places
FB Precautions Socket Number Output is a single Request to open Socket Value. The Socket Number Output is only reset when a new Open Socket trigger is active.

Omron can not be held responsible in case of malfunction.

EN input condition • Connect EN to condition for the FB to Work
• Open Socket send the Request for Open an Available Socket
• IP Address
• Port Number
Restrictions
  Input variables
None.
  Output variables • This FB requires multiple cycles to process.
• The status of the Outputs bits are Reset if the OpenSocket bit is OFF. Except for the SocketNo Output.
Application example TCP Active Open_Socket Function Block is designed for use with the other Function Blocks. For more more details on the use of this function block see also CP1L-EL/EM Modbus TCP Client Socket Services.
The Socket Number Output can be used for the Socket Number Input used by :

- Fn03_ReadRegister
- Fn04_ReadInputRegister
- Fn05_ForceSingleCoil
- Fn06_WriteRegister
- Close_Socket

Example:


Related manuals CP1L-EM/EL CPU Unit Manual (W516-E1)
  • Variable Table 

Input Variables

Name Variable name Data type Default Range Description
EN EN BOOL     1 (ON): Starts FB
0 (OFF): Does not start FB
Open Socket OpenSocket BOOL     Start request for open socket
IP address 1 IPaddress_1 INT   &0 to &255 Specify the local IP address. For example 192.168.250.2: IPaddress_1 = &192, IPaddress_2 = &168, IPaddress_3 = &250, IPaddress_4 = &2
IP address 2 IPaddress_2 INT   &0 to &255  
IP address 3 IPaddress_3 INT   &0 to &255  
IP address 4 IPaddress_4 INT   &0 to &255  
Local Port Number LocalPortNo UINT   &0 to 65535 If port number 0 is specified the TCP port number will be automatically allocated and the number of the port that was opened will be stored in the local UDP/TCP port number in the Socket Service Parameter Area (i.e., the actual port number will be overwritten on the value of 0 set by the user).
Do not specify the port being used as the FINS UDP port (default: 9600), TCP port numbers 20, 21 and 25.
As a rule, use port numbers 1,024 and higher.
Remote Port Number RemotePortNo UINT   &0 to 65535 When opening a passive TCP socket, the combination of the remote IP address and the remote TCP port number can be used to affect processing as shown in the table for the Remote IP Address, above. If the Remote UDP/TCP Port No. is set to 0, the UDP/TCP port number of the remote device will be written as the Remote UDP/TCP Port No. in the Socket Service Parameter Area.

Modbus Portno = &502
 

Output Variables

Name Variable name Data type Range Description
ENO ENO BOOL   1 (ON): FB operating normally
0 (OFF): FB not operating normally
No link NoLink BOOL   No cable connection
No Sockets NoSockets BOOL   No sockets availble
Done Done BOOL   Done
Socket Number SocketNo UNIT   Opened Socket number
Error Error BOOL   Error
Error ID ErrorID UNIT   Error code:
TCP/UDP Error Codes
Ethernet Units Construction of Networks Operation Manual (W420)
7-3 Command/Response Reference FINS Error Codes Communications Commands Reference Manual (W342)
5-1-3 Error Codes CP1L-EL/EM CPU Unit Operation Manual (W516) 12-1 Troubleshooting

Revision History

Version Date Contents
1.00 21-Apr-2012 Original production
1.01 13-July-2012 Added Local Port Number.
Open Socket Request even if Storage Error Flag is ON for the socket.

Note

This manual is a reference that explains the function block functions. It does not explain the operational limitations of Units, components, or combinations of Units and components. Always read and understand the Operation Manuals for the system’s Units and other components before using them.

 



Attachments

Open_Socket.pdf - Size: 124571
Open_Socket.cxf - Size: 3806


Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2012-04-17
Modified 2013-11-21
Views 19310

 

You are not logged in.