• 沒有找到結果。

Introduction

A host computer (see note 1) can communicate with the ZEN using the CompoWay/F communications protocol. The host computer is programmed to monitor and set ZEN settings. This manual is thus written from the viewpoint of the host computer. Up to 32 nodes including host computers can be connected via CompoWay/F.

CompoWay/F is an integrated protocol for OMRON general-purpose serial communications. Consistent frame formats and commands that are compliant with FINS (see note 2), which is widely used with OMRON Programmable Controllers (PLCs), enable easy communica-tions between a host computer and components.

Note 1:Host computers include personal computers.

Note 2:FINS (Factory Interface Network Service) is a message service used between controllers on OMRON FA networks.

The ZEN supports the following communications functions.

• Reading/writing of parameters

• Operation instructions

Note: RS-485 communications are not possible when a computer running ZEN Support Software is online with the CPU Unit.

■Communications Specifications

Item Details Default settings

Transmission line connection Multi-drop None

Communications method RS-485 (2-wire, half-duplex) None

Synchronization method Start-stop synchronization None

Communications baud rate 4800, 9600, or 19200 bps 9600 bps

Communications code ASCII None

Communications data bits 7 or 8 bits 7 bits

Communications stop bits 1 or 2 bits 2 bits

Error detection Vertical parity (none, even, or odd) Even BCC (Block Check Character) None

Flow control None

---Interface RS-485

---Retry function None

---Communications buffer 36 bytes

---Communications protocol CompoWay/F None

Number of nodes 1:1 connection:

1 node 1:N connections:

32 nodes max. including host computer

None

1.1 Overview of Communications Methods

Ov er vie w

Transmission Procedure

When the host computer transmits a command frame, the ZEN transmits a response frame that corresponds to the command frame. A single response frame is returned for each command frame. The following diagram shows the operation of the command and response frames.

Note: Allow a wait time of at least 2 ms before the next command is sent after the host computer receives a response from the ZEN.

Interface

Use of the following Converter for RS-232C and RS-485 interface conversion is recommended.

Wiring

This section explains how to perform the ZEN’s communications wiring.

For details on the host computer, refer to the user documentation provided with the host computer.

• Match the communications specifications of the ZEN and the host computer.

• The connection format can be either one-to-one or one-to-N.

• Up to 32 units including the host computer can be connected in a one-to-N system.

• The total cable length is 500 m max.

• Use a shielded twisted-pair cable with wires of a thickness of AWG28 to AWG14 for communications signal wiring.

Note: When using a 1:N connection, set the same communications specifications in all of the Units, and set a unique node number for each Unit.

ZEN

Command frame Command frame

Response frame Host computer

Name Model Details

Interface Con-verter (OMRON)

K3SC Communications between the host computer and the ZEN conform to the RS-485 interface.

Ov er vie w

SECTION 1 Communications Methods

Wiring Diagram

Note: Refer to the operation manual for the RS-232C/RS-485

Converter for wiring between the Converter and host computer.

Communications Parameters

Communications are performed with an external host computer. The communications parameters that can be set are listed in the following table.

Note: Refer to the ZEN Programmable Relay Version 2 Operation Manual (Cat. No. Z211) for other parameters.

• Node Number

For communications with a host computer, set a node number for each ZEN so that it can be recognized by the host computer. The node numbers can be set from 00 to 99.

Note: The same node number cannot be set for more than one ZEN. If duplicate node numbers are set, correct operation will not be possible.

• Communications Baud Rate

This parameter sets the baud rate for communications with the host computer. The baud rate can be set to any of the following:

4,800 bps, 9,600 bps, or 19,200 bps.

Signal

Item Display Set values Default

settings Unit

Node number NODE NO 00 or 01 to 99 1

---Communications baud rate COM SPEED 4800, 9600, or 19200 9600 bps

Communications data length DATA BIT 7 or 8 7 bit

Stop bits STOP BIT 1 or 2 2 bit

Parity PARITY None, even, or odd Even

---1.1 Overview of Communications Methods

Ov er vie w

• Communications Data Length

This parameter sets the number of communications data bits. Set either 7 bits or 8 bits.

• Stop Bits

This parameter sets the number of communications stop bits. Set either 1 or 2.

• Parity

This parameter sets the communications parity. Set the parity to none, even, or odd.

Setting Communications Parameters

Set the communications parameters for the ZEN from the ZEN Support Software or from the RS-485 communications submenu of the CPU Unit.

• Settings cannot be changed in RUN mode. Switch to STOP mode first using the following procedure and then set the communications parameters.

• Any communications parameters that are set are valid from the next time a communication is received.

Changing from RUN Mode to STOP Mode

RUN Mode Power

ON

The screen to the left is displayed when the power is turned ON.

↓ Main Menu

Press the OK Button to display the Menu Screen.

Press the Down Button to move the flashing cursor to STOP.

Press the OK Button to switch the display to RUN.

Refer to Displaying the RS-485 Communications Submenu on page 6 to display the RS-485 Communications Sub-menu. RUN PARAMETER SET CLOCK

Ov er vie w

SECTION 1 Communications Methods

Displaying the RS-485 Communications Submenu

RS-485 Communications Submenu Setting Examples

RS-485 Communications Submenu STOP Mode

(See note.)

The screen at the left will be displayed when the ZEN is in STOP mode.

Press the OK Button to display the Menu Screen.

Note: This step is not required after switching from RUN Mode to STOP mode.

Main Menu

Press the Down Button to move the flashing cursor to RS485.

Submenu

Press the OK Button to display the RS-485 Communica-tions Submenu.

↓ Power

ON

Press the Up and Down Buttons to move the flashing cur-sor to the items on the submenu.

Power ON

The RS-485 Communications Submenu Screen will be dis-played when the power is turned ON. Use the Up and Down Buttons to move the flashing cursor to NODE NO.

Press the OK Button to display the currently set value. The highlighted cursor will flash.

Again press the OK Button. The highlighted cursor will be changed to a flashing cursor, and the set value will be ready to be changed.

Use the Right and Left Buttons to move the flashing cursor to the digit that is to be changed.

Use the Up and Down Buttons to change the number.

(See note.)

Press the OK Button. A message will be displayed to confirm whether the changed setting is to be saved.

Note: The setting will not be saved if the ESC Button is pressed.

Press the OK Button to save any changes and return to the RS-485 Communications Submenu Screen.

MO13:15 STOP I:oooooo Q:[[[[

2 PROGRAM

RUN PARAMETER SET CLOCK

1.1 Overview of Communications Methods

Ov er vie w

↓ Main Menu

Press the ESC Button to return to the Menu Screen.

SET CLOCK LANGUAGE RS485 OTHER

Ov er vie w

SECTION 1 Communications Methods

SECTION 2

CompoWay/F Communica-tions Protocol

This section describes the protocol for communications using the CompoWay/F format.

2.1 Data Format... 10 Command Frame... 10 Response Frame ... 11 Communications Data ... 12 2.2 Structure of Command Text ... 14 PDU Structure ... 14 Addresses... 14 Number of Elements... 14 List of Services ... 15 2.3 Detailed Description of the Services... 16 Read Variable Area ... 16 Variable Type and Read Start Address ... 16 Bit Position... 16 Number of Elements... 16 Response Code... 16 Reading Timers, Counters, and Comparators... 17 Reading Work Bits and HR Bits... 20 Write Variable Area ... 21 Writing Timer and Counter Set Values ... 22 Writing Work Bits and HR Bits... 26 Read Controller Attributes ... 26 Read Controller Status ... 27 Read Time Data ... 28 Write Time Data... 29 Echoback Test... 31 Operation Command ... 32 2.4 Response Code List ... 34

SECTION 2 CompoWay/F Communications Protocol

2.1 Data Format

For CompoWay/F, numeric values for commands are converted to ASCII and expressed as hexadecimal values.

• Numbers prefixed with H’ are hexadecimal, e.g., H’02 is 02 hexadecimal.

• The numbers below the various parts of a frame specify the number of bytes.

• Unless specified, all other numbers are ASCII characters. (Refer to the Appendix for a table of ASCII characters.)

Command Frame

SID BCC

STX 0 0 0 ETX

1 2 2 1 1 1

Text

Node number Sub-address FINS-mini command text

BCC calculation range

STX This code (H’02) indicates the beginning of the communications frame (text).

Always set STX in the first byte.

When STX is received again during reception, reception is carried out again from the point where STX was received.

Node number • This number specifies the transmission destination.

• Specify the ZEN’s node number.

• A BCD value between 00 and 99 or an ASCII value of XX can be set.

• Specify “XX” for a broadcast transmission. No responses will be returned for broadcast transmissions.

• No responses will be returned from node numbers other than the ones in the above range.

• The default setting is 01.

Sub-address The sub-address is not used in the ZEN. It must be fixed at “00.”

SID • Service ID. The service ID is not used in the ZEN.

• Be sure to set it to “00.”

Command text This is the command text area. For details, see 2.2 Structure of Command Text.

ETX This code (H’03) indicates the end of the text.

BCC • This is the Block Check Character.

• The BCC result is found by calculating the exclusive OR of the bytes from the node num-ber up to ETX.

2.1 Data Format

BCC Calculation Example

The BCC (Block Check Character) is determined by calculating the exclusive OR of the bytes from the node number up to ETX. The 8-bit result is written to the BCC byte at the end of the frame.

Response Frame

End Codes

Normal Completion

Error Occurred

STX SID ETX BCC

H'02 0 (H'30) 0 (H'30) 0 (H'30) 0 (H'30) 0 (H'30) 0 (H'30) 5 (H'35) 0 (H'30) 3 (H'33) H'03 H'35

BCC = H'30+H'30+H'30+H'30+H'30+H'30+H'35+H'30+H'33+H'03 = H'35 Node number Sub-address Command text

The result of the calculation (35 hex) is written to the BCC byte.

The + symbols indicate XOR (exclusive OR) operations.

BCC

STX ETX

1 2 2 2 1 1

Node number Sub-address End code Command text

End

code Name Description Error detection

priority

00 Normal completion The command ended normally without error. None

End

code Name Description Error detection

priority 0F FINS command error The specified FINS command could not be executed.

The FINS response code should indicate why the command could not be executed.

8

10 Parity error The sum total of bits whose received data is 1 does not match the set value of the “communications parity” bit.

2

11 Framing error Stop bit is 0. 1

12 Overrun error New data was transferred when the reception data buffer was already full.

3

13 BCC error The calculated BCC value is different from the received BCC value.

5

14 Format error • The command text contains characters other than 0 to 9, and A to F.

Note: This error does not apply to Echoback Tests. Refer to Echoback Test on page 31 for details.

• There was no SID and command text. There was no com-mand text.

• “MRC/SRC” not included in command text.

7

16 Sub-address error • Illegal (unsupported) sub-address

• There was no sub-address, SID, and command text.

• Sub-address was less than two characters, and there was no SID and command text.

6

SECTION 2 CompoWay/F Communications Protocol

• An end code is returned for each command frame received that was addressed to the local node.

• No response will be returned unless the frame contained all elements up to the ETX and BCC.

• The Error detection priority is the priority when two or more errors occur simultaneously.

Communications Data

Note: Refer to Read Time Data on page 28 and Write Time Data on page 29 for information on time data.

End Code Examples

The following examples describe end codes when an error is detected in the command.

Example 1 Illegal Sub-address, No SID, and No Command Text Command

Response

The end code returned in the response is 16 (sub-address error). The end code 16 is returned in the response when the sub-address error has a higher error detection priority than the format error.

Example 2 No Command Text Command

Response

End code 14 (format error) is returned in the response when there is no command text.

18 Frame length error The received frame exceeds the specified (supported) num-ber of bytes.

2’s complement Decimal point is removed and the result is converted to hexadecimal.

Example conversion: 105.0 → 1050 → H’0000041A End

code Name Description Error detection

priority

BCC

STX 0 A ETX

Node number Sub-address

BCC

STX 0 A 1 6 ETX

Node number Sub-address End code

SID BCC

STX 0 0 0 ETX

Node number Sub-address

BCC

STX 0 0 1 4 ETX

Node number Sub-address End code

2.1 Data Format

Example 3 No Node Number Provided Command

The node number is missing one character.

Response

No response is made.

Example 4 No Sub-address and Illegal BCC Command

Response

The sub-address is taken as 00 and end code 13 (BCC error) is returned in the response.

BCC

STX ETX

BCC

STX ETX Err

Node number

BCC

STX 0 0 1 3 ETX

Node number Sub-address End code

SECTION 2 CompoWay/F Communications Protocol

2.2 Structure of Command Text

PDU Structure

• An MRC (Main Request Code) and SRC (Sub-Request Code) followed by the various required data are transferred in the command text.

Service Request PDU

• The MRES (Main Response Code), SRES (Sub-Response Code), followed by the data are transferred following the above MRC/SRC in the response frame.

Service Response PDU (Normal Response)

• If the specified command text could not be executed, the service response PDU will contain only the MRC/SRC and MRES/SRES.

Note: MRES/SRES provides the response code. MRES/SRES is not output when processing ends in a normal completion.

Service Response PDU (Command Text Not Executed)

Addresses

An address is appended to each of the variable types. Express addresses in 2-byte hexadecimal and append them for the specified access size.

Number of Elements

Specify the number of elements as “0001” (fixed). The number of elements is expressed in 2-byte hexadecimal.

MRC SRC Data

MRES SRES

MRC SRC Data

MRES SRES MRC SRC

2.2 Structure of Command Text

List of Services

Note: No commands will be accepted and no responses will be returned when a memory error has occurred or the Controller is initializing (until normal operation begins after the power is turned ON).

MRC SRC Name of service Processing

01 01 Read Variable Area This service reads from variable areas.

01 02 Write Variable Area This service writes to variable areas.

05 03 Read Controller Attributes This service reads the model number and communi-cations buffer size.

06 01 Read Controller Status This service reads the operating status.

07 01 Read Time Data This service reads ZEN time data.

07 02 Write Time Data This service sets ZEN time data.

08 01 Echoback Test This service performs an echoback test.

30 05 Operation Command This service switches between RUN and STOP.

SECTION 2 CompoWay/F Communications Protocol

2.3 Detailed Description of the Services

Read Variable Area

This service reads data from a variable area.

Service Request PDU

Service Request PDU

Note: The read data 12 indicates the weekly timer.

Variable Type and Read Start Address

For details on variable types and read start addresses, refer to 3.1 Variable Area (Data Range) List.

Variables of type C0 are read-only.

Bit Position

Bits positions are always 00 except for work bits and HR bits. With the ZEN, bit access supported only for work bits and HR bits.

For details on bits and applications methods, refer to 1-4 Memory Areas in the ZEN Programmable Relay Operation Manual (Cat. No. Z211).

Note: Refer to Reading Work Bits and HR Bits on page 20 for details on reading work bits and HR bits.

Number of Elements

Always 0001.

position Number of elements

Read data (for number of elements) 8 or 12 (See note.)

Response

code Name Description

0000 Normal completion No errors were found.

Response

code Error name Cause

1001 Command too long The command is too long.

1002 Command too short The command is too short.

2.3 Detailed Description of the Services

Reading Timers, Counters, and Comparators

Reading Timer Types and Time Units

Timer types and time units can be read. For timers other than twin timers (normal timer operation), the data is set in the rightmost four bytes. For twin timers, the data is set in the rightmost and leftmost two bytes.

Example 1: Twin Timer

Example 2: Other Timers

1101 Area type error The variable type is wrong.

110B Response too long The number of elements is greater than 0001.

1100 Parameter error • Bit position is not 00.

• The bit address is out of range.

2203 Operation error Unit error (memory error occurred, or unused command was sent.) Response

code Error name Cause

0 0 4 1 0 0 0 2

Command

Response

OFF time unit (example: 2 = H:M) ON time unit (example: 1 = M:S)

Timer type (example: 4 = twin timer) [STX]000000101C00001000001

[STX]000000101000000410002

Command Response

0 0 1 1 0 0 0 0

ON time unit (example: 1 = H:M)

Timer type (example: 1 = OFF delay timer) [STX]000000101C00001000001

[STX]000000101000000110000

SECTION 2 CompoWay/F Communications Protocol

• Timer and Counter Number Specifications

There is more than one timer and more than one counter, and so the leftmost two digits of the address are used to specify the applicable timer or counter. The timer and counter numbers and corresponding addresses are given in the following table.

Reading Comparators

RS-485 communications can be used to read the variable area and perform comparisons with the following three types of comparators.

1. Analog Comparators: Compare an analog input with a constant or two analog inputs.

2. Comparators: Compare the present value of a timer, holding timer, or counter with a constant or the present values of timers, holding timers, or counters.

3. Eight-digit comparators: Compare the present value of an 8-digit comparator with a constant.

Note: Refer to 3-10 Analog Inputs (Analog Comparators (A)), 3-11 Comparing Timer/Counter Present Values Using Comparators (P), and 3-12 Comparing the 8-Digit Counter (F) Present Value Using 8-Digit Comparators (G) in the ZEN Programmable Relay Operation Manual (Cat. No. Z211) for details on comparators.

• Comparator Number Specifications

There is more one of some types of comparators and more than one analog input, and so the leftmost two digits of the address are used to specify the applicable timer or counter. The comparator and analog input numbers and corresponding addresses are given in the following table.

Contents Type/number Variable

type Addresses

Timer PV T0 to Tf (16 timers) C0 0000 to 0F00

Timer type and time unit C0 0001 to 0F01

Timer SV C1 0000 to 0F00

Holding timer PV #0 to #7 (8 timers) C0 0003 to 0703

Holding timer type and time unit C0 0004 to 0704

Holding timer SV C2 0000 to 0700

Weekly timer operation mode @0 to @f (16 timers) C0 000B to 0F0B

Weekly timer SV C5 0000 to 0F00

Calendar timer SV *0 to *f (16 timers) C6 0000 to 0F00

Counter PV C0 to Cf (16 counters) C0 0006 to 0F06

Counter SV C3 0000 to 0F00

Contents Type/number Variable

type Addresses

Analog input PV I4 and I5 C0 I4: 000D

I5: 010D

2.3 Detailed Description of the Services

Note: There is only one 8-digit counter (F). Use address 0008 for the PV and address 0009 for the counting speed.

• Comparator Data Formats

1. Comparison Operators for Analog Comparators

The comparison pattern and operator in the variable area can be specified when reading.

2. Comparison Operators for Comparators

The comparison data and operation in the variable area can be specified when reading.

Analog comparator constant A0 to A3 C7 0000 to 0300

Analog comparator operator C0 000E to 030E

Comparator operator P0 to Pf C0 000E to 0F0E

Comparator PV C8 0000 to 0F00

8-digit comparator operator G0 to G3 C0 0012 to 0312

8-digit comparator constant C9 0000 to 0300

Contents Type/number Variable

type Addresses Comparison data 1 ≤ Comparison data 2.) 1: ≥ (Analog comparator bit turns ON when

Comparison data 1 ≥ Comparison data 2.)

Comparison Pattern

0000 (H'0): Compare PV of I4 (Ia: analog input 1) with PV of I5 (Ib: analog input 2)

0001 (H'1): Compare I4 (Ia: analog input 1) with SV (constant) 0001 (H'1): Compare I5 (Ib: analog input 2) with SV (constant)

0 0 0 0 0 0 Comparison Data 2

0: Timer (T), holding timer (#), or counter (C) PV 1: SV (constant)

Read data

Comparison Operator

0: ≤ (Comparator bit turns ON when Comparison data 1 ≤ Comparison data 2.) 1: ≥ (Comparator bit turns ON when

Comparison data 1 ≥ Comparison data 2.)

SECTION 2 CompoWay/F Communications Protocol

3. Comparison Operators for 8-Digit Comparator

The comparison data and operation in the variable area can be specified when reading.

Reading Work Bits and HR Bits

Bit positions are specified when reading Work Bits or HR Bits (0 or 1).

Example Command

Response

0 0 0 0 0 0 8

7 6 5 4 3 2 1 0 0 0 0

Comparison Data 1 000 (H'0): 8-digit counter (F) PV Comparison Data 2 1: SV (constant) Note: Always 1.

Read data

Comparison Operator

0: ≤ (Comparator bit turns ON when 8-digit counter PV ≤ Comparison data 2.) 1: ≥ (Comparator bit turns ON when

8-digit counter PV ≥ Comparison data 2.)

[STX]000000101CA000002001 The bit position is specified when reading. In this example, the bit 02 is specified when reading the status of Work Bit M2.

[STX]00000010100000000001 The response says that the specified Work Bit is ON (1).

2.3 Detailed Description of the Services

Write Variable Area

This service writes data to a variable area.

Service Request PDU

Note: The write data 12 indicates the weekly timer.

Service Response PDU

Variable Type and Write Start Address

For details on variable types and write start addresses, see 3.1 Variable

For details on variable types and write start addresses, see 3.1 Variable

相關文件