Topic: DMD0069

OPENTCP - Open TCP Connection


The Open TCP Connection (OPENTCP) instruction is used to create a TCP Client connection to a TCP Server.

 

Note: Open TCP Connection (OPENTCP) is NOT used to communicate via Modbus/TCP protocol. This instruction is used to implement a custom protocol over a TCP/IP connection. Use the built-in Modbus/TCP Client instructions Modbus Network Read (MRX) and Modbus Network Write (MWX) to communicate via Modbus/TCP protocol.

 

Open TCP Connection (OPENTCP) is a Multi-Scan instruction.

 

The gray triangle at the right end of the input leg in the ladder display indicates the input is edge triggered.

 

Parameters:

Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.

 

TCP Device - designates which of the pre-configured TCP Client Connections to open.

 

Note: Before this instruction can select a TCP Client Connection, one must be configured. Part of the configuration for a TCP Client Connection is assigning it a name. It is that name which will show up in the TCP Device selection drop-down menu. For more information on configuring devices refer to the Device Configuration Section under System Configuration.

 

no devices available - indicates that there are no Devices that can execute this instruction. The most likely causes are there are no SMTP Devices configured, or the CPU does not have an onboard Ethernet port.

 

    • create device - select this option to invoke the Device Configuration dialog of the System Configuration to create a new device of the appropriate type

 


To IP Address - specifies the IP Address of the TCP Server to open a connection to. The IP Address can be specified in one of the two following ways:

 

  • Variable Address - the IP address resides in the specified memory location in the Do-more Controller. This can be any readable DWord numeric location. The Hexadecimal equivalent of each octet of the IP Address is stored in a byte of the Variable Address location, in reverse order, for example: IP Address 192.168.000.006 in Hex would be C0.A8.00.06, and stored in the Variable Address location as 0600A8C0.

  •  

     

  • Fixed Address - the IP Address is entered as 4 separate decimal numbers, each one ranging from 0 to 255.
    IP Addresses 0.0.0.0, 127.0.0.1, and 255.255.255.255 are not allowed.
    Note:
    Invoking the Element Browser (F9) for this field will bring up the IP Address Lookup utility that can find the IP Address for a given name.

 

TCP Port Number - specifies the IP Port number to use when opening the connection. This can be any positive integer between 1 and 65535, or any readable numeric location.

 


On Success: - designates one of the following two options if the Open TCP Connection operation is successful:

 

  • SET BIT - The specific BIT location will be SET OFF when the Open TCP Connection (OPENTCP) instruction is first enabled, and then SET ON if the operation is successful. This value can be any writable bit location.
     

  • JMP to Stage - JMP to the specified Stage. The target Stage must be in the same Program as the Open TCP Connection (OPENTCP) instruction, you cannot specify a Stage in a different Program. This selection will function the same as a standalone Jump to Stage instruction. Click here for more information on the Jump To Stage instruction.

 

On Error: - designates one of the following two options if the Open TCP Connection operation is unsuccessful:
 

  • SET BIT - The specific BIT location will be SET OFF when the Open TCP Connection (OPENTCP) instruction is first enabled, and then SET ON if the operation is unsuccessful. This value can be any writable bit location.
     

  • JMP to Stage - JMP to the specified Stage. The target Stage must be in the same Program as the Open TCP Connection (OPENTCP) instruction, you cannot specify a Stage in a different Program. This selection will function the same as a standalone Jump to Stage instruction. Click here for more information on the Jump To Stage instruction.

 


See Also:

 


Related Topics:

 


Example Using Stages:

 


Rung Example: