Home

FQ-CR-Series Code Reader

image

Contents

1. Y Busy VE Error end SktTCPRcv r instance Done ete Sees lke l hee dicus SktClose _instance Execute J o d Telose TON _instance Q A SktClose i _instance Busy e ae SktClose r _instance Busy 4 3 2 SktClose _instance Done at 0 l SktClose do qoo _instance Error SktClose _instance ErrorlD 16 000 SktGetTCPStatus instance TcpSta _ XXXXXX Ai E CLOSED f Y 1 Local ErrCode b 3 Close processing error li I Local ErrCode b 11 Timeout S Outputs Tolose 76 0000 X 16 FFFF I Out Sila ees Busy A Status error 63 9 Project File 9 7 Error Process 9 7 1 Error Code List The error codes for this ST program are shown below e CP connection status error Output_EtnTcpSta If the TCP connection status does not enter the normal status CLOSED within a time after the close processing a TCP connection status code is set in the Output EtnTcopSta variable If the close processing ends in error check this also Error code enumerator eCONNECTION STATE CLOSED _ LISTEN _SYN SENT _SYN RECEIVED _ ESTABLISHED _ CLOSE WAIT _FIN WAIT1 _CLOSING LAST ACK FIN WAIT2 _ TIME WAIT Description Connection closed Normal status Waiting for connection SYN sent in active status SYN sent and received Already established FIN received and waiting for completion Completed and FIN sent Completed and
2. o o oo SktTCPRcv v Receive waiting time instance Busy I SktTCPRcv i _instance Busy Essi AM I I instance RcvDat SktTCPRev instance Done I SktTCPRcv _instance Error I ELIGE Rey 1680000 Y 1640000 _instance ErrorlD l Local_ErrCode b 12 Destination device error AE l Output MErrCode 1680000 N 167 SktClose RP instance Busy Destination device error 9 Project File SktTCPSend p instance DOR 4 psc cd SktGetTCPStatus instance _ Do l SktTCPRev instance Execute Tfr TON instance Q I I SktTCPRev i _instance Busy p PT Eli ad SKTCPRov _instance Busy Stopped 41 1 avn nnnun be le I _instance RevDat 1650000 I I SktTCPRev i I _instance Done p ooo A I SKTCPRcv T instance Error 4 l do Dues SktTCPRcv instance ErrorlD 1680000 Local ErrCode b 9 Timeout Output sktCmds ErrorlD 1680000M 16 FFFF I SktClose ei _instance Busy i Timeout No receive data 62 eClose processing SktTCPRCv r _instance Done etc i p SktClose instance Execute ME ers Telose TON i I _instance Q LL SktClose lS o l _instance Busy 5 t SktClose I _instance Busy Stopped 1 SktClose _instance Done SktClose _instance Er
3. Normal operation Receive message 1 31 2E 33 31 20 32 30 31 31 2F 30 38 2F 30 31 OD Receive AF 4B OD lp s O K CR Error operation Receive message 32 9 Project File l 9 3 Error Detection Processing This section explains the error detection processing of this project file 9 3 1 Error Detection in the Project File This project file detects and handles errors of the following items 1 to 4 For information on error codes refer to 9 7 1 Error Code List Controller Destination device 1 Communications errors in TCP socket communications using socket service instructions Errors occurred in a program during TCP socket communications such as Unit error command format error and parameter error are detected as communications errors The error is detected with the socket service instruction argument ErrorlD 2 Timeout errors during communication with the destination device When open processing send processing receive processing or close processing is not normally performed and cannot be completed within the monitoring time it is detected as a timeout error The error is detected with the time monitoring function in the project file For information on the time monitoring function by using the timer in the project file refer to 9 3 2 Time Monitoring Function 3 Errors in the destination device Destination device error The destination device error inclu
4. 0 IpAdr Used for all socket service instructions NULL ARRAYOFB ARRAY 0 0 Send socket service instruction initialization data array YTE 1 OF BYTE Retain Constant Enabled Default value 0 Used for SktT CPSend instruction NULL ARRAYOFB ARRAYT 0 0 Receive socket service instruction initialization data array YTES2 OF BYTE Retain Constant Enabled Default value 0 Used for SktT CPRcv instruction 9 4 2 List of Variables Used in Function Block Function The internal variables used to execute the function blocks in the program are listed below The internal variable is called the instance The name of the function block to use is specified as the data type of the variable elnstances of user defined function blocks Variable name Data type Description ETN ParameterSet ins ParameterSet Ethernet setting Destination IP address etc tance Monitoring time of each processing from the open processing to the close processing ETN SendMessageSet SendMessageSet Sets the send receive processing required not required instance setting and sets a send message ETN ReceiveCheck in ReceiveCheck Stores receive data and detects whether the operation stance ended normally or ended in error For information on the user defined function blocks refer to 9 5 3 Detailed Description of Function Blocks elnstances of timers used in the program Variable name Description Topen TON instance TON Counts the time taken t
5. Detailed Description of Main Program The main program is shown below The communications settings send data command setting and receive data response data check that must be changed according to the destination device are performed in the function blocks ETN ParameterSet ETN SendMessageSet and ETN ReceiveCheck For information on how to change these values refer to 9 5 3 Detailed Description of Function Blocks Main program Program0 1 Communications processing Name NJ series general purpose Ethernet communication program Function General purpose Ethernet communications main program Ethernet Unit NJ501 Built in EtherNet IP port Remarks Version information August 1 2011 V1 00 Mew release C Copyright OMRON Corporation 2011 All Rights Reserved EP ee ee Se eee 1 Communications processing Variable description Communications processing for control Input start flag Input Start Communications processing status flag list Local Status STRUCT Communications processing in progress flag Busy Local Status Busy Communications processing normal end flag Done Local Status Done Communications processing error end flag Error Local Status Error Status processing number Local State LO Initial processing ll Open processing l2 Send processing l3 Receive processing 14 Close processing 99 Processing number error processing 1 1 Starting communications processing start communications processing by t
6. The Controller issues a TCP open request to the destination device and a TCP connection is established The send message set with the ST program is sent from the Controller to the destination device The response data which was received by the Controller from the destination device is stored in specified internal memory The Controller issues a close request to the destination device and the TCP connection is terminated The response data is not sent after receiving a command or the response data is sent immediately after a connection is established depending on the destination device and command With this project file Send receive processing required not required setting can be set for the General purpose Ethernet communications sequence setting function block If Send only is set the response receive processing is not performed If Receive only is set the command send processing is not performed 27 9 Project File 9 1 2 TCP Socket Communications with Socket Service Instructions This section outlines TCP socket communications performed by using the TCP socket service function blocks hereinafter referred to as socket service instructions and send receive process of the message EN Additional Information For details refer to Communications Instructions under Section 2 Instruction Descriptions of NJ series Instructions Reference Manual Cat No W502 e CP Socket Services with Socket Service Instructions
7. Timeout III l Output_sktCmds ErrorlD 160000 16 SktClose Y meme us instance Busy 4 Error end 60 9 Project File eReceive processing SktTCPSend i Done SktTCPSend ren _instance Done instance DONG bs cee a SktGetTCPStatus instance DatRcvFla a SktGetTCPStatus gu m _instance DatRcvFla eee 1 I _instance Execute m SktTCPRev R d _instance Execute L Tr TON instanceQ I Tfr TON instance Q SKtTCPRev Receive waiting time Tr TON instance Q 1 _instance Busy SktTCPRev v SktTCPRev _instance Busy gt gt i instance Busy Fk I I Il SktTCPRcv L FET uur gt pct E SktT CPRcv 1 6 instance Busy e ad 3i s _instance RcvDat is XP I k N i SktTCPRcv UC T8000 TB Yas nstance Done ___ instance RcvDat EAT T UE 164 i SK TCPRev SktTCPRov erin n I i instance Error A _ 2 FT i SktTCPRev SktTCPRev y 1640000 Y instance ErrorlD 1650000 16 0000 _instance ErrorlD Local_ErrCode b 9 Local_ErrCode b 9 Timeout meen Output_sktCmds _ __________ ErrorlD 1620000 I Output sktCmds 1640000 ErrorlD lt lt SktClose p _instance Busy Repeat Normal end SktTCPSend Anstaice Done Ass ies esses ale I SktGetTCPStatus _instance DatRcvFla x MEN I SktTCPRe
8. 9 5 Program ST 1 luminaria 41 9 6 e gg e R 58 9 7 ENOR POCOS S i iii a 64 10 Revision TISTORY saka n 68 1 Related Manuals 1 Related Manuals The table below lists the manuals related to this document To ensure system safety make sure to always read and heed the information provided in all Safety Precautions Precautions for Safe Use and Precaution for Correct Use of manuals for each device which is used in the system Cat No Manual name W500 NJ series CPU Unit Hardware User s Manual W501 NJ series CPU Unit Software User s Manual W506 NJ series CPU Unit Built in EtherNet IP Port User s Manual W504 oysmac Studio Version 1 Operation Manual W502 NJ series Instructions Reference Manual Z315 Fixed Mount Multi Code Reader User s Manual FQ CR2series Z316 FQ CR2 series Fixed Mount 2D Code Reader User s Manual 2 Terms and Definition 2 Terms and Definition Terms Explanation and Definition IP address Ethernet uses an IP address to perform communications The IP address Internet Protocol Address is an address that is used to identify a node host computer or controller etc on the Ethernet IP addresses must be set and managed so they do not overlap Socket A socket is an Interface that allows you to directly use TCP or UDP functions from the user program The NJ series Machine Automation Controller performs socket communications by using the socket service instructions provided as standard features To use the soc
9. Address Send Command VERGET S Destination device command Read version Send Check SUM calculation Send Terminate R X Terminator CR OxOD Concatenate the send data Send Data CONGCAT Send Header Send Addr Send Command Send Check Send Terminate END IF RETURN 55 9 Project File eDescription of ReceiveCheck function block l Graphic Instruction FB FUN ST expression General purpose Ethernet ETN ReceiveCheck instance ReceiveCheck Communications None Execute Recv Data Recv Buff Receive Error ErrorlD ErrorID Ex processing n out variable table arguments Input Name Default Execute BOOL Execute when this parameter changes E ais i from OFF FALSE to ON WDE TRUE yp Receive Depends tLength data Byte length of receive buffer data on data length Ype e n out Name Datatype Valid range Default Receive data storage le Recv Data STRING 256 Receive data esli on data type Depends type Error code Error Destination device information error 16 1000 FCS error 16 2000 Error code FCS Error receive information result destination device error code ErrorlD WORD ErrorIDEx DWORD Output Name Data type Valid range Default Busy BOOL BOOL Executing Not used Done BOOL Not used in this project emer eoo tmr erer Internal variable table Name Datatype Valid range Default Receive STRING 5 Receive FC
10. In this project file socket communications are performed by using the following 5 types of standard instructions Name Function blocks Description Connect TCP SktTCPConnec Connects the TCP port of the destination device Socket using an active open TCP Socket SktT CPSend Sends data from a specified TCP socket TCP Socket SktT CPRcv Reads data received from a specified TCP socket Heceive bali Close TCP UDP SktClose Closes a specified TCP socket Read ICP SktGetTCPStat Reads the status of a specified TCP socket Socket Status us In this project file this instruction is used to check if receive processing is completed during receive processing and to check the closing status during close processing The socket obtained by the Connect TCP socket instruction SktTCPConnect SktTCPConnect_instance is used as an input parameter for another socket service instruction The data type of Socket is structure SSOCKET The specifications are as follows Variable Data type Valid range Default Socket _sSOCKET i communications data type mu oon gee address RESS number 2 data type mue eene ee address RESS number 2 data type 1 The address indicates an IP address and a port number 2 A DNS or Hosts setting is required to use a host name 28 9 Project File eSend receive message Send message Destination Header Command data Terminator device Controller Receive message Response
11. Project File 4 Send processing 12 4 Send processing Send data from the specified TCP port Memo on variable Local ExecFlgs Send Send instruction execution flag Local TONFIgs Tfs Send processing time monitoring timer enable flag 4 1 Determining the send processing status and setting the execution flag 4 1 1 Timeout processing IF Tfs TON instance Q THEN Local ErrCode BoolData 8 Z TRUE Output_SktCmdsErrorlD WORD 164F FFF Local ExecFlgs Send FALSE Local TONflgs Tfs FALSE Local State 14 To 14 Close processing 4 1 2 Normal end processing ELSIF SktTCPSend instance Done THEN Local ErrCode BoolData O0 Z FALSE Output SktCmdsErrorID ZWORD 16 0000 Local ExecFlgs Send FALSE Local TONflgs Tfs FALSE Memo on variable gt Local ComType Recv Receive processing required not required flag Local State 5EL Local ComType Recv 14 13 To 13 Receive processing To 14 Close processing 4 1 3 Error end processing ELSIF SktTCPSend instance Error THEM Local ErrCode BoolData O0 Z TRUE Output SktCmdsErrorID SktTCPSend instance ErrorID Local ExecFlgs Send FALSE Local TONflgs Tfs FALSE Local State 14 To 14 Close processing 4 1 4 Setting the send instruction execution flag setting the timer enable flag ELSE Local ExecFlgs Send TRUE Local TONflgs Tfs TRUE END IF 4 2 Enabling the send processing time monitoring timer
12. EN Additional Information This document and project file can be used to perform operations using the settings and command described in this section Modifications are necessary to perform communications using different settings 6 1 Ethernet Communications Settings The settings required for Ethernet communications are shown below 6 1 1 Communications Settings between Personal Computer and Code Reader This document explains the procedure for setting the Code Reader using the personal computer with the setting example shown in the table below IP address 10 5 5 100 Default oubnet mask 255 255 255 0 Default Gateway eR Blank Default In this document the gateway setting is unnecessary because the connection is made in the same segment 6 1 2 Communications Settings between the Controller and Code Reader This document explains the procedure for connecting the Controller and Code Reader using the setting example shown in the table below Controller Code Reader IP address 192 168 250 1 192 168 250 2 Subnet mask 255 255 255 0 255 255 255 0 Default Auto Port number Set with the program 9876 Fixed In this document the gateway setting is unnecessary because the connection is made in the same segment 6 Ethernet Settings 6 2 Example of Checking Connection This document shows an example of a Structured Text ST program in which the Controller executes socket open send receive and socket close processing on th
13. Receive message Error response Header Response data Error code Terminator eCommunications sequence TCP communications are performed between the destination device server and Controller client in the following procedure Destination Controller e Client Server Passive open Connection reguested Connection escsssssssssssssesescssssssosescecccsceseccccecccecccccceccecccecececciee Connection established establishmed Data send Send data processing Acknowledgement ACK Next data Data receive send processing reguest Data send request Acknowledgement ACK Y processing send request Close requested Close processing 29 9 Project File l 9 2 Destination Device Command This section explains the destination device command used in this project file 9 2 1 Overview of the Command This project file uses VERGET S Acquire Software Version command to perform Ethernet communications with the destination device Command Description VERGET S Acquire software version This command acquires the version information of the Sensor software lt Command Format Command Parameter sler Space Delimiter 0x20 Response Format When the Command Is Processed Normally Software version Space Delimiter 0020 o er Delimiter EN Additional Information For details refer to Controlling the Sensor from an External Device
14. Tfs TON instance In z Local TONflgs Tfs PT ZMULTIME TIMEs 10ms ETN ParameterSet instance TfsTime y 4 3 Executing the send instruction When the built in Ethernet can be used when EIP EtnOnlineSta is ON execute the send instruction SktTCPSend instance Execute Local ExecFlgs Send AND _EIP_EtnOnlineSta SIze z Local SrcDataByte Socket SktTCPConnect instance Socket SendDat Local SrcData O 47 9 Project File 5 Receive processing 13 5 Receive processing Read data from the receive buffer of the specified TCP socket Memo on variable Local ExecFlgs Recv Receive instruction execution flag Local ExecFlgs Status Get TCP status instruction execution flag Local TONFIgs Tfr Receive processing time monitoring timer execution flag Local TONFIgs Tr Receive waiting time monitoring timer execution flag Next message waiting time 5 1 Determining the receive processing status and setting the execution flag 5 1 1 Receive end processing IF Tr TON instance Q THEN Local ExecFlgs Status z FALSE Local TONflgs Tfr FALSE Local TONflgs Tr FALSE Convert receive data from a BYTE array to a string Local ReceiveMessage AryToString Local RecvData O0 Local RecvDatalLength Setting the destination device error judgment instruction execution flag Local RecvCheckFlg TRUE Local 5tate 14 To 14 Close processing 5 1 2 Timeout processing ELSIF Tir TON ins
15. UINT 0 SendDat NULL ARRAYOFBYTE 1 0 SktTCPRcv instance Execute FALSE Socket NULL SOCKET Size UINT 0 TimeOut UINT 0O RcvDat NULL ARRAYOFBYTE 2101 SkTclose instance Execute FALSE Socket NULL SOCKET SktGetTCPStatus_instancel Execute FALSE Socket NULL_ SOCKET 2 3 Initializing socket service instruction execution flags Variable description Socket service instruction execution flag For Execute parameter socket service instruction execution flag list Local_ExecFlgs lt STRUCT gt Send instruction execution flag SktTCPSend Local ExecFlgs Send Receive instruction execution flag SktTCPRcv Local ExecFlgs Recv Open instruction execution flag SktTCPConnect Local ExecFlgs Open Close instruction execution flag SkTclose Local ExecFlgs Close Get TCP status instruction execution flag SktGetTCPStatus Local ExecFlgs Status Local ExecFlgs Send FALSE Local ExecFlgs Recv FALSE Local ExecFlgs Open FALSE Local ExecFlgs Close FALSE Local ExecFlgs Status zZ FALSE 2 4 Initializing the processing time monitoring timer enable flags Variable description Processing time monitoring timer enable flags For In parameters Processing time monitoring timer enable flag list Local TONFIgs lt 5TRUCT gt Send processing time monitoring timer enable flag Tfs_ TON Local TONFlIqs Tfs Receive processing time monitoring timer enable flag Tfr_ TON Local TONFIgs Tf
16. a reboot af TnurhFinder far PU mk Ethernet 7 Connection Procedure 11 Save the data qu Click Test on the Setup Screen Click Save data z Continuous test Inspect mp m save data Click Yes on the Save data save data Dialog Box save sensor data and touch finder data 12 Cycle the power supply to the Code Reader The parameters that were changed after cycling the ower supply are reflected 7 Connection Procedure 7 3 Setting Up the Controller Set up the Controller 7 3 1 Starting the Sysmac Studio and Importing the Project File Start the Sysmac Studio Automation Software and import the Sysmac Studio project file The software and USB driver must be installed beforehand Connect a USB cable to the personal computer and to the Controller and turn ON the power supply to the Controller 1 Start the Sysmac Studio Click the Import Button If a confirmation dialog for an access right is displayed at start select to start 2 The Import File Dialog Box is ce POTTS displayed Select ME gt Organize Mew fnlder Hp w OMRON FQCR ETN TCP EV PE E 100 SMC Sysmac Studio e project file and click the Open BE Destop F B utto n v l Libranes 4 Qr Obtain the Sysmac Studio Hem project file from OMRON File name OMRON FOCR ETNITCP EV100 Zsmc Sysmac Studio project files s a Hemenrrain 3 OMRON FQCR ETN TCP EV 100 project is
17. e ee Sysmac Studio Built in EtherNet IP port Switching Hub software installed OS Windows7 24 VDC power supply W45S1 05C USB cable FQ Ethernet 1 O cable cable FQ WDIIIN gt gt LAN cable FQ WNITII Manufacturer Version Built in EtherNet IP port OMRON OMRON OMRON SYSMAC SE2 I II Ver 1 00 OMRON P EV100 SMC Ico NN RN OS Windows7 Menem USB 2 0 type B connector LAN cable Ethernet STP Shielded twisted pair cable of category 5 or higher OMRON Code Reader OMRON FQ WDIIII OMRON FQ WNIIII OMRON Touch Finder for PC A1 3 Ve lt r1 20 L Precautions for Correct Use EN Obtain the latest Sysmac Studio project file from OMRON in advance To obtain the file contact your OMRON representative Additional Information It may not be possible to reproduce the same operation with different devices and versions Check the configuration model and version If they are different from your configuration Contact your OMRON representative Additional Information In this document a USB is used to connect with the Controller For information on how to install a USB driver refer to A 1 Driver Installation for Direct USB Cable Connection of the Sysmac Studio Version 1 Operation Manual Cat No W504 6 Ethernet Settings 6 Ethernet Settings This section describes the specifications such as communication parameters and variables that are set in this document
18. type Send Ad Destination Depends dr STRING S device Destination device address on data address type Depends Send Co Command sent to the mmand STRING 256 Send data destination device oa a Depends Send Ch STRING 5 Send check Check code of the send ta i i eck code message type Depends led STRING 5 Sk li Send message terminator on data minate terminator es 54 Program Mame NJ series general purpose Ethernet communications sequence setting function Function 5end receive processing required not required setting and send data setting Applicable devices Manufacturer OMRON Corporation Device Code Reader Series Model FO CR series Remarks Version information December 14 2011 Mew release C Copyright OMRON Corporation 2011 All Rights Reserved L22222222222222222222222222222222222222222222222222222222 2 Variable description Argument Return value Argument Name Data type Description Input Execute BOOL Execution flag Output SendData STRING 256 Send data ComType BYTE Send receive processing required not required setting Busy BOOL Mot used Done BOOL Not used Error BOOL Not used ErrorID WORD Not used ErrorlIDEx DWORD Not used In out None Return value None 1 IF Execute THEN Send receive processing required not required setting ComType BYTE 16 03 1 Send only 2 Receive only 3 Send and receive Send data setting Send Header Header Send Addr
19. up screen 6 Click Network on the Sensor eee settings Menu ut Pin L E LL n as Information Error history Startup settings Password settings adjustment mode in Run Network 11 Click Ethernet on the Network Menu Turn OFF the auto setting of the Ethernet Click Auto on the Ethernet Menu Click OFF on the Auto Menu 7 Connection Procedure Network Ethernet Ethernet IP Address 10 5 5 100 subnet mask AUTO sensor sets the IP address automatically 9 Set the fixed IP address Click IP Address on the Ethernet Menu Click each octet on the IP Address Screen A numeric keypad is displayed Click the numeric keypad and enter each octet of the IP address Click OK Set the IP address to 192 168 250 2 Click OK This completes the IP address setting 7T Connection Procedure Ethernet IP Address 10 5 5 1U SUBNET mask zS I IF Address Enter the sensor s IP address 10 Confirm the settings are made as follows and click OK Auto OFF IP address 192 168 250 2 Subnet mask 255 255 255 0 If the dialog box on the right is displayed click OK If the dialog box on the right is displayed click OK Click Back twice to return to the screen in step 4 7T Connection Procedure TouchFmder for P DR TI Cancel This IP address s outs ide of the LAN Please check Ok E save the configuration settings will take effect atter
20. use keep alive or linger functions of the TCP socket options Use them in your application when necessary Additional Information OMRON has confirmed that normal communications can be performed using this project file under the OMRON evaluation conditions including the test system configuration version of each product and product Lot No of each device which was used for evaluation OMRON does not guarantee the normal operation under the disturbance such as electrical noise and the performance variation of the device Additional Information With Sysmac Studio a data type are prefixed to decimal data and a data type 16 are prefixed to hexadecimal data when it is necessary to distinguish between decimal and hexadecimal data e g INT 1000 decimal gt INT 16 03E8 hexadecimal For DINT a data type are unnecessary 26 9 Project File 9 1 1 Communications Data Flow The following figure shows the data flow from issuing a command with TCP socket communications from the Controller to the destination device to receiving the response data from the destination device This project file executes a series of processing from the TCP open to the close processing continuously Receive processing is performed repeatedly when the response data is divided and multiple receive data are sent TCP open processing Command send processing J n Response receive processing Close processing
21. 2 Code Reader For information on how to initialize the Code Reader refer to Initializing the Sensor and Touch Finder under 7 9 Functions Related to the System in the user s manual for each Code Reader 25 9 Project File 9 Project File This section describes the details of the project file used in this document l 9 1 Overview This section explains the specifications and functions of the project file used to check the connection between the Code Reader FQ CR series hereinafter referred to as destination device and the Controller built in EtherNet IP port hereinafter referred to as Controller The project file is a Sysmac Studio project file The following data has already been set in this project file Communications settings of the Controller and task settings of program sA program and function blocks to perform socket communications Variable tables and data type definitions of the variables used in ST programs In this project file the socket service functions of the Controller are used to perform VERGET S Acquire Software Version for the destination device and to detect whether the processing ends normally or in an error The normal end of this project file indicates that the TCP socket communications end normally The error end indicates that the TCP socket communications ends in error and a destination device error occurs judged on the response data from the destination device This project file does not
22. Done THEN Local ErrCode BoolData 2 FALSE Output_SktCmdsErrorlD WORD 1640000 Local ExecFlgs Open FALSE Local TONflgs Topen FALSE Memo on variable gt Local ComType Send Send processing required not required flag Local ComType Recv Receive processing required not required flag IF Local ComType Send THEN Local State 12 To 12 Send processing ELSIF Local ComType Recv THEN Local State 13 To 13 Receive processing END IF 3 1 3 Error end processing ELSIF SktTCPConnect instance Error THEN Local ErrCode BoolData 2 Z TRUE Output SktCmdsErrorID SktTCPConnect instance ErrorID Local ExecFlgs Open FALSE Local TONflgs Topen FALSE Local 5tate 14 To 14 Close processing 3 1 4 Setting the open instruction execution flag and setting the timer enable flag ELSE Local ExecFlgs Open TRUE Local TONflgs Topen z TRUE END IF 3 2 Enabling the open processing time monitoring timer Topen TON instance In Local_TONflgs Topen PT MULTIME TIMES10Oms ETN_Parameterset_ instance TopenTime 3 3 Executing the open instruction TCP Active open processing When the built in Ethernet can be used when EIP EtnOnlineSta is ON execute the open instruction SktTCPConnect instance Execute Local ExecFlgs Open AND EIP EtnOnlineSta SrcIcpPort z ETN ParameterSet instance SrcPort DstTcpPort ETN ParameterSet instance DstPort DstAdr z ETM ParameterSet instance DstIPAddr 46 9
23. E Clear the present values ol variables with Kelar albnbule Valid bor Transfer lo Controller If th e re IS no pro b e m J cl ick ih e Bl Ge nat transier the program source Valid Spr Transfer ini Controller AD data will be re traresfenrred when this option E Do n t transfer Special Unit parameters and backup parameters of EtherC AT slaves out of synchronizamon scope Close Button If the synchronization fails check the wiring and repeat the The Synchronization process sur cor ssfulby finished procedure described in this section l 7 4 Connection Status Check Execute the project file that was transferred and confirm that Ethernet communications are normally performed L Precautions for Correct Use Please confirm that the LAN cable has been connected before proceeding to the following steps If it is not connected turn OFF the power to the devices and then connect the LAN cable 7 Connection Procedure 7 4 1 Executing the Project File and Checking the Receive Data Execute the project file and check if the correct data are written to the variables of the Controller 1 Check that RUN mode is monent displayed on the Controller ONLINE 192 168 250 1 Status Pane of the Sysmac o HEL Studio Controller Simulation Tools Help If PROGRAM mode is shown select Mode RUN Mode from Ctri W the Controller Menu Offline Ctrl Shift W Synchronization Ctrl M A coe Ctrl 1 A co
24. Initializing the socket service instructions 2 3 Initializing the socket service instruction execution flags 2 4 Initializing the processing time monitoring timer enable flags 2 5 Initializing the error code storage areas 2 6 Setting each processing monitoring time and Ethernet related parameters 2 7 Setting the send receive processing required not required setting and send data 2 8 Converting send data from a string to a BYTE array 2 9 Initializing the receive data storage areas 2 10 Initialization setting end processing 3 1 Determining the open processing status and setting the execution flag 3 2 Enabling the open processing time monitoring timer 3 3 Executing the open instruction TCP Active open processing 4 1 Determining the send processing status and setting the execution flag 4 2 Enabling the send processing time monitoring timer 4 3 Executing the send instruction 5 1 Determining the receive processing status and setting the execution flag 5 2 Enabling the receive waiting time monitoring timer 5 3 Enabling the receive processing time monitoring timer 5 4 Executing the receive instruction 5 5 Executing the get TCP status instruction 5 6 Executing the destination device error detection instruction Description The communications processing is started The Ethernet parameters are set and the error code storage area is initialized The send receive required not required setting sen
25. OMRON Machine Automation Controller NJ series Ethernet Connection Guide TCP IP OMRON Corporation FQ CR Series Code Reader Network Connection Guide P532 E1 01 always in control Table of Contents 1 Related Mantais semeresini si pda lamak ya needa hala my mi dalin 1 2 Terms and DETMMIIOMN akacak ukala a d Muamma DEP ga sala 2 3 ROMS E ELT 3 4 JOVOLVIGW seen ae apne as Ceo uvae sexu amam SRRULOR VER CIENT DECR C OUTRE la sabuna OC CO 5 5 Applicable Devices and Support Software 5 9 13 Applicable Devi ES ass 5 5 2 Device Configuracion did 6 6 Ethernet SENINGS aeri ER cds cocer Ic ue 7 6 1 Ethernet Communications Settings 7 6 2 Example of Checking Connection aaiiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 8 7 Connection Procedure 9 7 1 o a aina MAR NN EE RA C RE 9 7 2 SsetingUptheCodeReader 10 7 9 settingUptheConiroller 16 7 4 Connection Status Cheles ra aco sesi se dd 21 o Initiauzation Method ecu di daa aco crate epo Po ia yade reni VE maal 25 8 1 Onla scm dice M Pas nodo 25 8 2 Code Reader eiendo e li denies a ey 25 ME diee 26 9 1 OVENI OW Pe ES 26 9 2 Destination Device Comimialidsus iei visa aes M olak Ra DE RM 30 9 3 Error Detection PrOCESSING reete dla Dua eut 33 9 4 Vandal PR m nam UE 36
26. Procedure for No protocol Command Response Communications in 8 2 Outputting Controlling with Ethernet in the user s manual for each Code Reader 30 9 Project File 9 2 2 Command Settings This section explains the details on the settings for VERGET S Acquire Software Version command eSend data Command settings Set the send data in SendMessageSet instance function block lt Specifications of the destination device gt Data is stored in ASCII code AEE E Send Header None Send Command VERGET S Addition of send check send Check None STRING 5 Send_Terminate Send terminator STRING 5 R CR 16 0D Variable e ETON Description data type CONCAT Send Header Gan eee Send Addr Used as send data of Send Data STRING 256 Send Command SktTI CPSend instruction Send Check SktTCPSend instance Send Terminate eReceive data response that is stored After a data check is performed on the receive data using the ReceiveCheck instance function block the receive data is stored as output receive data Specifications of the destination device Data is stored in ASCII code Variable Description data type Storage area Heceive data Recv Data Receive buffer STRING 256 Receive data Receive data storage area Recv Buff STRING 256 stores the receive buffer data 31 9 Project File eSend receive message Send message 15645 52 47 45 54 20 ar 53 op S CR
27. S FCS receive result of the Depends Check receive data on data type Calc Che STRING 5 Receive FCS FCS calculation result of Depends ck calculation the receive data on data value type 56 9 Project File Program Mame WJ series general purpose Ethernet communications receive processing function block Function Receive data storage and receive processing result determination Applicable device Manufacturer OMRON Corporation Device Code Reader Series Model FQ CR series Remarks Version information December 14 2011 Mew release C Copyright OMRON Corporation 2011 All Rights Reserved L222222222222222222222222222222222222222222222222222222 2 2 Variable description Argument Return value Argument Mame Data type Description Input Execute BOOL Execution flag tLength UINT Receive data length Output Busy BOOL Not used Done BOOL Not used Error BOOL Error flag n out Recv Data STRING 256 Receive data storage area Recv Buff STRIMG 256 Receive buffer ErrorID WORD Error code ErrorIDEx DWORD FCS receive result destination device error code Return value None x IF Execute THEN Detection of CheckSUM Not required Storing receive buffer data in the receive data storage area Recv Data Recv Buff Detecting the destination device error Normal Two characters from the header must not be ER IF FIND LEFT Recv Buff 2 ER lt gt UINT 1 THEN Error FALSE Errar
28. agement with the destination node Therefore it may not be possible to immediately use TCP sockets with the same port number 3 Remarks 3 Remarks 1 Understand the specifications of devices which are used in the system Allow some margin for ratings and performance Provide safety measures such as installing safety circuit in order to ensure safety and minimize risks for abnormal occurrence 2 To ensure system safety always read and heed the information provided in all Safety Precautions Precautions for Safe Use and Precaution for Correct Use of manuals for each device used in the system 3 The users are encouraged to confirm the standards and regulations that the system must conform to 4 It is prohibited to copy to reproduce and to distribute a part of or whole part of this document without the permission of OMRON Corporation 5 This document provides the latest information as of March 2013 The information on this manual is subject to change for improvement without notice About Intellectual Property Right and Trademarks Microsoft product screen shots reprinted with permission from Microsoft Corporation Windows is a registered trademark of Microsoft Corporation in the USA and other countries EtherCAT is registered trademark and patented technology licensed by Beckhoff Automation GmbH Germany Company names and product names in this document are the trademarks or registered trademarks of their respective compani
29. ction m Enabled TRUE Disabled FALSE Tclose BOOL Close processing time monitoring timer instruction A pe Enabled TRUB Disabled FALSE Tr BOOL Next response receive waiting time monitoring timer instruction TT Enabled TRUB Disabled FALSE Local ComType sControl Sets the send receive processing required not required setting STRUCT Send Recv Error BOOL Send processing Required TRUE Not required FALSE When send processing is required and receive processing is not required This program skips receive processing without waiting for receive data during send processing and shifts to close processing This is specified when no response data is sent for the sent command BOOL Receive processing Required TRUE Not required FALSE When send processing is required and receive processing is required This program waits for the receive data after the send processing After checking that data is received this program shifts to the receive processing This is specified when response data is sent for the sent command BOOL Send receive processing required not required setting error flag Set this flag when a setting error occurs 38 9 Project File eVariables used to initialize socket service instructions Name Data type Description NULL SOCKET _SSOCKET Socket service instruction initialization data Retain Constant Enabled Default value Handle 0 SrcAdr PortNo 0 IpAdr DstAdr PortNo
30. cution of the processing from ending the timer in this project file is used to abort the processing timeout The timeout value for each processing from the open processing to the close processing is 5 seconds default Time monitoring function using the timer in the project file name Default orocessing the end me UINT 500 processing the end UINT 500 Time from the start of the receive processing to the end Receive N mM After 5 seconds processing When receive processing is repeated the timer TfrTime UINT 500 monitoring timer monitors each receive processing separately Time from the start of the close processing to Close the end B processing The time monitoring timer confirms the normal TcloseTi After 5 seconds TCP connection status after the close me UINT 500 processing and detects that the processing is completed e ime monitoring function of the Controller socket service The Controller has a time monitor function as a socket service This function monitors the time taken to receive data that are sent separately TrTime UINT 3 300 ms default is stored in the TimeOut parameter of the SktTCPRcv socket service instruction when receive processing is performed For the receive waiting time for the next response after the receive processing ends once rTime variable is also set for the receive waiting time monitoring timer with this project file If the next response is not received from the des
31. d data and receive data are set The TCP open Active processing is executed After starting the communication processing and executing initialization settings the processing is executed unconditionally The processing is executed when the send processing required not required setting is set to Required and the open processing ended normally The processing is executed when the receive processing required not required setting is set to Required and the send processing ended normally If multiple receive data arrive the receive processing is repeated The receive data is stored and checked 41 Major classification 6 Close processing 7 Processing number error Process Minor classification 6 1 Determining the close processing status and setting the execution flag 6 2 Enabling the close processing time monitoring timer 6 3 Executing the close instruction 6 4 Executing the get TCP status instruction 7 Processing number error process 9 Project File Description The close processing is executed The processing is executed in the following Cases When the receive processing not required setting is set and the sent processing ends normally When the receive processing ends normally Immediately after an error end of open processing send processing or receive processing The error process is executed when a non existent processing number is detected 42 9 5 2 9 Project File
32. d only for operations of this project file Name Data type Description Local_Status sStatus Program execution status STRUCT Busy BOOL TRUE while executing this project file FALSE while not executing this project file Done BOOL TRUE for a normal end of this project file m FALSE when Input Start changes to FALSE Error BOOL TRUE for an error end of this project file EE FALSE when Input Start changes to FALSE Local State DINT Status processing number Local ErrCode uErrorFlgs Sets an error code UNION Local ErrCode WORD Expresses an error code in WORD WordData Local ErrCode ARRAYJ0 1 Communications error BoolData 5 OF BoolData 0 Send processing Error TRUE Normal FALSE BOOL BoolData 1 Receive processing Error TRUE Normal FALSE BoolData 2 Open processing Error TRUE Normal FALSE BoolData 3 Close processing Error TRUE Normal FALSE BoolData 4 Processing number error Error TRUE Normal FALSE e Timeout error BoolData 8 Send processing Error TRUE Normal FALSE BoolData 9 Receive processing Error TRUE Normal FALSE BoolData 10 Open processing Error TRUE Normal FALSE BoolData 11 Close processing Error TRUE Normal FALSE Others BoolData 5 Send receive required not required detection error Error TRUE Normal FALSE BoolData 12 Destination device error Error TRUE Normal FALSE BoolData 6 7 13 14 Reserved BoolData 15 Error Local_ExecFlg
33. des a command error parameter error and execution failure in the destination device The error is detected with the response data which is sent from the destination device With this project file the destination device error is detected with the error code which is returned from the destination device when an error occurs For information on the send receive messages refer to 9 2 Destination Device Command Receive message for error process 4TCP connection status errors when ending the processing With this project file the close processing is always performed at the end of the whole processing regardless of whether each processing from the open processing to the receive processing ends normally or in an error The TCP connection status variable TcpStatus of the SktGetTCPStatus instruction is used to detect whether the close processing ends normally When the close processing is operated abnormally the next open processing may not be performed normally For information on the corrective actions for TCP connection status errors refer to 9 7 2 TCP Connection Status Errors and Corrective Actions 33 9 Project File 9 3 2 Time Monitoring Function This section explains the time monitoring function of this project file You can change the monitoring time settings by changing the variables of the ParameterSet function block elime monitoring function using the timer in the project file To prepare against errors that may prevent the exe
34. displayed The left pane is called Multiview Explorer the right pane is called Ms r Mik Toolbox and the middle pane is agam ms J erimi B called Edit Pane t 3 Multiview Edit Pane Toolbox Ju Explorer EI filter z 7 Connection Procedure 7 3 2 Checking the Parameters and Building Check the set parameters execute the program check on the project data and build the program 1 Double click Built in Configurations and Setup EtherNet IP Port Settings aa EtherCAT under Configurations and gt 53 CPU Expansion Racks FL d LO Map 3 Controller Setup Te Operation Settings b E Motion Control Setup Setup Controller Setup in the Multiview Explorer 9 The Built in EtherNet IP Port Mill Built in EtherNet IP Port EA Settings Tab Page is displayed Va TO in the Edit Pane IP Address O Fixed setting Select the TCP IP Setting ima IP address Button select the Fixed Setting meme Option in the IP Address Field Obtain from BOOTP server and check that the following Fix at the IP address obtained from BOOTP server settings are made O not use Se IP address 192 168 250 1 Priority DNS server NME A Subnet mask 255 255 255 0 Secondary DNS server IEPS Default gateway m pa s Y Host Name IP Address Host Name IP Address enmpa Check that the Keep Alive settings are set as follows Keep Alive Do not use UM Linger option Do not specify Keep Ali
35. e Code Reader The message of VERGET S Acquire Software Version is sent and received between the Controller and Code Reader The following figure outlines the operation Controller Ethernet Code reader Project file A communication ST Programming i m u A Socket open SS Sending receiving Ethernet command VERGET S Acquire Software Version Specifying Ethernet communications VERGET S Acquire Software Version Send data Variable Local_ Send data SrcData setting area Local _ RecvData Receive data setting area Heceive data 7 Connection Procedure 7 Connection Procedure This section describes how to connect the Controller on the Ethernet network This document explains the procedures for setting the Controller and Code Reader from the factory default setting For the initialization refer to Section 8 Initialization Method 7 1 Work Flow Take the following steps to connect the controllers via Ethernet 7 2 Setting up the Code Reader i 7 2 1 Parameter Setting i 7 3 Setting up the Controller i 7 4 1 Starting the Sysmac Studio and Importing the Project File 7 3 2 Checking the Parameters and Building i 7 3 3 Going Online and Transferring the Project Data i 7 4 Connection Status Check i 7 4 1 Executing the Project File and Checking the Receive Data Precautions for Correct Use Set up the Code Reader Set t
36. ecute Topen TON _instance Q 1 1 SktTCPConnect _instance Busy Ao mu SktTCPConnect CMS bi _instance Busy E A l SktTCPConnect I 5 _instance Done zi BENE SktTCPConnect _instance Error IO SktT CPConnect _instance ErrorlD 16 0000 Local ErrCode b 2 Open processing error __ Output_sktCmds ErrorlD 16 0000 SktTCPSend E _instance Busy Normal end Input_Start p SktTCPConnect F instance Execute Topen TON _instance Q qu I SktTCPConnect _instance Busy l i E l SktTCPConnect instance Busy Stopped dcd assais buaa decas l SktTCPConnect I I _ instance i y SktTCP Connect i _instance Error 3 M SktTCPConnect l _instance ErrorlD __ 150000 Local ErrCode b 10 Timeout l Output_ErrCode 16 0000 1830400 J SktClose Wee _instance Busy L Timeout 9 Project File Input_Start pps adenda este SktTCPConnect instance Execute Topen TON _instance Q mp I I SktTCPConnect X _instance Busy Kk a SktTCPConnect _instance Busy ds I I I l 7 I I l I l I I SktTCPConnect SktTCPConnect ESSEN QE instance Error I k SktTCPConnect 1A _instance ErrorlD 6400004 16 Local_ErrCode b 2 Open processi
37. ed with the SrcTcpPort input variable is already open The destination node that is specified with DstAdr input variable does not exist 162003 The destination node that is specified with DstAdr and DstTcpPort input variables are not waiting for a connection p p g SktT CPRcv 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 1682006 o Atimeout occurred for a socket service instruction 1642007 e fo lolo The handle that is specified for the socket service instruction is not correct 1642008 The maximum resources that you can use for socket service instructions at the same time was exceeded 16 FFFF Processing ends without completing the executing of an Instruction Additional Information For details refer to Appendix A 1 Error Codes Related to Instructions A 2 Error Code Descriptions and A 3 Error Code Details in the NJ series Instructions Reference Manual Cat No W502 Additional Information For details on socket service errors and countermeasures 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 65 9 Project File eError flag Error end timeout Output ErrCode If an error end or a timeout occurs for the open processing send processing receive proces
38. es 3 Remarks The following notation is used in this document Indicates a potentially hazardous situation which if not avoided WARNING could result in death or serious injury Additionally there may be severe property damage Indicates a potentially hazardous situation which it not avoided may result in minor or moderate injury or property damage The filled circle symbol indicates operations that you must da The specific operation is shown in the circle and explained in text This example shows a general precaution for something that you must do CD Precautions for Safe Use Indicates precautions on what to do and what not to do to ensure using the product safely L Precautions for Correct Use Indicates precautions on what to do and what not to do to ensure proper operation and erformance EN Additional Information Provides useful information Additional information to increase understanding or make operation easier R 4 9 4 Overview Overview This document describes the procedure for connecting the Code Reader FQ CR series of OMRON Corporation hereinafter referred to as OMRON to the NJ series Machine Automation Controller hereinafter referred to as Controller through Ethernet and provides the procedure for checking their connection Refer to the Ethernet communications settings of the prepared project file to understand the setting method and key points to connect the dev
39. exchanged FIN Awaiting ACK FIN received and completed Awaiting ACK Completed and ACK received Awaiting FIN After closing pauses twice the maximum segment life 2MSL 64 9 Project File eError code Output SktCmdsErrorlD Output_SkTcloseErrorlID If an error occurs in the open processing send processing or receive processing the error code is stored in the Output SktCmdsErrorlD variable and then the close processing is executed If an error occurs in the close processing the error code is stored in the Output SkTcloseErrorlD variable and the processing ends The main error codes are shown below O Open processing SktT CPConnect instruction S Send processing SktTCP Send instruction R Receive processing SktT CPRcv instruction C Close processing SktClose instruction Target processing is indicated by o Errorcode O S R C Description 1680000 o o o o Normal end An input parameter for an instruction exceeded the valid range for 1620400 i an input variable The results of instruction processing exceeded the data area range 16 0407 of the output parameter An instruction was executed when there was a setting error in the 16 2000 local IP address Address resolution failed for a destination node with the domain 16 2002 ii name that was specified in the instruction The status was not suitable for execution of the instruction SktTCPConnect Instruction The TCP port that is specifi
40. flag reset ErrorID WORD 16 0000 Error code clear ErrorlDEx DWORD 16 00000000 Destination device error code clear Error When the header contains ER ELSE Error TRUE Error flag set Errorld WORD 16 1000 Error code set Storing the destination device error code Converting 4th and 5th characters from the left of the string from ASCII code to Hexadecimal ErrorlDEx STRING TO DWORD LEFT Recv Buff 2 END IF END IF RETURN 57 9 Project File 9 6 Timing Charts The timing charts of the ST program are shown below Execute amp setting Input Start o 0c Local Status BoolData O Busy l i A A NU dan E e su mmon ram r cL i s NE H Receive data 1630000 l Han P 16 0000 i Local_Status BoolData 1 Done k or Local_Status d adc BoolData 2 Error C If Input Start changes from True ON to False OFF during execution a normal end or an error end is output for one period after the processing is completed 1 Normal status 2 Error status Input Start 4 4 T 4 4 Local Status BoolData O Busy v l Local_Status Output for 1 period BoolData 1 Done t gt r lt Local Status BoolData 1 Error BEM EM Output for 1 period Output SktCmdErrorlD y 160000 Cay Output_MErrCode 16 0000 C 98 eOpen processing Input Start SktT CPConnect _instance Ex
41. hat has already been received and end the receive processing 5 1 6 Setting the get TCP status instruction execution flag setting the timer execution flag ELSE Local ExecFlgs Status TRUE Local TONflgs Tfr TRUE Initialize destination device error detection instruction execution flag Local RecvCheckFlg FALSE END IF 5 2 Enabling the receive waiting time monitoring timer next response waiting time Tr TON instance In Local_TONflgs Tr PT MULTIME MIME 100ms ETN_ParameterSet_instance Trlime 5 3 Enabling the receive processing time monitoring timer Tir TON instance In zLocal TONflqgs Tfr PT ZMULTIME TIME lO0ms ETN ParameterSet instance TfrTimej 5 4 Executing the receive instruction When the built in Ethernet can be used when _EIP_EtnOnlineSta is ON execute the receive instruction SktTCPRcv instance Execute Local ExecFlgs Recv AND _EFIP_EtnOnlineSta Socket SktTCPConnect_instance Socket TimeQOQut ETN_ParameterSet_instance TrTime Size Local ReceiveSize RevDat Local_RecvData Local_ RecvCHNo 5 5 Executing the get TCP status instruction When the built in Ethernet can be used when EIP FtnOnlineSta is ON execute the get TCP status instruction SktGetTCPStatus instance Execute Local ExecFlgs Status AND EIP FtnOnlineSta Sacket SktTCPConnect instance Socket 5 6 Executing the destination device error detection instruction ETN RecerveCheck insta
42. he parameters of the Code Reader Set up the Controller Start the Sysmac Studio Automation Software and import the Sysmac Studio project file Check the set parameters execute the program check on the project data and build the program Connect online with the Sysmac Studio and transfer the project data to the Controller Execute the project file that was transferred and confirm that Ethernet communications are normally performed Execute the project file and check if the correct data are written to the variables of the Controller Obtain the latest Sysmac Studio project file from OMRON in advance To obtain the file contact your OMRON representative 7 Connection Procedure 7 2 Setting Up the Code Reader Set up the Code Reader P Precautions for Correct Use Use a personal computer to set the parameters of the Code Reader Note that the settings of the personal computer may need to be changed 7 2 1 Parameter Setting 1 Set the parameters of the Code Reader PC tool for FQ TouchFinder for PC is used to set the parameters Install the software in the personal computer beforehand Set the IP address of the personal computer to 10 5 5 101 Connect the Ethernet cable connector which is located at the bottom of the Code Reader to the Switching Hub using the FQ Ethernet Cable Connect the I O cable to the I O cable connector and then turn ON the 24 VDC power supply Ethernet cable connect
43. hernet related parameter settings Applicable device Manufacturer OMRON Corporation Device Code Reader Series Model FO CR series Remarks Version information December 14 2011 New release C Copyright OMRON Corporation 2011 All Rights Reserved L222222222222222222222222222222222222222222222222222 22222 2 Variable description Argument Return value Argument Name Data type Description Input Execute BOOL Execution flag Output TopenTime UINT Open processing monitoring time TfsTime UINT Send processing monitoring time TrTime UINT Receive wait processing monitoring time TfrTime UINT Receive processing monitoring time TcloseTime UINT Close processing monitoring time SrcPort UINT Local port No DstIPAddr UINT Destination IP address DstPort UINT Destination port No Busy BOOL Mot used Done BOOL Not used Error BOOL Mot used ErrorlD WORD Not used ErrorIDEx DWORD Mot used In outNone Return value None IF Execute THEN Ethernet related parameter settings SrcPort UINT 0 Local port Mo Processing monitoring time setting Maximum time from start to end of processing TopenTime UINT 500 Open processing monitoring time setting Setting unit LOms lt 500 gt 5s gt TfsTime UINT 500 Send processing monitoring time setting Setting unit 10ms lt 500 gt 5s5 gt TfrTime UINT 500 Receive processing monitoring time Setting unit 10ms lt 500 gt 5s gt TcloseTime UINT 500 Close processi
44. his resend processing stops in the following cases Therefore you do not have to stop it eWhen the open processing request is made again by restarting the project file 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 is restarted or the power supply is turned OFF 67 10 Revision History 10 Revision History Revision Date of revision Revision reason and revision page code 01 Mar 26 2013 First edition 68 69 Authorized Distributor
45. ices via Ethernet This project file is used to check the Ethernet connection by sending receiving the message of VERGET S Acquire Software Version to from the destination device Obtain the latest Sysmac Studio project file from OMRON beforehand Name File name Version Sysmac Studio project file OMRON FQCR ETN TCP EV1 Ver 1 00 extension SMC 00 SMC Applicable Devices and Support Software l 5 1 Applicable Devices ER The following devices can be connected OMRON NJ series CPU Unit NJ501 0000 OMRON Code Reader Fa CR100000 FQ CR150000 FQ CR20 01 FQ CR25 ITEE Additional Information As applicable devices above the devices listed in Section 5 2 are actually used in this document to check the connection When using devices not listed in Section 5 2 check the connection by referring to the procedure in this document Additional Information This document describes the procedure to establish the network connection It does not provide information about operation installation nor wiring method of each device For details on the above products other than communication connection procedures refer to the manuals for the corresponding products or contact your OMRON representative 5 Applicable Devices and Support Software 5 2 Device Configuration The hardware components to reproduce the connection procedure of this document are as TouchFinder for PC follows Personal computer NJ501 1500 e
46. ine value Program Input Start Program ET N SendMessageSet mstance send Data VERGET 5 R Program Output_Recvhiess i21 2011 08 01SROKSR gt the destination device is stored in Outout_RecvMess ETN_SendMessageSet_instanc e Send_Data is a send lt Response format gt command Software Date Version Specify variables you want to see in the Watch Tab Page as A e BEUNDEHUBEEHCUES Space Delimiter The response data differ depending on the device used shown in the right figure and check them Delimiter Refer to 9 2 Destination Device Command for details on the command 24 8 Initialization Method 8 Initialization Method This document explains the setting procedure from the factory default setting If the device settings have been changed from the factory default setting some settings may not be applicable as described in this procedure l 8 1 Controller To initialize the settings of the Controller select Clear All Memory from the Controller Menu of the Sysmac Studio Clear All Memory This function initializes the target area of destination Controller Confirm the area to initialize first and press the OK button CPU Unit Name new NI501 0 Model NJ501 1500 Area User Program User defined Valiables Controller Configurations and Setup Security Information Settings of Operation Authority initialization at the next online la Clear event log Cancel l 8
47. isplayed Check that the data to transfer NJ501 in the right figure is selected Then click the Transfer to Controller Button Legend Synchroniser E Clear the presen values of vanables woth Kelam atlisbiube Valid bor Transber t Controle Bl Do net transfer the pregam source Valid for Transfer in Controller AN data will be re transferreri when this option 5 changer E Do not branster Specal Unit parameters and backup parameters af EtherCAT slaves out of synchronization scope m AN evin wall be transferred bere the controller has no iata ka Tanier Lo Controller A confirmation dialog is Confirm that there is no problem if the controller operation is stopped d IS p ayed Cl ick th e Yes B utto n The operating mode will be changed to PROGRAM mode Then EtherCAT slaves will be reset and forced refreshing will be cancelled Do you want to continue Y N di Synchronczing A screen stating Synchronizing is displayed 21 A confirmation dialog IS Confirm that there is no problem if the controller operation is started The operating mode will be changed to RUM mode displayed Click the Yes Button Do you want to continue Y N 20 7 Connection Procedure g Check that the synchronized data is displayed with the color a SS TSUNAMI DECRE DVONIE b specified by Synchronized and that a message is displayed stating The synchronization process successfully finished legereb Synchrorzer F F
48. ket services connections with a destination node must be established and terminated In this document establishment processing is called socket open or TCP open and termination processing is called socket close or close The socket services enable data exchange with destination nodes Active and Passive Open processing is executed for each node to establish a connection The open method depends on whether the node is opened as a server or client In this document the method used to open a node as a server is called passive open and the method used to open a node as a client is called active open or open processing active Keep alive function When the keep alive function is used with TCP IP socket services the keep alive communications frame is used to check the status of the connection with the destination node either a server or client if there are no communications during the specified time interval Checks are executed at a certain interval and if there is no response to any of them then the connection is terminated Linger function This is an option for the TCP socket that enables immediate open processing using the same port number without waiting until the port number opens after RST data is sent when the TCP socket closes If the linger option is not specified FIN data will be sent when a TCP socket is closed and then approximately 1 minute will be required to confirm the transmission and perform other closing man
49. mType Send OR Local ComType Recv IF Local ComType Error THEN Output ErrCode Z WORD 10630020 Local InitialSettingOK FALSE ELSE Local InitialS amp ettingOK TRUE END IF 2 8 Converting send data from a string to a BYTE array Local SrcDataByte StringToAry ETN_SendMessageSet_instance Send_Data Local_SrcData 0 2 8 Initializing the receive data storage areas ClearStrina Local ReceiveMessaga ClearStrina Output_RecvMess Local RecvCHNo 0 Local_RecyvDataLength 0 Local ReceiveSize UINT 256 2 10 Initialization setting end processing IF Local_InitialSettingOK THEN Local_State 11 To 11 Open processing ELSE Local_Status Busy FALSE Local Status Error TRUE Local State 0 To O Communication not in progress status END IF 45 9 Project File 3 Open processing 11 3 Open processing Connect the destination TCP port using an active open Memo on variable gt Local ExecFlgs Open Open instruction execution flag Local TONFIgs Topen Open processing time monitoring timer enable flag 3 1 Determining the open processing status and setting the execution flag 3 1 1 Timeout processing IF Topen TON instance O THEN Local ErrCode BoolData 10 TRUE Output_SktCmdsErrorlD WORD 164FFFF Local ExecFlgs Open FALSE Local TONMflgs Topen FALSE Local 5tate 14 To 14 Close processing 3 1 2 Normal end processing ELSIF SktTCPConnect instance
50. nce Execute Local RecvCheckFlg Recv Buff zLocal ReceiveMessage Recv Data Output RecvMass tLength Local RecvDataLength ErrorlD Local ErrCode WordData ErrorIDEx Output_MErrCode 9 Project File 49 9 Project File 6 Close processing 14 6 Close processing Close the specified socket Memo on variable gt Local ExecFlgs Close Close instruction execution flag Local ExecFlgs Staus Get TCP status instruction execution flag Local TONFIgs Tclose Close processing time monitoring timer execution flag 6 1 Determining the close processing status and setting the execution flag 6 1 1 Timeout processing IF Tclose TON instance Q THEN Local ErrCode BoolData 11 Z TRUE Output SkTcloseErrorID ZWORD 16 FFFF Local ExecFlgs Close FALSE Local TONflgs Tclose z FALSE Local ExecFlgs Status z FALSE Output EtnTcpSta SktGetTCPStatus instance TcpStatus Local ErrCode BoolData 15 Z TRUE Output ErrCode Local ErrCode WordData Local Status Busy z FALSE Local Status Error TRUE Local State 0 0 Communication not in progress status 6 1 2 Normal end processing ELSIF SkTclose instance Done THEN Local ExecFlgs Status z TRUE IF SktGetTCPStatus instance Done OR SktGetTCPStatus instance Error THEN Local ExecFlgs Status FALSE IF SktGetTCPStatus instance TcpStatus CLOSED THEN Local TONflgs Tclose FALSE Output_SkTcloseErrorlD W0ORD 16 0000 Output EtnTcpSta SktGetTCPSta
51. nfirmation dialog box is IL displayed Click the Yes Button Fee Sysmac Studio Make sure a Controller startup will cause no problem Do you want to change to RUN Mode Y N 2 Check the Monitor Button and Stop Monitoring Button on the toolbar of the Sysmac Studio to see if the Controller is in monitor Monitor status E Stop Monitoring Check that the Monitor Button is selected and grayed out and that Controller Simulation Tools Help the Stop Monitoring Button is selectable monitor status as Ctrl W4 shown in the right figure H m Offline Ctrl Shift Vv If the Controller is not in monitor Synchronization Ctrl M status select Monitor from the Mode k Controller Menu of the Sysmac Studio S 22 Select Watch Tab Page from the View Menu The Watch Tab Page is displayed in the lower section of the Edit Pane Check that the variables shown on the right are displayed in the Name Columns To add a variable click Input Name Program0 of the Name is omitted from the following descriptions Click TRUE on the Modify Column of Input Start The Online value of nput Start changes to True The program is operated and Ethernet communications are performed with the destination device When the communications end normally each error code changes to O TCP connection status Output EtnTcpSta changes to _ CLOSED In the case of error end the error code for an e
52. ng error Output_SktCmds EEE ErrorlD 16 0000 X 1162 SktClose Vn DE _instance BUSy Error end eSend processing SktTCPConnect i instance Done D or s l SktTCPSend _instance Execute e Tis TON _instance Q IO SktTCPSend _instance Busy EE SktTCPSend i _instance Done MMM SktTCPSend _instance Error l I SktTCPSend Y instance ErrorlD 1680000 1 l Local_ErrCode b 8 I Timeout GEN QNNM I Output sktCmds ErrorlD 16 0000 SktTCPRev SARE ERER _instance Busy Normal end SktTCPConnect instance DONC ei paras is Eee l SktTCPSend _instance Execute l Tfs TON r _instance Q l SktTCPSend S Sele _instance Busy E NE I SktTCPSend i instance Busy 4 ees kannan l SktTCPSend l _instance Done 1 TN SktTCPSend Y _instance Error 1 p dud ec I SktTCP Send _Yy l instance ErrorlD 16 0000 Local ErrCode b 8 2 m Timeout Output ErrCode Y 16 0000 16 0100 SktClose _instance BUSy 1 Timeout 9 Project File SktT CPConnect instance Done SktTCPSend _instance Execute equo d o Tfs TON instance Q 1 sa SktTCPSend _instance Busy Ep SktTCPSend i _instance Done 1 i SktTCPSend _instance Error pp c l r l 1 SktTCPSend ELO e _instance ErrorlD 670000 ome l Local ErrCode b 8
53. ng monitoring time Setting unit LOms lt 500 gt 5s gt Maximum waiting time of packet interval when a response which is divided into multiple packets is received Response instruction Also maximum waiting time for next response Receive waiting time monitoring timer TrTime UINT 3 Receive waiting monitoring time Setting unit 100ms lt 3 gt 300ms gt END IF RETURN o3 9 Project File e Description of SendMessageSet function block Instruction FB FUN ST expression expression General purpose E 5 ETN SendMessageSet instance SendMessageSet xU FB None communications Execute Send Data ComType sequence setting n out variable table arguments Input Name Data type Valid range Default The function block is executed when this Depends Execute BOOL Execute parameter changes from on data OFF FALSE to ON type TRUE Always TRUE Output Name Data type Valid range Default Depends STRINGI Sets a command that is sent to Send_Data 256 Send data the destination device es i Sets whether send receive Send receive processing are required ComType ERIS type 1 Send only 2 Receive only ito3 3 Send and receive Busy BOOL Done BOOL Eror BOOL Not used ErrorlD WORD Not used in this project information ErrorlDEx DWORD information Internal variable table Name Data type Valid range Default Depends S STRING 5 le Header of send message on data ader header
54. o perform the open processing Tfs TON instance TON Counts the time taken to perform the send processing Tfr TON instance TON Counts the time taken to perform the receive processing Tclose TON instance TON Counts the time taken to perform the close processing Tr TON instance TON Counts the time waiting for the next response 39 9 Project File 9 4 3 List of System Variables The variable necessary to execute the project file is shown below eSystem variable External variable Name Data type Description _ EIP EtnOnlineSta BOOL Communication function status of the Controller TRUE Can be used FALSE Cannot be used Additional Information For information on system variables and communications instructions refer to Communications Instructions in Section 2 Instruction Descriptions of the NJ series Instructions Reference Manual Cat No W502 40 9 Project File 9 5 Program ST language 9 5 1 Functional Components of ST Program This program is written in the ST language The functional components are as follows Major classification 1 Communications processing 2 Initialization processing 3 Open processing 4 Send processing 5 Receive processing Minor classification 1 1 Starting communications processing 1 2 Clearing the communications processing status flags 1 8 Communications processing in progress status 2 1 Initializing the processing time monitoring timer 2 2
55. on device error code If there is an error in the data received from the destination device the error code Is stored in the Output MErrCode variable Error code Description 164200000000 Normal end ER The response from the destination device is illegal 16 FFFFFFFF Not executed Additional Information For details and corrective actions for the destination device errors refer to Command Format under Controlling the Sensor from an External Device Procedure for No protocol Command Response Communications in 8 2 Outputting Controlling with Ethernet of the user s manual for each Code Reader 66 9 Project File 9 7 2 TCP Connection Status Errors and Corrective Actions This section describes the situation in which the TCP connection status errors occur and explains the corrective actions eAffects of the TCP connection errors After a TCP connection status error occurs if no corrective action is taken or the error is not noticed and this project file is executed again then the destination node specified with destination address input variable DstAdr and destination TCP port number input variable DstIcpPort may not be waiting for a connection Hereinafter this error is referred to as an open 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 eSituation in which the TCP connection status erro
56. or I O Cable Connector Start TouchFinder for PC PC tool for FQ on the personal computer which is connected to the Switching Hub Set the IP address of the personal computer to 10 5 5 101 Use the following procedure to check the IP address of the personal computer 1 Execute Network and Sharing Center from Control Panel 2 Double click Local Area Connection on the Network and Sharing Center Window 3 Click the Details Button on the Local Area Connection Status Dialog Box 4 Check that the IP address is set to 10 5 5 101 T TouchFinder for PC I Local Area Connection Status Network Connection Detail Network Connection Details Property Value Connection specific DN Description Intel R 82579LM Gigabit Network Cor Physical Address 18 03 3 AE EF 2E DHCP Enabled IPv4 Address IPv4 Subnet Mask IPv4 Address IPv4 Subnet Mask IPv4 Default Gateway IPv4 DNS Server IPv4 WINS Server NetBlOS over Tcpip En Link4ocal IPv amp Address fe80 2c62 c2 3 c392 46 732411 IPv amp Default Gateway IPv6 DNS Servers fec0 0 0 1 1 fec0 0 0 2 1 4 ls TIR 7 Connection Procedure The start screen of Touch Finder E rouchrinder for PO for PC is displayed Select a language at the first startup In the following example English is selected 4 Click the ELEM icon located at Touchfinder far puo the right bottom of the Touch Setup Finder for PC Window 5 Click Sensor Settings on the pop
57. put turn ON and then OFF The following table lists the variables that contain the execution results of this project file Name Data type Output RecvMess STRING 256 Output ErrCode WORD Output SktCmdsErr WORD orlD Output_SkTcloseErr WORD orlD Output EtnTcpSta eCONNECTI ON STATE Output MErrCode DWORD Description Stores the receive data response 256 byte area is secured Stores the error result flag for a communications error or timeout error detected during open processing send processing receive processing or close processing 160000 is stored for a normal end Stores each socket service instruction s error code for a communications error or timeout error detected during open processing send processing or receive processing 160000 is stored for a normal end Stores the SktTcpClose instruction s error code for a communications error or timeout error detected during close processing rather than an error detected during open processing send processing or receive processing 160000 is stored for a normal end Stores the TCP connection status when a communications error or timeout error is detected during close processing CLOSED is stored for a normal end Stores the error code for an FCS calculation error or a destination device error detected after the receive processing 16400000000 is stored for a normal end 36 9 Project File elnternal variables The following table lists the variables use
58. r Open processing time monitoring time enable flag Topen TON Local TONFIgs Topen Tclose TON Close processing time monitoring timer enable flag Local TONFIgs Tclose Receive waiting time monitoring timer enable flag Tr TON Next message waiting time Local TOMFIgs Tr Local TONflgs Tfr FALSE Local TONflgs Topen FALSE Local TONflgs Tclose FALSE Local TONflgs Tr FALSE 2 5 Initializing the error code storage areas Local_ErrCode WordData WORD 1640000 Output_ErrCode WORD 16 FFFF Output_MErrCode DWORD 16 FFFFFFFF Output_SktCmdsErrorlD WORD 16 F FFF Output_SkTcloseErrorlID WORD 16 FFFF 9 Project File 44 9 Project File 2 6 Setting each processing monitoring time and Ethernet related parameters ETN ParameterSet instance Execute TRUE 2 7 Setting the send receive processing required not required setting and send data ETN_SendMessage5et_instancel Execute TRUE Detect the send receive processing required not required setting error lt Memo on variable gt Local ComType Send Send processing required not required flag Local ComType Recv Recerve processing required not required flag Local ComType Error Send receive processing required not required setting error Local Coml ype Send l estABIt ETIN SendMaessageSet instance Com lype 0 Local_ComType Recv TestABIit ETIN SendMessageSet instance Com Type 1 Local ComType Error NOT Local Co
59. r occurs Both a TCP connection status error after the close processing and an open 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 Although all processing until the close processing of the project file ended in the Controller the close processing completion notification is not received from the destination device lt is not confirmed that the close processing is completed at the destination device eCorrective 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 P Precautions for Correct Use Make sure the destination device is disconnected from other device before resetting the communications port of the destination device eState of the Controller at a TCP connection status error When a TCP connection status error occurs the processing of this project file is completed However the resend time monitoring function of the Controller TCP IP function which is described in 9 3 2 Time Monitoring Function may be operating T
60. ror 1 I SktClose J _instance ErrorlD 1650000 SktGetTCPStatus _instance Execute QE REM SktGetTCPStatus p _instance Busy________ SktGetTCPStatus DEB _instance Done poo SktGetTCPStatus _instance TepSta XXX CLOSED Local ErrCode b 3 Close processing error Local ErrCode b 11 Timeout Output skTclose ErrorlD 1620000 Output Statb 0 Busy ieee id Normal end FB Rev Done etc r SktClose _instance Execute r s Telose TON _instance Q Eu I SktClose LaS _instance Busy l I SktClose i _instance Busy Stopped 4 ele had I l SkiClose _instance Done g b Esq r EN I l SktClose Y _instance Error bte a SktClose _instance ErroriD Ww 1980000 Local ErrCode b 3 Close processing error Local ErrCode b 11 Timeout Le Output ErrCode 1640000 1620800 Output Statb 0 Y Busy a E Timeout I _instance Busy Stopped 4 e I 9 Project File SktTCPRcv instance Done etc SktClose _instance Execute E A I Tclose TON _instance Q SktClose _instance Busy yo 2 Y SktClose me 2 SktClose _instance Done v v jn I SktClose instance Error u o SktClose x _instance ErrorlD 16 000Q 16 I Local ErrCode b 3 Close processing error 40 Local ErrCode b 11 Timeout a S Output skTclose XXX ErrorlD 16 0000X 16H Output Statb 0
61. rror is stored For details on error codes refer to 9 7 Error Process C Zoom k 7 Connection Procedure Output Tab Pag Cross Reference Tab Page Alt 5 Build Tab Page Alt 6 search and Replace Results Tab Page Alt Simulation Pane Alt 8 Y ie Primary Task 1 Programa Online valuri Mindi Program Input Start ES Start input N ProgramO Output_ErrCode Error codes Program Output sktCmdsErroriD Program Output sktCloseErrorID TCP Program Output MErrCode connection Program Output EtnTcpSta status ProgramO ETN_SendMessageset_ instance Send Data Program execution status Receive data Send data Online value Modify Program Input Start TRUE FALSE Name Online value Modify Program Input Start FALSE Name _ Online value Modify ProgramO nput_Start Pragram Output ErrCode 0000 Program Output SktCmdsErroriD 0000 Program Output sktCloseErrorID 0000 Program Output MErrCade 0000 0000 Program Output EtnTcpSta CLOSED 23 7 Connection Procedure The Online value of Local_Status Done which 4 Program Local Status indicates the execution status Of False TRUE FALSE the program changes to True n True TRUE FALSE False TRUE FALSE the case of error end Local_Status Error changes to True When nput Start changes to FALSE each Local Status variable also changes to False For details refer to 9 6 Timing Charts The response data received from Name Onl
62. s parameter changes Depends on f Execute BOOL Execute trom OFF FALSE to ON data type TRUE Always TRUE Output Name Unit Default Open Sets the monitoring time of the Depends TopenTime UINT monitoring open processing in increments on data time of 10 ms type Send Sets the monitoring time of the Depends TfsTime UINT monitoring send processing in increments on data time of 10 ms type Ai Sets the waiting time for the Depends TrTime UINT TS receive data in increments of on data monitoring 100 ms type time Receive Sets the monitoring time of the Depends TfrTime UINT processing receive processing in on data time increments of 10 ms type Close Sets the monitoring time of the Depends TcloseTime UINT monitoring close processing in increments on data time of 10 ms type Local port Pepends SrcPort UINT Sets the local port on data number type we Depends DstlPAddr STAING esunaHoh Sets the destination IP address on data 256 IP address type Depends Sets the destination port on the Destination DstPort UINT port number Busy BOOL end Eror BOOL Not used Error Not used in this project ErrorlD WORD information Error ErrorlDEx DWORD Internal variable table None number destination device 92 Program Name Ni series general purpose Ethernet communications Parameter setting function block Function Processing monitoring time settings and Et
63. s sControl Socket service instruction execution flag STRUCT Send processing instruction Executed TRUE Not executed FLASE Recv BOOL Receive processing instruction Executed TRUE Not executed Open processing instruction Executed TRUE Not executed FLASE Close processing instruction Executed TRUE Not executed FLASE TCP status instruction Executed TRUE Not executed FLASE Local SrcDataByte Sets the number of send data bytes 37 Local_SrcData 9 Project File Name Data type Description ARRAY O 2 An area that stores the data sent by the SktT CPSend instruction 000 OF SktTCPSend instance 256 byte area is secured BYTE Local RecvData ARRAYIO 2 Stores the data response received by the SktT CPRov instruction 000 OF BOOL SktTCPRcv instance 256 byte area is secured Local ReceiveMes STRING 25 Stores the STRING data response received by Local RecvData sage 6 256 character area is secured Local RecvCheckF BOOL Destination device error detection instruction execution flag lg Executed TRUE Not executed FLASE Local nitialSetting BOOL Initialization processing normal setting flag mm Local TONFIgs sTimerCont Timer enable flag rol STRUCT Tfs BOOL Send processing time monitoring timer instruction m Enabled TRUE Disabled FALSE Tfr BOOL Receive processing time monitoring timer instruction Enabled TRUE Disabled FALSE Topen BOOL Open processing time monitoring timer instru
64. sing or close processing the error flag will be set in the Output ErrCode variable and the error code will be stored in the Output SktCmasErrorlD variable or the Output SkTcloseErrorlD variable If an error end or a timeout occurs for the close processing check also the Output EtnTcpSta variable for the TCP connection status error O Open processing SktTCPConnect instruction S Send processing SktTCPSend instruction R Receive processing SktT CPRcv instruction C Close processing SktClose instruction Target processing is indicated by o Error Flag ekb aee Description 1680000 o o o o Normal end 1620001 fof Send processing ended in error 160002 d Jel Receive processing ended in error 16420004 o i Open processing ended in error 1640008 le Close processing ended in error 160100 fof Send processing did not end in time 1640200 Jel Receive processing did not end in time Including when an arrival of the response cannot be checked 16 0400 Pol Open processing did not end in time 160800 d le Close processing did not end in time 160010 Pf Processing number error 16 0020 Send receive reguired not reguired detection error 16 1000 Destination device error 16 2000 Pf Destination device FCS checksum error 1688000 o o o o Error occurs The error flags detected for each processing are added and the addition result is stored in the error flag eDestinati
65. tance Q THEN Local ErrCode BoolData 9 Z TRUE Output_SktCmdsErrorlD WORD 16 FFFF Local ExecFlgs Recv z FALSE Local ExecFlgs Status FALSE Local TONflgs Tfr FALSE Local State 14 To 14 Close processing 5 1 5 Normal end processing ELSIF SktTCPRcv instance Done THEN Local RecvDataLength Local_RecvDatalength SktTCPRev_instance Revsize Local_RecvCHNo Local_RecvDataLength Local ExecFlgs Recw FALSE Local_TONflgs Tfr FALSE Local TONflgs Tr TRUE Ta 5 1 5 Receive data read processing 5 1 4 Error end processing ELSIF SktTCPRcv instance Error THEN Local ErrCode BoolData 1 TRUE Output SktCmdsErrorID SktTCPRcv instance ErrorID Local ExecFlgs Recv FALSE Local TONflgs Tfr FALSE Local S5tate 14 To 14 Close processing 3endDat Local SrcData U 48 5 1 5 Receive data read processing ELSIF SktGetTCPStatus instance Done OR SktGetTCPStatus_instance Error THEN Local ExecFlgs Status FALSE When there is data to read Continues the receive processing IF SktGetTCPStatus instance DatRcvFlag THEN Local ExecFlgs Recv TRUE Local TONflgs Tfr TRUE Local TONflgs Tr FALSE END IF When there is no data to read If no data is received re execute the get TCP status at the next cycle without performing any processing If data has already been received monitor the response receive waiting time If there is no more response and a timeout occurs read the data t
66. tination device within this time it is detected that the receive processing ends Additional Information For information on the time monitoring function of the socket service refer to Communications Instructions SktTCPRcv in Section 2 Instruction Descriptions of the NJ series Instructions Reference Manual Cat No W502 34 9 Project File eResend time monitoring functions of the Controller TCP IP When a communication problem occurs TCP IP automatically resends the data and monitors the processing time if there is no error in the Controller lf the processing ends in an error this project file performs the close processing and stops the TCP IP resend time monitoring function lf a TCP connection status error occurs during close processing the TCP IP resend time monitoring function of the Controller may be operating For information on the status and corrective actions refer to 9 7 2 TCP Connection Error Status and Corrective Actions 35 9 4 Variables 9 Project File The table below lists the variables used in this project file 9 4 1 List of Variables The variables necessary to execute this project file are listed below elnput variable The following table shows the variable used to operate this project file Name Data type Description Input Start BOOL This project file is started by turning OFF FALSE and then ON eOutput variables TRUE After checking the normal end output or error end out
67. tion via a hub v Remote IP Address Select a method to connect with the Controller to use every time you go online USB Communications Test Ethernet Communications Test Y Ophons E Confirm the serial ID when going online E Check forced refreshing when going offline Response Monitor Time Set the Response Monitor Time in the communications with the Controller s Controller Simulation Tools Help Communications Setup Change Device Ctrl Shift W The CPU Unit has no name Do you want to write the project name new NJ501 0 to the CPU Unit name Y N Ve N 19 7 Connection Procedure Sysmac Studio Serial ID not matched Project Mame new NJ501 0 Serial ID L701 08111 0104 Controller Name new N1501 0 Serial ID R01 07X11 0550 Do you want to continue the connection processing Y N Din you want to change the Serial IT in the project to the controller s Serial IT Y N It wall be used at the ID check of next online connection 4 When an online connection is established a yellow bar is H Programming displayed on the top of the Edit gt Pane 5 Select Synchronization from Controller Simulation Tools Help the Controller Menu Offline Ctrl Shift W Ctrl W i 6 The Synchronization Dialog Box F Compuler Dala Mame Compuler Updale Datontroller Update Da Conbrolles Data Name Compara IS d
68. tus instance TcpStatus Local ExecFlgs Close FALSE Determining results of the whole communication processing Local Status Busy z FALSE Communication processing normal end IF Local ErrCode WordData WORD 16 0000 THEN Local Status Done TRUE Local ErrCode BoolData 15 FALSE Communication processing error end ELSE Local 5tatus Error TRUE Local ErrCode BoolData 15 Z TRUE END IF Output ErrCode Local ErrCode WordData Local State z 0 Communication not in progress status END IF END IF 6 1 3 Error end processing ELSIF SkTclose instance Error THEN Local ErrCode BoolData 3 Z TRUE Output SkTcloseErrorID SkTclose instance ErrorID Local ExecFlgs Close FALSE Local TONflgs Tclose z FALSE Local ErrCode BoolData 15 ZTRUE Output ErrCode Local ErrCode WordData Local Status Busy FALSE Local Status Error TRUE Local State 0 0 Communication not in progress status 50 6 1 4 Setting the close instruction execution flag setting the timer enable flag ELSE Local ExecFlgs Close TRUE Local TONflgs Tclose TRUE END IF 6 2 Enabling the close processing time monitoring timer Tclose TOM instance In Local TONflgs Tclose PT ZMULTIME TIME 10ms ETN ParameterSet instance TcloseTime 6 3 Executing the close instruction When the built in Ethernet can be used when EIP EtnOnlineSta is ON execute the close instruction SkTclose instance Exec
69. urning ON the input start flag when communications processing status flags have been cleared IF Input_Start AND NOT Local Status Busy OR Local Status Done OR Local Status Error THEN Local Status Busy z TRUE Local State 10 To 10 Initial processing END IF 1 2 Clearing the communications processing status flags Clear communications processing status flags by turning OFF the input start flag while communications processing is not in progress IF NOT Local Status Busy AND NOT Input Start THEN Local Status Done FALSE Local Status Error FALSE END IF 1 3 Communications processing in progress status Execute processing according to the status processing number Local State IF Local Status Busy THEN CASE Local State OF 43 2 Initialization processing 10 2 Initialization processing Initialize the whole communications and set parameters Set send data and initialize the receive data storage areas 2 1 Initializing the processing time monitoring timer Topen TON instance In FALSE PT TIME 0ms Tfs TON instance In FALSE PT TIME 0ms Tr TON instance In FALSE PT TIME 0Oms Tfr TON instance In FALSE PT TIME 0ms Tclose TON instance In z FALSE PT TIME 0Oms 2 2 Initializing the socket service instructions SktTCPConnect instance Execute FALSE SrcTcpPort UINT O DstTcpPort UINT 0O DstAdr SktTCPSend_instancel Execute FALSE Socket NULL_SOCKET Size
70. ute Local_ExecFlgs Close AND EIP Etn nlineSta Socket Sktl CPConnect_instance Socket 6 4 Executing the get TCP status instruction When the built in Ethernet cans be used when EIP EtnOnlineSta is ON execute the get TCP instruction SktGetTCPStatus instance Execute Local_ExecFlgs 5tatus AND _EIP_EtnOnlineSta Socket Sktl CPConnect_instance Socket 7 Processing number error process 99 7 Processing number error process Error processing for when a non existent processing number is set Output ErrCode WORD 1630010 Local Status Busy z FALSE Local Status Error Z TRUE Local _State 0 To 0 Communication not in progress status ELSE Local State 95 To 99 Processing number error process END CASE END IF 9 Project File 91 9 Project File 9 5 3 Detailed Description of Function Blocks The function blocks used in this project file are shown below Data that need to be changed depending on the destination device are set in the red frames on the function blocks below e Description of ParameterSet function block Graphic Instruction FB FUN ST expression General purpose ETN ParameterSet instance Ethernet Execute TfsTime TrTime TfrTime Parameterset Communications i DN TopenTime TcloseTime SrcPort Parameter setting DstIPAddr DstPort n out variable table arguments Input Name Data type Valid range Unit Default The function block is executed when thi
71. v o instance Execute Tfr TON instance Q Tr TON instance Q SktTCPRcv _instance Busy KA lag vi SktTCPRcv jare 21 _instance Busy FA Ta 55st r SktTCPRoy _instance RcvDat 16 0000 SktT CPRcv _instance Done 4 SktTCP Rev i A _instance Error I SkiTCPRcv kkk _instance ErrorlD 6 0000 16 Local_ErrCode b 9 i Timeout Output skt mds A ErrorlD 1640000 X 16H SktClose CAS _instance Busy Error end 61 SKITCPSend INSTANCE DONG lt a da id I SktGetTCPStatus instance EE I SKITCPRev y instance Execute EE Tir TON i _instance Q A SktTCPRcv mote instance Busy i I SktTCPRev i _instance Busy Stopped 4 i Luca l l I SktTCPRcv r _instance RcvDat 3009000 1 i l I SktTCPRev _instance Done La am i SKTCPRcv i Y instance Error _______ ti E ISA SktTCPRev A _instance ErrorlD 1 6 0000 Local_ ErrCode b 9 Timeout _ Output_sktCmds ErrorlD 1 6 0000K 16 F301 SktClose A ETEA _instance BUSy 1 Timeout Receive error SktTCPSend _instance Done SktGetTCPStatus _instance DatRcvFla ee SktTCPRev _instance Execute VA e l Tfr TON instance Q Tr TON instance Q _
72. ve Keep Alve Use Do not use Keep Alive monitoring time EEN sec Linger option Q Do not specify Specify IP Router Table Destination IP Address Destination Mask IP Address 3 Double click the Task Settings b i Motion Control Setup under Configurations and amp Cam Data Settings Setup in the Multiview Explorer Event Settings H Data Irace setings 17 7 Connection Procedure The Task Settings Tab Page is displayed in the Edit Pane Select the Program Assignment Settings Button MA PrimaryTask and check that ProgramO is set m D 1 Program A Configurations and Setup under PrimaryTask Select Check All Programs from the Project Menu Check Selected Programs Shift F Build Controller FE Rebuild Controller The Build Tab Page is displayed in the Edit Pane Check that 0 Errors and 0 Warnings are displayed Program Select Rebuild Controller from er Simulation Tor the Project Menu Check All Programs F7 Check Selected Programs Shift F Build Controller FE A screen is displayed indicating the conversion is being performed Check that 0 Errors and 0 Warnings are displayed in the 1 Build Tab Page Ae Location Location 7 Connection Procedure 7 3 3 Going Online and Transferring the Project Data Connect online with the Sysmac Studio and transfer the project data to the Controller A WARNING Always confirm safet
73. y at the destination node before you transfer a user pro gram configuration data setup data device variables or values in memory used for CJ series Units from the Sysmac Studio The devices or machines may perform unexpected operation regardless of the operating mode of the CPU Unit EN Additional Information For details on the online connections to a Controller refer to Section 5 Going Online with a 1 Select Communications Setup from the Controller Menu 2 The Communications Setup Dialog Box is displayed Select the Direct Connection via USB Option from Connection Type Click the OK Button 3 Select Online from the Controller Menu A confirmation dialog box is displayed Click the Yes Button The displayed dialog depends on the status of the Controller used Select the Yes Button to proceed with the processing The displayed serial ID differs depending on the device Controller in the Studio Version 1 0 Operation Manual Controller Simulation Tools Help Change Device Online Ctrl W Ctrl Shift MW v Connection type Splar n mathad tn mannast uth the Controller to use every time you go online O Direct connection via USD Gg Direct connection ma Ethemet o Remote connecbon via USB tthemet connection ma a hub Q Select one method from these options at every online connection H Direct connection via USR Miren connection wa Fthemet E Remote connection via USB H Ethemet connec

Download Pdf Manuals

image

Related Search

Related Contents

Cordon d`alimentation  Panasonic RC-DC1EG-K  User Manual  Manual de Instalação  TEST REPORT - ICP DAS USA`s I  

Copyright © All rights reserved.
Failed to retrieve file