• 沒有找到結果。

9. Program

9.7. Error Process

9.7.1. Error Code List

The error codes of this program are shown below.

●Error flag (Error end/timeout) [Output_ErrCode]

If the connect processing, send processing, receive processing or close processing ends in error or times out, the error flag will be set in the Output_ErrCode variable.

Error flag Description

16#0000 Normal end

16#0001 The send processing ended in error.

16#0002 The receive processing ended in error.

16#0004 The connect processing ended in error.

16#0008 The close processing ended in error.

16#0100 The send processing did not end in time.

16#0200 The receive processing did not end in time.

(Including when an arrival of the response cannot be checked.) 16#0400 The connect processing did not end in time.

16#0800 The close processing did not end in time.

16#0010 Processing number error

16#0020 Send/Receive required/not required detection error 16#1000 Destination device error

16#2000 Destination device FCS (checksum) error 16#8000 Error occurrence

*The error flags detected for each processing are added and the addition result is stored in the error flag.

(Example) Error end of connect TCP socket instruction + Time out of close status check WORD#16#8000 (Error occurrence)

+WORD#16#0001 (Error end of TCP socket connect instruction) +WORD#16#0100 (Timeout of close status check)

Output_ErrorID: WORD#16#8101

●Error codes [Output_SktCmdsErrorID], [Output_SkTcloseErrorID]

If an error occurs in the connect processing, send processing or receive processing, the error code is stored in the Output_SktCmdsErrorID variable and then the close processing is performed.

If an error occurs in the close processing, the error code is stored in the

Output_SkTcloseErrorID variable and the processing ends. The main error codes are shown below.

Error code Description

16#0000 Normal end

16#0400 An input parameter for an instruction exceeded the valid range for an input variable.

The results of instruction processing exceeded the data area range of the output parameter.

16#0407

16#2000 An instruction was executed when there was a setting error in the local IP address.

Address resolution failed for a destination node with the domain name that was specified in the instruction.

16#2002

The status was not suitable for execution of the instruction.

16#2003

•SktTCPConnect Instruction

The TCP port that is specified with the SrcTcpPort input variable is already connected.

The destination node that is specified with DstAdr input variable does not exist.

The destination node that is specified with DstAdr and DstTcpPort input variables are not waiting for a connection.

•SktTCPRcv Instruction

The specified socket is receiving data.

The specified socket is not connected.

•SktTCPSend Instruction

The specified socket is sending data.

The specified socket is not connected.

16#2006 A timeout occurred for a socket service instruction.

16#2007 The handle that is specified for the socket service instruction is not correct.

The maximum resources that you can use for socket service instructions at the same time was exceeded.

16#2008

16#FFFF Processing ended without completing the executing of an instruction.

Additional Information

For details, refer to A-1 Error Code Details and A-2 Error Code Descriptions under Appendices in the NJ-series Instructions Reference Manual (Cat. No. W502).

Additional Information

For details on the socket service errors and troubleshooting, refer to 9-7 Precautions in Using Socket Services of Chapter 9 Socket Service in the NJ-series CPU Unit Built-in EtherNet/IP Port User's Manual (Cat. No. W506).

●TCP connection status error [Output_EtnTcpSta]

If the TCP connection status does not enter the normal status (_CLOSED) in time after the close processing, a TCP connection status code is set in the Output_EtnTcpSta variable.

Error code enumerator

_eCONNECTION_STATE Description

_CLOSED Connection closed. (Normal status) Waiting for connection

_LISTEN

SYN sent in active status.

_SYN SENT

SYN sent and received.

_SYN RECEIVED

Already established.

_ESTABLISHED

FIN received and waiting for completion.

_CLOSE WAIT

Completed and FIN sent.

_FIN WAIT1

Completed and exchanged FIN. Awaiting ACK.

_CLOSING

FIN received and completed. Awaiting ACK.

_LAST ACK

Completed and ACK received. Awaiting FIN.

_FIN WAIT2

After closing, pauses twice the maximum segment life (2MSL).

_TIME WAIT

●Destination device error code

The destination device error code is stored in the Output_MErrCode variable.

If a destination device error occurs, the response data will be “ER”.

Error No. Error name

16#0000 0000 Normal end

16#4552 0000 The error response from the destination device (“ER” is received.)

Additional Information

For details and troubleshooting the destination device errors, refer to Troubleshooting in Chapter 7 APPENDIX of the Confocal Fiber Type Displacement Sensor User's Manual (Cat.

No. Z322).

9.7.2. TCP Connection Status Error and Corrective Action

This section describes the status when a TCP connection status error occurs and explains the corrective action.

●Affects of a TCP connection status error

After a TCP connection status error occurs, if this program is executed again without taking any corrective action or without notifying the error, then the destination node specified with the destination IP address (DstAdr) input variable and destination port (DstTcpPort) input variable may not be waiting for a connection. (Hereinafter this error is referred to as a connect processing error.) This may be affected by the TCP connection status error that occurred when the previous communication processing ended. (For error details, refer to 9.7.1 Error Code List.)

●Status when a TCP connection status error occurs

Both the TCP connection status error after the close processing and a connect processing error that occurs when the next communications processing is performed can be caused by the fact that the close processing is not completed at the destination device. In this situation, although all processing (until the close processing) of the program ended in the Controller, the close processing completion notification is not received from the destination device (The completion of the close processing is not confirmed at the destination device).

●Corrective action

The close processing may not be completed at the destination device. Check if the communications port of the destination device is closed. If not closed or not possible to check, reset the communications port of the destination device. The communications port of the destination device can be reset by executing restart operation from the software or by cycling the power supply. For details, refer to the manual for each destination device.

Precautions for Correct Use

Make sure that the destination device is disconnected from other device before resetting the communications port of the destination device.

●Controller status when a TCP connection status error occurs

When the TCP connection status error occurs, the processing of this program is completed.

However, the resend/time monitoring function of TCP/IP, which is described in 9.3.2. Time Monitoring Function, may be operating. This resend processing will stop in the following cases. Therefore, you do not have to stop it.

•When a connect processing request is made again by re-executing the program

•When a communications problem such as cable disconnection is cleared during resend processing

•When the resend processing is completed with the TCP/IP time monitoring (timeout) function

•When the Controller restarts or the power supply is turned OFF

相關文件