CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 34
Текст из файла (страница 34)
If an improper setting is used, a non-fatal error will occur, AR 1302 will beturned ON, and the default setting (0, 00, or 0000) will be used.2. For information on the Host Link settings for another OMRON PC, refer tothat PC’s Operation Manual.205SectionCPM1/CPM1A Communications Functions4-23. If an out-of-range value is set, the following communications conditions willresult. In that case, reset the value so that it is within the permissible range.Example ProgramCommunications mode:Host LinkCommunications format:Standard settings(1 start bit, 7-bit data; 2 stop bits, even parity,9,600 bps)Transmission delay:NoNode number:00This example shows a BASIC program that reads the status of the CPM1’s inputs in IR 000.
For more details, refer to 4-5 Host Link Commands.An FCS (frame check sequence) check isn’t performed on the received response data in this program. Be sure that the host computer’s RS-232C port isconfigured correctly before executing the program.101010201030104010501060107010801090110011101120113011401150116011701180’CPM1 SAMPLE PROGRAM’SET THE COMMAND DATAS$=”@00RR00000001”FCS=0FOR I=1 TO LEN(S$)FCS=FCS XOR ASC(MID$(S$,I,1))NEXT IFCS$=(FCS):IF LEN(FCS$)=1 THEN FCS$=”0”+FCS$CLOSE 1CLSPRINT ”SENDING COMMAND”OPEN ”COM:E73” AS #1PRINT #1,S$ + FCS + CHR$(13);CLSPRINT ”RECEIVING RESPONSE DATA”LINE INPUT #1,A$PRINT A$END4-2-2 One-to-one NT Link CommunicationsUsing the 1:1 NT Link, the CPM1/CPM1A PC can connected to the Programmable Terminal (NT Link Interface) through an RS-232C Adapter.CPM1 PCsRS-232C AdapterOMRON Programmable TerminalCPM1 CPU UnitCPM1 CPURS-232C Cable206SectionCPM1/CPM1A Communications Functions4-2CPM1A PCsRS-232CAdapterOMRON Programmable TerminalCPM1A CPU UnitRS-232C CablePC Setup SettingsWordBitDM 6650 00 to 07The settings relating to 1:1 NT Link PC communications must be set as shown inthe following table.Functionsettings1SettingPort00: Standard (1 start bit, 7-bit data, 2 stop bits, even parity, 9,600 bps)01: Settings in DM 665100(Any value is OK)08 to 11Link area for 1:1 PC Link via peripheral port0: LR 00 to LR 150(Any value is OK)12 to 15Communications mode10: Host Link; 2: 1:1 PC Link Slave; 3: 1:1 PC Link Master; 4: 1:1 NT Link4Note1.
If an improper setting is used, a non-fatal error will occur, AR 1302 will beturned ON, and the default setting (0 or 00) will be used.2. For information on the NT Link settings for another OMRON PC, refer to thatPC’s Operation Manual.3. If an out-of-range value is set, the following communications conditions willresult. In that case, reset the value so that it is within the permissible range.Communications mode:Host LinkCommunications format: Standard settings(1 start bit, 7-bit data; 2 stop bits, even parity,9,600 bps)Transmission delay:NoNode number:004-2-3 One-to-one PC Link CommunicationsIn a 1:1 PC Link, a CPM1/CPM1A is linked to another CPM1/CPM1A, CPM2A/CPM2C, CQM1, C200HX/HG/HE, or C200HS PC through an RS-232C Adapterand standard RS-232C cable.
One of the PCs will serve as the Master and theother as the Slave. The 1:1 PC Link can connect up to 256 bits (LR 0000 to LR1515) in the two PCs.207SectionCPM1/CPM1A Communications FunctionsCPM1/CPM1A One-to-onePC Links4-2The following diagram shows a 1:1 PC Link between two CPM1s PCs.
Refer tothe CPM1A Operation Manual for the corresponding information on the CPM1A.RS-232C CableRS-232C AdapterRS-232C AdapterCPM1 CPU UnitCPM1 CPU UnitThe words used for the 1:1 PC Link are as shown below.LR00Write dataRead dataMasterSlaveArea for writingLR07LR08LR00Read dataArea for readingArea for readingArea for writingLR15LR07LR08Write dataLR15Limitations of 1:1 PC Linkswith a CPM1/CPM1AOnly the 16 LR words from LR 00 to LR 15 can be linked in the CPM1/CPM1A, souse only those 16 words in the CQM1 or C200HS when making a 1:1 PC Linkwith one of those PCs.
A 1:1 PC Link cannot be made to a CPM1/CPM1A PCusing LR 16 through LR 63 in the CQM1, C200HX/HG/HE, or C200HS.PC Setup SettingsThe settings relating to 1:1 PC Link communications must be set as shown in thefollowing table.WordBitDM 6650 00 to 07FunctionPort settings100: Standard (1 start bit, 7-bit data, 2 stop bits, even parity, 9,600 bps)01: Settings in DM 6651Setting(Slave)00(Any value is OK)08 to 11Link area for 1:1 PC Link via peripheral port0: LR 00 to LR 1500(Any value is OK)12 to 15Communications mode10: Host Link; 2: 1:1 PC Link Slave; 3: 1:1 PC Link Master; 4: 1:1 NT Link32Note208Setting(Master)00(Any value is OK)1. If an improper setting is used, a non-fatal error will occur, AR 1302 will beturned ON, and the default setting (0 or 00) will be used.2.
For information on the 1:1 PC Link settings for another OMRON PC, refer tothat PC’s Operation Manual.3. For information on CPM1/CPM1A 1:1 PC Link connections and wiring diagrams refer to 3-4-7 Host Link Connections in the CPM1 Operation Manualor CPM1A Operation Manual. For the SRM1(-V2) refer to 3-4-4 RS-232CPort Wiring in the SRM1 Master Control Unit Operation Manual.4. If an out-of-range value is set, the following communications conditions willresult. In that case, reset the value so that it is within the permissible range.Communications mode:Host LinkCommunications format: Standard settings(1 start bit, 7-bit data; 2 stop bits, even parity,9,600 bps)Transmission delay:NoNode number:00SectionCPM2A/CPM2C Communications FunctionsExample ProgramThis example shows ladder programs that copy the status of IR 000 in eachCPM1/CPM1A to SR 200 in the other CPM1/CPM1A.Program in the MasterProgram in the Slave25313 (Always ON)25313 (Always ON)MOV(21)MOV(21)000000LR00LR08MOV(21)MOV(21)LR08LR00200200LR00IR 000SR 200WriteReadLR00Writing areaLR07LR08Reading areaReading areaWriting areaLR154-34-3ReadSR 200WriteIR 000LR07LR08LR15CPM2A/CPM2C Communications FunctionsThis section describes how to use CPM2A/CPM2C communications functions.Read this section if you are using Host Link, no-protocol, 1:1 NT Link, or 1:1 PCLink communications.4-3-1 Host Link CommunicationsHost Link communications are a conversational-type communications protocol,in which the PC sends responses to commands issued from a host computerand can be used to read or write data in the PC’s data areas and control some PCoperations.
There is no need for a communications program in the PC. Host Linkcommunications can be used through the peripheral port or the CPM2A/CPM2C’s RS-232C port.CPM2ACommandsHost computerResponses209SectionCPM2A/CPM2C Communications FunctionsCPM2A One-to-one CommunicationsCommandsResponsesResponsesCommandsOMRON ProgrammableTerminalCPM2A RS-232C port connection(See note.)CPM2A RS-232C port connection(See note.)Note When connecting to the peripheral port, an RS-232C Adapter or computerconnection cable (CQM1-CIF01 or CQM1-CIF02) is necessary.CPM2C One-to-one CommunicationsConnecting CableRS-232C port (D-sub 9-pin)CPM2C CPU UnitXW2Z-200S-V (2 m)XW2Z-500S-V (5 m)CPM2C-CN111 (0.15 m)IBM PC/ATor compatibleCS1W-CN118 (0.1 m)CPM2CCPU UnitCPM2C-CIF01CPM2CCPU UnitCPM2C-CIF112104-3SectionCPM2A/CPM2C Communications Functions4-3ResponsesIBM PC/ATor compatibleCommandsCPM2A 1:N CommunicationsCPM2A RS-232Cport connectionNT-AL001 RS-232C/RS-422Conversion AdapterB500-AL004Link AdapterCPM2A peripheralport connectionCPM1-CIF01 RS-422 Adapter211SectionCPM2A/CPM2C Communications FunctionsCPM2C 1:N CommunicationsIBM PC/AT orcompatiblecomputerConnecting CableXW2Z-200S-V (2 m)XW2Z-500S-V (5 m)B500-AL004 or NT-AL001 (requires +5 V)(See notes 1 and 2.)RS-422 (Total length: 500 m max.)When using the portas a peripheral portCPM2CCPU UnitCPM2-CIF11When using the portas an RS-232C portCPM2CCPU UnitCPM2-CIF11CPM2CCPU UnitXW2Z-070T-1 (0.7 m)XW2Z-200T-1 (2 m)CPM2-CIF11NT-AL001(See note 1.)RS-232C portCPM2CCPU UnitNT-AL001(See note 1.)NT-AL001(See note 1.)XW2Z-070T-1 (0.7 m)XW2Z-200T-1 (2 m)XW2Z-070T-1 (0.7 m)XW2Z-200T-1 (2 m)RS-232C portCPM2C-CN111Connecting Cable(0.15 m)CPM2-CIF01Up to 32 PCs212CPM2CCPU UnitCPM2CCPU UnitRS-232C portCSW1-CN118 Connecting Cable (0.1 m)4-3SectionCPM2A/CPM2C Communications Functions4-3Frame Transmission and ReceptionIn Host Link communications, the host computer ordinarily has the transmissionright first and initiates the communications.
The CPM2A/CPM2C then automatically sends a response.Commands and responses are exchanged in the order shown in the illustrationbelow. The block of data transferred in a single transmission is called a “frame.”A single frame is configured of a maximum of 131 characters of data. The right tosend a frame is called the “transmission right.” The Unit that has the transmission right is the one that can send a frame at any given time. The transmissionright is traded back and forth between the host computer and the CPM2A/CPM2C each time a frame is transmitted. The transmission right is passed fromthe transmitting Unit to the receiving Unit when either a terminator (the code thatmarks the end of a command or response) or a delimiter (the code that setsframes apart) is received.Frame (command)Frame (command)HostcomputerUnit no.Header codeUnit no.Header codeTextTextFCSTerminatorFCSTerminatorNext frame transmissionenabled (i.e., transmissionright transferred)Unit no.Header codeEnd codeUnit no.Header codeEnd codeTextTextFCSTerminatorFCSTerminatorFrame (response)Frame (response)CPM2A/CPM2CSlave-initiatedCommunicationsData transmissions from the PC to the host computer can be initiated by the CPUUnit using TXD(48).HostcomputerThere is no responsefrom the host computerUnit no.Header codeCPM2A/CPM2CTextFCSTerminatorFrame (response)213SectionCPM2A/CPM2C Communications Functions4-3Command and Response FormatsThis section explains the formats for the commands and responses that are exchanged in Host Link communications.When transmitting a command from the host computer, prepare the commanddata in the format shown below.Command Format@x 101 x 100Node No.*HeadercodeTextFCS↵Terminator@An “@” symbol must be placed at the beginning.Node No.Identifies the CPM2A/CPM2C PC communicating with the host computer.Specify the CPM2A/CPM2C’s node number in the PC Setup (DM 6648,DM 6653).Header CodeSet the 2-character command code.TextSet the command parameters.FCSSet a 2-character Frame Check Sequence code.
See page 216.TerminatorSet two characters, “*” and the carriage return (CHR$(13)) to indicate the end ofthe command.The response from the CPM2A/CPM2C is returned in the format shown below.Prepare a program so that the response data can be interpreted and processed.Response Format@x 101 x 100Node No.x 161 x 160HeadercodeEnd code*TextFCS↵Terminator@, Node No., Header CodeContents identical to those of the command are returned.End CodeThe completion status of the command (e.g., whether or not an error has occurred) is returned.TextText is returned only when there is data such as read data.FCSThe set 2-character Frame Check Sequence is returned.TerminatorSet two characters, “*” and the carriage return (CHR$(13)) to indicate the end ofthe response.Long TransmissionsThe largest block of data that can be transmitted as a single frame is 131 characters. A command or response of 132 characters or more must therefore be divided into more than one frame before transmission.