文档库 最新最全的文档下载
当前位置:文档库 › SR90_通讯协议

SR90_通讯协议

SR90 Series

Digital Controller

COMMUNICATION INTERFACE

(RS-232C/RS-485)

INSTRUCTION MANUAL

Thank you for purchasing the Shimaden SR90 series controller. Please check that the delivered

product is the correct item you ordered. Please do not begin operating this product until you have

read this instruction manual thoroughly and you understand its contents.

Notice

Please ensure that this instruction manual is given to the final user of the instrument.

Preface

This instruction manual describes the communication interface (RS-232C/RS-485) which is an optional function of the SR90 series (SR91, SR92, SR93 and SR94). For details of SR90 product’s overview, performance, parameters, how to install, wiring, operation, and so on, please refer to the separate document "SR90 Series (SR91, SR92, SR93,

SR94) Digital Controller Instruction Manual".

SR90C-1BE

Feb. 2006

Contents

5-4. Details of Write command (W) (14)

Notice (1)

(1) Format of Write command (W) (15)

(2) Format of normal response to Write command (W) (15)

Preface........................................................................1(3) Format of error response to Write command (W).. (16)

5-5. Details of response codes (16)

1. Safety rules (3)

(1) Type of response codes (16)

(2) Order of priority of response codes (16)

2. Outline (4)

6. Outline of MODBUS protocol (17)

2-1. Communication interface (4)

6-1. Outline of transfer mode (17)

2-2. Communication protocol and specifications (4)

(1) ASCII mode (17)

(2) RTU mode (17)

3. Connecting controller with host computer (6)

6-2. Configuration of messages (17)

3-1. RS-232C (6)

(1) ASCII mode (17)

(2) RTU mode (17)

3-2. RS-485 (6)

6-3. Slave address (17)

3-3. 3-state output control (6)

6-4. Function codes (17)

4. Setting of parameters...........................................76-5. Data. (18)

6-6. Error check (18)

4-1. Setting of communication mode (7)

(1) ASCII mode (18)

4-2. Setting of communication protocol.............................7(2) RTU mode.. (18)

4-3. Setting of communication address.............................76-7. Examples of messages.. (18)

(1) ASCII mode (18)

4-4. Setting of communication data format (7)

(2) RTU mode (19)

4-5. Setting of start character (8)

7. Communication data address (20)

4-6. Setting of communication BCC (8)

7-1. Details of communication data addresses (20)

4-7. Setting of communication rate (8)

(1) Data address and read/write (20)

(2) Data address and the number of data (20)

4-8. Setting of delay time (8)

(3) Data (20)

4-9. Setting of memory mode............................................8(4) Read/Write of data. (20)

(5) Option-related parameters (20)

5. Outline of Shimaden protocol (9)

(6) Parameters not displayed on the front panel (20)

7-2. Communication data address (21)

5-1. Communication procedure (9)

8. Supplementary explanation (23)

(1) Master/slave relation (9)

(2) Communication procedure (9)

(3) Time-out...............................................................................98-1. Table of measuring range codes (23)

5-2. Communication format...............................................98-2. Table of event types. (24)

(1) Outline of communication format (9)

8-3. ASCII code list (24)

(2) Details of basic format section I (10)

(3) Details of basic format section II (10)

(4) Outline of text section (11)

5-3. Details of Read command (R) (13)

(1) Format of Read command (R) (13)

(2) Format of normal response to Read command (R) (13)

(3) Format of error response to Read command (R) (14)

1. Safety rules

For matters regarding safety, potential damage to equipment and/or facilities, additional instructions and notes are indicated by the following headings.

: This heading indicates hazardous conditions that could cause injury or death of personnel unless

: This heading indicates hazardous conditions that could cause damage to equipment and/or facilities unless extreme caution is exercised.

WARNING

The SR90 Series Digital Controller is designed for controlling

temperature, humidity and other physical quantities in general industrial

facilities. It must not be used in any way that may adversely affect the

safety, health or working conditions of those who come into contact with

the effects of its use. When used, adequate and effective safety

countermeasures must be provided at all times by the user. No warranty,

express or implied, is valid when this device is used without the proper

safety countermeasures.

●When using this instrument, house it in a control box or the like to

prevent terminals from coming into contact with personnel.

●Do not open this device’s case, or touch the boards or the inside of the

case with your hands or a conductor.

The user should never repair or modify this device.

Doing so might cause an accident that may result in death or serious

bodily injury from electric shock.

CAUTION

To avoid damage to connected peripheral devices, facilities or the product

itself due to malfunction of this device, safety countermeasures such as

proper installation of the fuse or installation of overheating protection

must be taken before use. No warranty, express or implied, is valid if

usage results in an accident when the user has not taken the proper

safety countermeasures.

Please operate this product safely after referring to and understanding

the safety rules described in the separate Instruction Manual.

2. Outline

2-1. Communication interface

There are two types of communication systems, RS-232C and RS-485, employable in the SR90 series communication interface (however, only RS-485 applies to SR91). Each of them is capable of setting various data for the SR90 and reading through a personal computer or the like, using signals that comply with EIA standards.

RS-232C and RS-485 are data communication standards established by the Electronic Industries Association of the U.S. (EIA). The standards cover electrical and mechanical aspects, namely, matters related to applicable hardware but not the data transmission procedure for the software. Therefore, it is not possible to communicate unconditionally with an apparatus that has the same interface.

Hence, users need to have sufficient knowledge of product specifications and transmission procedures.

When RS-485 is used, two or more SR90 controllers can be connected to each other. There seems only a few

computers, etc., that support this interface. Use a separately-purchased off-the-shelf line converter for RS-232C <---> RS-485 to support that interface.

2-2. Communication protocol and specifications

The SR90 Series supports the SHIMADEN standard protocol and MODBUS communication protocol.

Common to each protocol

Signal level EIA RS-232C, RS-485 compliant

Communication system RS-232C 3-line half-duplex system

RS-485 2-line half-duplex multi-drop (bus) system

Synchronization system Start-stop synchronization

Communication distance RS-232C max. 15m

RS-485 max. 500 m (depending on connection conditions)

Communication speed 1200, 2400, 4800, 9600, 19200 bps

Transmission procedure Non-procedural

Communication delay time 1 to 100 x 0.512 msec

Number of connectable devices RS-232C 1

(depending on connection conditions)

RS-485 max.

31

Communication address 1 to 255

Communication memory mode EEP, RAM, R_E

Shimaden protocol

This is a SHIMADEN proprietary communication protocol. The table below lists the specifications of this protocol.

Data format Data length: 7 bits, Parity: Even, Stop bit: 1 bit

Data length Data length: 7 bits, Parity: Even, Stop bit: 2 bits

Parity Data length: 7 bits, Parity: None, Stop bit: 1 bit

Stop bit Data length: 7 bits, Parity: None, Stop bit: 2 bits

Data length: 8 bits, Parity: Even, Stop bit: 1 bit

Data length: 8 bits, Parity: Even, Stop bit: 2 bits

Data length: 8 bits, Parity: None, Stop bit: 1 bit

Data length: 8 bits, Parity: None, Stop bit: 2 bits

Communication code ASCII code

Control code STX_ETX_CR, @_:_CR

Communication BCC ADD, ADD_two’s cmp, XOR, None

MODBUS protocol

This is a communication protocol developed for PLCs by Modicon Inc. (AEG Schneider Automation International S.A.S.)

Though the specifications of this protocol are open, only the communication protocol is defined in this protocol, and physical layers, such as the communication medium, are not stipulated.

The table below shows the specifications of this protocol.

- ASCII mode

Data format

Data length

Parity

Stop bit Data length: 7 bits, Parity: Even, Stop bit: 1 bit Data length: 7 bits, Parity: Even, Stop bit: 2 bits Data length: 7 bits, Parity: None, Stop bit: 1 bit Data length: 7 bits, Parity: None, Stop bit: 2 bits

Communication code ASCII code Control code :_CRLF

Error check LRC

- RTU mode

Data format

Data length

Parity

Stop bit Data length: 8 bits, Parity: Even, Stop bit: 1 bit Data length: 8 bits, Parity: Even, Stop bit: 2 bits Data length: 8 bits, Parity: None, Stop bit: 1 bit Data length: 8 bits, Parity: None, Stop bit: 2 bits

Communication code Binary data Control code None Error check CRC

3. Connecting controller with host computer

The SR90 series controller is only provided with 3 lines for input and output, i.e., for data transmission, data reception and grounding for signals, and not with any other signal lines.

In these instructions, the drawings give an example of control signal processing methods. Please refer to the documents that came with your host computer for further details.

3-1. RS-232C

Host (25 pins)

Host (9 pins)

SR90 series [PC/AT compatible ] SR90 series FG Controller SD ( 2) RD ? data reception RD ( 3) SD ? data transmission SG ( 7) SG ? grounding for signals RS ( 4) CS ( 5) SR90 series terminal no. DR ( 6) SR92 SR93 SR94 SG [ 1] [ 1] [ 1] SD [ 2] [ 2] [ 2]*1: Figures in ( ) represent pin numbers of connector. RD [ 3] [ 3] [ 3]

3-2. RS-485

The input/output logical level of the SR90 controller is basically as follows: In the mark state - terminal < + terminal In the space state - terminal > + terminal

Until immediately before transmission, however, plus terminals and minus terminals of the controller have high

impedance and outputs at the above levels are produced immediately before starting transmission. (See 3-3. 3-state output control.)

3-3. 3-state output control

Since RS-485 is of the multi-drop system, transmission output has high impedance always while communication is not carried out or signals are being received in order to avoid collision between transmission signals. It changes from high impedance to the normal output condition immediately before transmission and returns to high impedance control simultaneously when transmission

terminates. As the 3-state control is delayed by about 1 msec (maximum) from the completion of transmission of an end character end bit, however, a few milliseconds' delay should be provided if the host side starts transmission immediately upon reception.

END CHARACTER END CHARACTER 1 Transmitted signal High impedance High impedance

end bit start bit end bit

Host

SR90 series

Note1: In the case of RS-485, provide it with the attached

terminal resistor of 1/2W, 120? across terminals + and if necessary.

Nevertheless, it should be provided to only the last controller.

If two or more controllers are provided with terminal resistors, correct operation cannot be guaranteed.

SR90 series terminal no.

SR91 SR92 SR93SR94 SG [ 1] [ 1] [ 1] [ 1] + [11] [ 2] [ 2] [ 2]

- [12] [ 3] [ 3] [ 3]

4. Setting of parameters

There are the following 9 communication-related parameters for the SR90 series controller. These parameters are unable to be set or changed by communication; use front key for setting and changing.

When parameters are set, see "6. Explanation of Screen Group and Setting" of the separate instruction manual for the controller and follow the described steps.

4-1. Setting of communication mode

1-36

Initial value:

Loc

Setting range:Loc, Com

Select communication mode. Front key operation allows only change from Com to Loc, though.

Code Effective command

COM lamp

Loc Read Unlighted Com Read, write

Lighted

4-2. Setting of communication protocol

1-37

Initial value:

shim

Setting range:shim, asc, rtu

Select communication protocol.

Code Protocol

shim Shimaden protocol

asc MODBUS ASCII mode rtu

MODBUS RTU mode

4-3. Setting of communication address

1-38

Initial value: 1 Setting range:

1 to 255

Select communication protocol.

While one host and one SR90 controller can be connected in the case of RS-232C, one host and 31 SR90 controllers (max.) can be connected in case of RS-485 by the multi-drop system.

Therefore, each instrument is assigned an address (machine No.) so that only the instrument with the designated address can answer.

Note 1: Although 1 to 255 addresses are available for setting, the number of connectable controllers is

31 maximum.

4-4. Setting of communication data format

1-39

Initial value: 7E1

Setting range:

8 types shown in the following table.

Select either one of the communication data formats shown below

Support Not Support

Data length Parity Stop bit Shimaden ASCII RTU 7 bits Even 1 bit 7 bits Even 2 bits None 1 bit 7 bits 7 bits None 2 bits 8 bits Even 1 bit 8 bits Even 2 bits None 1 bit 8 bits 8 bits

None

2 bits

Code

4-5. Setting of start character

1-40

Initial value: STX

Setting range:STX, ATT

Select a control code to be used. This is used for Shimaden protocol only.

Code Start character Text end character End character

STX STX (02H) ETX (03H) CR (0DH)

ATT "@" (40H) ":" (3AH) CR (0DH)

4-6. Setting of communication BCC

1-41

Initial value: 1

Setting range:1, 2, 3, 4

Select a BCC operation method to be used in BCC checking. This is used for Shimaden protocol only.

Code BCC

method

operation

1 Addition

2 Addition + 2's complement

3 XOR

4 None

4-7. Setting of communication rate

1-42

Initial value: 1200 bps

Setting range:1200, 2400, 4800, 9600, 19200 bps

Select a rate at which data are transmitted to host computer.

4-8. Setting of delay time

1-43

Initial value: 20

Setting range: 1 to 100

Set the length of delay time from receipt of a communication command to transmission.

Delay time (msec) = Set value (count) × 0.512 (msec)

Note 1:When RS-485 is used, some converters take longer time for 3-state control than others and it may lead to signal collision. This can be avoided by increasing delay time. Care should be taken

particularly when the communication rate is slow (1200bps or 2400bps).

Note 2: Actual delay time from receipt of a communication command to transmission is a total of the above-mentioned delay time and command processing time by software. Particularly for writing

commands, about 400 msecs maybe taken for processing.

4-9. Setting of memory mode

1-44

Initial value: EEP

Setting range:EEP, Ram, r_E

Since the volatile memory EEPROM used in SR90 series has its limits in number of writing cycles, the life of

EEPROM is shortened if SV data or the like are rewritten frequently by communication. To prevent this, in case

data are to be rewritten frequently by communication, set the RAM mode in which only RAM data are rewritten

without rewriting EEPROM, thereby maintaining the life of EEPROM as long as possible.

Code Description

EEP In this mode EEPROM data are also rewritten every time data are changed by communication.

Accordingly, data are maintained when power is turned off.

Ram In this mode only RAM data are rewritten but EEPROM data are not when data are changed by

communication. Therefore, RAM data are deleted when power is turned off. Upon applying power

again, operation starts with data stored in EEPROM.

r_E SV and OUT data are written in RAM. All other data are written in EEPROM.

5. Outline of Shimaden protocol

SR90 series support the Shimaden standard serial communication protocol.

This enables you to acquire and/or change data from instruments, which employ the Shimaden protocol, by using the same format.

5-1. Communication procedure

(1) Master/slave relation

? The master devices mean personal computer or PLC (host).

? The subordinate (slave) devices mean the SR90 series controller.

? A communication command from the master device starts communication and a response from the subordinate side terminates it.

If abnormality such as a communication format error or a BCC error occurs, there will be no response.

No response is sent, either, to broadcast instruction.

(2) Communication procedure

Communication goes on by transferring the transmission right to each other in the pattern that the subordinate device responds to the master device.

(3) Time-out

In case receipt of the end character does not complete within one second after receiving the start character, the controller figures it out as time-out and the controller automatically transits into waiting state for another command (a new start character).

Accordingly, the host device should set one second minimum as the time-out duration.

5-2. Communication format

The SR90 Series allows for a variety of communication formats (control code and BCC operating method) and communication data formats (data bit length, parity/non-parity, and stop bit length) for easy compliance with other protocols.

However, the following settings are recommended as basic examples for your convenience:

(1) Outline of communication format

The communication command formats sent from the master device or the communication response formats sent from the subordinate device consist of three blocks: basic format section I, text section and basic format section II.

Basic format sections I and II are common to the Read command (R), Write command (W) and during communication responses. Note, however, that the operation results each time are included in the BCC field ("i", (13) and (14)). The text section differs according to such factors as the command type, data address and communication response.

Communication command format

Basic format section I Text section Basic format section II

Response format

Basic format section I Text section Basic format section II

(2) Details of basic format section I

a: Start character [(1): 1 digit / STX (02H) or "@" (40H)]

? The start character indicates the start of the communication message.

? When the start character is received, it is judged to be the 1st character of a new communication message.

? Select a start character and a text end character as a pair.

STX (02H)··············Select by ETX (03H)

"@" (40H)··············Select by ": " (3AH)

b: Device address [(2), (3): 2 digits]

? Specify the device to communicate with.

? Specify the address within the range from 1 to 255 (decimal).

? Binary 8-bit data (1: 0000 0001 to 255: 1111 1111) is divided into upper 4 bits and lower 4 bits, and converted to ASCII data.

(2): Data obtained by converting the upper 4 bits to ASCII

(3): Data obtained by converting the lower 4 bits to ASCII

? Device address 0 (30H, 30H) cannot be used as the device address as it is used when the broadcast command is issued. As SR90 series controller doesn’t support broad cast command, address 0 has no response.

c: Subaddress [(4): 1 digit]

? As the SR90 series are single loop controllers, their sub-address is fixed to 1 (31H).

If any other address is specified for a sub-address, there will be no response by sub-address error.

(3) Details of basic format section II

h: Text end character [(12): 1 digit / ETX (03H) ] or ":" (3AH) ]

? Indicates that the text section terminates right before this character.

i: BCC data [(13), (14): 2 digits]

? The BCC (Block Check Character) data is for checking if there is an error in the communication data.

? When BCC operation results in a BCC error, there will be no response.

? There are four types of BCC operation as shown below. These can be set on the front panel screen.

(1) ADD

Addition operation is performed from start character (1) through to text end character (12) in ASCII data single

characters (1-byte).

(2) ADD_two's cmp

Addition operation is performed from start character (1) through to text end character (12) in ASCII data 1-

character (1-byte) units, and the two’s complement of the lower 1 byte of the operation result is taken.

(3) XOR

Exclusive OR is performed from after the start character (device address (2)) through to text end character

(12) in ASCII data 1-character (1-byte) units.

(4) None

BCC operation is not performed. ((13) and (14) are omitted.)

? BCC data is operated in 1-byte (8-bit) units regardless of the data bit length (7 or 8).

? The lower 1-byte data of the result of the above operation is divided into upper 4 bits and lower 4 bits, and converted to ASCII data.

(13): Data obtained by converting the upper 4 bits to ASCII

(14): Data obtained by converting the lower 4 bits to ASCII

Example 1: Read command (R) at BCC i Add setting

Lower 1 byte of add result (1DAH) = DAH Example 2: Read command (R) at BCC i Add_two's cmp setting

Lower 1 byte of add result (1DAH) = DAH

Two's complement of lower 1 byte (DAH) = 26H Example 3: Read command (R) at BCC i XOR setting

Note that = XOR (exclusive OR)

Lower 1 byte of operation result (50H) = 50H (13): "5" = 35H, (14): "0" = 30H

(1)STX (2)0(3)1(4)1(5)R (6)0

(7)1(8)0(9)0(10)0(12)ETX (13)5(14)0(15)

CR

30H

31H

31H

52H

30H 31H 30H

30H 30H

03H = 50H

(1)STX (2)0(3)1(4)1(5)R (6)0

(7)1(8)0(9)0(10)0(12)ETX (13)D (14)A (15)

CR

02H+30H+31H +31H +52H +30H +31H+30H+30H+30H +03H =1DAH

(1)STX (2)0(3)1(4)1(5)R (6)

(7)1(8)0(9)0(10)0(12)ETX (13)2(14)6(15)

CR

02H+30H+31H +31H +52H +30H +31H+30H+30H+30H +03H =1DAH

(13): "2" = 32H, (14): "6" = 36H

(13): "D" = 44H, (14): "A" = 41H

j: End character (delimiter) [(15): 1 digit / CR]

? Indicates that the end of the communication message.

Note

A response is not performed when errors such as those below are recognized in the basic format section:

? A hardware error has occurred.

? The device address and sub-address differ from the address of the specified device. ? The character specified by the previous communication format is not at the specified position.

? The BCC operation result differs from the BCC data.

Data are converted from binary data to ASCII data in 4-bit blocks.

Hex to are expressed in uppercase characters and are converted to ASCII data.

(4) Outline of text section

The text section differs according to the command type and communication response. For details, see "5-3 Details of Read command (R)" and "5-4 Details of Write command (W)".

d: Command type [(5): 1 digit]

?

"R" (52H / uppercase character):

Indicates a Read command or a Read command response.

This is used to read (load) various SR90 data from a master personal computer or PLC.

?

"W" (57H / uppercase character):

Indicates a Write command or a Write command response.

This is used to write (change) various SR90 data from a master personal computer or PLC.

? "B" (42H / uppercase character): Indicates a broadcast command.

As SR90 doesn’t support broadcast command, this command is unable to be used. ? No response is made when a character other than "R" or "W" is recognized.

e: Start data address [(6), (7), (8), (9): 4 digits]

? Specifies the read start data address of the Read command (R) or the write start data address of the Write (W) command.

? The start data address is specified by binary 16-bit (1 word / 0 to 65535) data. ? The 16-bit data is divided into 4-bit blocks and then converted to ASCII data.

Binary (16 bits)Hex "0"ASCII data

(6)

D15,D14,D13,D12D11,D10,D9,D8D7, D6, D5, D4D3, D2, D1, D00 0 0 0

0 0 0 1

1 0 0 0

1 1 0 0

0H 1H 8H C H "1""8""C"30H 31H 38H 43H (7)

(8)

(9)

? For details on data addresses, see "7-2 Communication data addresses".

f: Number of data [(10): 1 digit]

?

Specifies the number of read data in the Read command (R) or the number of write data in the Write command (W).

? The number of data is specified by converting binary 4-bit data to ASCII data.

? With the Read command (R), the number of data can be specified within the range 1: "0" (30H) to 10: "9" (39H).

However, note that SR90 can read 8 data ("7" (37H) ) maximally.

? With the Write command (W), the number of data is fixed at 1: "0" (30H).

? The actual number of data is "number of data = specified data numerical value + 1".

g: Data [(11): Number of digits determined by number of data]

? Specifies the number of write data (change data) of the Write command (W) or read data during a Read command (R) response.

? The following shows the data format:

g (11)

1st data

","2CH

2nd data

nth data

U p p e r 1s t d i g i t

2n d d i g i t

3r d d i g i t

L o w e r 4t h d i g i t

U p p e r 1s t d i g i t

2n d d i g i t

3r d d i g i t

L o w e r 4t h d i g i t

U p p e r 1s t d i g i t

2n d d i g i t

3r d d i g i t

L o w e r 4t h d i g i t

? The data is always prefixed by a comma ("," 2CH) to indicate that what follows the comma is the data. Delimiters between data are not inserted.

? The number of data follows the number of data (f: (10)) in the communication command format.

?

Each data is expressed in binary 16-bit (1 word) units without a decimal point. The position of the decimal point is determined by each data.

? 16-bit data is divided into 4-bit blocks, and each block is converted to ASCII data.

? For details of data, see "5-3 Details of Read command (R)" and "5-4 Details of Write command (W)".

e: Response code [(6), (7): 2 digits]

?

Specifies the response code for the Read command (R) and Write command (W).

Binary 8-bit data (0 to 255) is divided into upper 4 bits and lower 4 bits, and each is converted to ASCII data. (6): Data obtained by converting upper 4 bits to ASCII (7): Data obtained by converting lower 4 bits to ASCII

?

In the case of a normal response, "0" (30H) and "0" (30H) are specified.

In the case of an error response, the error code No. is specified after conversion to ASCII data. For details on response codes, see "5-5 Details of response codes".

5-3. Details of Read command (R)

The Read command (R) is used to read (load) various SR90 data from a master personal computer or PLC.

(1) Format of Read command (R)

?

The following shows the format of the text section of the Read command (R).

Basic format section I and basic format section II are common to all commands and command responses.

Text section

d (5)

R 52H (6)

(7)

(8)

(9)

(10)

030H 434H 030H 030H 434H

e f ? d ((5)) : "R" (52H) indicates that this data is a Read command.

It is fixed to "R" (52H).

? e ((6) to (7)) : The start data address of the data to read. ?

f ((10)) : The number of data (words) to read.

?

The above command is as follows:

Read start data address = 0400H (Hex) = 0000 0100 0000 0000 (Binary) Number of read data = 4H (Hex) = 0100 (Binary) = 4 (Decimal)(actual number of data) = 5 (4 + 1)

In other words, in this example, reading of 5 sequential data from data address 0400H is specified.

(2) Format of normal response to Read command (R)

?

The following shows the format (text section) of a normal response to the Read command (R).

Basic format section I and basic format section II are common to all commands and command responses.

Text section

d (5)

1st data

R

52H e g 2nd data

5th data (6)

(7)

(11)

030H 030H ,2CH

030H 030H 131H E 45H 030H 030H 737H

838H

030H

030H 030H 333H

? d ((5)) : "R" (52H) is inserted to indicate that this data is a Read command response. ? e ((6) to (7)) : "0 0" (30H and 30H) is inserted to indicate that this is a normal response. ?

g ((11)) : The actual response data to the Read command is inserted.

1. "," (2CH) is added to indicate the actual data start.

2. Actual data is inserted sequentially in order from to the number of .

3. Nothing is inserted between each data items.

4. Each data consists of binary 16-bit (1 word) data without a decimal point, and is converted to ASCII data in 4-bit blocks before it is inserted.

5. The position of the decimal point is determined by each data.

6. The number of characters of the response data is: "number of characters = 1 + 4 x number of read data".

? In actual terms, the following data is returned in order as the response data to the Read command (R).

Read start

data address

(0400H)

Number of read data

(4H: 5 data)

(3) Format of error response to Read command (R)

? The following shows the format (text section) of an error response to the Read command (R).

Basic format section I and basic format section II are common to all commands and command responses.

Text section

d (5)

R 52H

e (6)(7)

30H

7

37H

? d ((5)) : "R" (52H) is inserted to indicate that this data is a Read command response.

? e ((6) to (7)) : Any response code is inserted to indicate that this is an error response.

? Response data is not inserted in the case of an error response.

? For details on error codes, see "5-5 Details of response codes".

5-4. Details of Write command (W)

The Write command (W) is used to write (change) various data on SR90 from a master personal computer or a PLC.

Caution

To use the Write command, the communication mode must be changed from LOC to COM.

The communication mode cannot be changed using the keys on the front panel.

To change the communication mode, send the following command from the master.

Command format

When ADDR=1, CTRL=STX_ETX_CR, BCC=ADD

STX 02H

30H

1

31H

1

31H

W

57H

30H

1

31H

8

38H

C

43H

30H

,

2CH

30H

30H

30H

1

31H

ETX

03H

E

45H

7

37H

CR

0DH

If a normal response is returned to the above command, the SB/COM LED on the front panel lights and the communication mode switches to COM.

(1) Format of Write command (W)

The following shows the format of the text section of the Write command (W).

Basic format section I and basic format section II are common to all commands and command responses.

Text section

d (5)Writ

e data

W 57H

e

f g (6)

(7)

(8)

(9)(10)

(11)

030H 434H 030H 030H

030H ,2CH 030H 030H 232H 838H

? d ((5)) : "W" (57H) indicates that this data is a Write command.

It is fixed to "W" (57H).

? e ((6) to (9)) : The start data address of the data to write (change). ? f (10) : The number of data to read (change).

It is fixed to one, "0" (30H).

? g ((11))

: The actual data to the Write command is inserted. 1. "," (2CH) is added to indicate the actual data start. 2. Actual data is inserted.

3. Each data consists of binary 16-bit (1 word) data without a decimal point, and is converted to ASCII data in 4-bit blocks before it is inserted.

4. The position of the decimal point is determined by each data.

?

The above command is as follows:

Write start data address = 0400H (Hex) = 0000 0100 0000 0000 (Binary) Number of write data = 0H (Hex) = 0000 (Binary) = 0 (Decimal)(actual number of data) = 1 (0 + 1) Data to write = 0028H (Hex) = 0000 0000 0010 1000 (Binary) = 40 (Decimal)

In other words, in this example, writing of 1 data (40 in decimal) to data address 0400H is specified.

Write start

data Address (0400H)Number of write data (one, 01)

(2) Format of normal response to Write command (W)

?

The following shows the format (text section) of a normal response to the Write command (W).

Basic format section I and basic format section II are common to all commands and command responses.

Text section d (5)

W 57H

e (6)

(7)

030H 030H

? d ((5)) : "W" (57H) is inserted to indicate that this data is a Write command response. ? e ((6) to (7)) : "0 0" (30H and 30H) is inserted to indicate that this is a normal response.

(3) Format of error response to Write command (W)

?

The following shows the format (text section) of an error response to the Write command (W).

Basic format section I and basic format section II are common to all commands and command responses.

Text section d (5)

W 57H

e (6)

(7)

030H 939H

? d ((5)) : "W" (57H) is inserted to indicate that this data is a Write command response. ? e ((6) to (7)) : Any response code is inserted to indicate that this is an error response. ? For details on error codes, see "5-5 Details of response codes".

5-5. Details of response codes

(1) Type of response codes

Communication responses to the Read command (R) and Write command (W) must contain a response code. There are two types of response codes: normal response code and error response code.

Response codes are expressed as binary 8-bit data (0 to 255). The table below shows the details of response codes.

Response Code List

Response Code

Code Type

Binary

Normal response

A hardware error such as framing overrun or parity has been detected in the data of the text section.

ASCII

Description

Normal response code for Read command (R) or Write command (W)

0000 0000"0","0":30H,30H Hardware error in text section "0","1":30H,31H

The format of the text section differs from the predetermined format.Format error in text section

0000 0111"0","7":30H,37H

The format of the text section differs from the predetermined format, or the data address and number of data are other than specified.

Data format data address, number of data error in text section

0000 1000"0","8":30H,38H

The write data exceeds the settable range of that data.

Data error

0000 1001"0","9":30H,39H An execution command (e.g. MAN) was received when it could not be accepted.Execution command error 0000 1010"0","A":30H,41H

When data that must not be rewritten depending on the data type, a write command containing that data was received.

Write mode error

0000 1011"0","B":30H,42H A write command containing data of an unmounted specification or option was received.

Specification, option error

0000 1100"0","C":30H,43H

0000 0001

(2) Order of priority of response codes

The smaller the value of the response code becomes, the higher the priority of the response code.

When multiple response codes have been issued, the response code having the higher or highest priority is returned.

6. Outline of MODBUS protocol

The MODBUS communication protocol has two transfer modes: ASCII mode and RTU mode.

6-1. Outline of transfer mode

(1) ASCII mode

The 8-bit binary data in commands are divided into groups of upper 4 bits (Hex) and lower 4 bits (Hex), each of which is sent as ASCII characters.

Data configuration

Data format Selectable from 7E1, 7E2, 7N1, 7N2

Error check LRC (Longitudinal Redundancy Check)

Data communication interval 1 sec or less

(2) RTU mode

The 8-bit binary data in commands are sent as is.

Data configuration

Data format Selectable from 8E1, 8E2, 8N1, 8N2

Error check CRC-16 (Cyclic Redundancy Check)

Data communication interval 3.5-character transmission time or less

6-2. Configuration of messages

(1) ASCII mode

In this mode, message formats begin with a start character (":" (colon, 3AH) ), and end with an end character ("CR"

(carriage return, ODH) ) followed by an "LF" (line feed, 0AH) ).

Header (:)Slave

address

Function code Data Error check LRC

Delimiter

(CR)

Delimiter

(LF)

(2) RTU mode

In this mode, messages begin after an idle time of 3.5-character transfer time or more, and end after an idle time of

3.5-character transfer time or more has elapsed.

Idle 3.5 characters Slave

address

Function code Data Error check CRC

Idle 3.5

characters

6-3. Slave address

The slave address is settable within the range 1 to 247 (SR90 series supports to 255).

The master device can specify the slave address in a request message to recognize each of the subordinate devices.

The subordinate device notifies the master which slave is responding by setting and returning its own slave address to the response message.

6-4. Function codes

A function code is a code to indicate the type of operation to the subordinate device.

Function Code Details

03 (03H) Reads setting values and information from subordinate devices

06 (06H) Writes to subordinate devices

These function codes are also used to indicate whether the response message returned to the master by the slave is

a normal response (positive response) or that some error has occurred (negative response).

In a positive response, the original function code is set and returned.

In a negative response, the MSB of the original function code is set to "1" and returned.

For example, when "10H" has been mistakenly set as the function code, and the request message has been sent to the subordinate device, "1" is set to the MSB and returned as "90H" as this function code is non-existent.

Also, in the case of a negative response, an error code is set to the response message and returned to notify the master which type of error has occurred.

Error Code Details

1 (01H) illegal Function (non-existent function)

2 (02H) illegal data address (non-existent data address)

3 (03H) illegal data value (value out of setting range)

6-5. Data

The data structure differs depending on the function code.

With request messages from the master device, the data consist of data item, number of data and setting data.

With response messages from a subordinate device, the data consist of number of bytes or data in response to the request, and in the case of a negative response, an error code.

The valid data range is -32768 to 32767.

6-6. Error check

The error check method differs depending on the transfer mode.

(1) ASCII mode

As the error check for the ASCII mode, calculate the LRC to the end of the data from the slave address, convert the resulting 8-bit data to two ASCII characters and append it to the data.

LRC calculation method

1.Create a message in the RTU mode.

2.Add to the end of the data from the slave address, and substitute with x.

3.Take the 2’s complement (invert bits) of x, and substitute with x.

4.Add "1" to x, and substitute with x.

5.Append to the data taking x to be the LRC.

6.Convert the message to ASCII characters.

(2) RTU mode

As the error check for the RTU mode, calculate the CRC-16 to the end of the data from the slave address, and append the resulting 16-bit data to the data in the order of lower bits then upper bits.

CRC-16 calculation method

By the CRC method, the information to be sent is divided by a generating function, and the information is appended with the remainder and then sent.

Generating function: X16 + X15 + X2 + 1

1.Initialize the data of CRC (taken to be x) to (FFFFH).

2.Exclusive-OR the 1st data with x, and substitute with x.

3.Shift x to the right by one bit, and substitute with x.

4.If the shift results in a carry, exclusive-OR the result of "3." with a fixed value (A001H), and substitute with x. If the

shift does not result in a carry, go to step "5.".

5. Repeat steps "3." and "4." until x is shifted eight times.

6.Exclusive-OR the next data with x, and substitute with x.

7. Repeat steps "3." to "5.".

8. Repeat steps "3." to "5." until the last data.

9.Append the data to the message in order lower bits then upper bits taking x to be CRC-16.

6-7. Examples of messages

(1) ASCII mode

Reading SV value from subordinate device No.1

? Request message from master device

Header Slave

address

Function

code

Data

address

Number of data

Error check

LRC

Delimiter

(:) (01H) (03H) (0300H)

(0001H) (F8H) (CR?LF)

1 2 2 4 4 2 2 ?Number of characters (17)

? Response message from subordinate device in normal operation (SV = 10.0°C)

Header Slave

address

Function

code

Response

data length

Data

Error check

LRC

Delimiter

(:) (01H) (03H) (02H) (0064H) (96H) (CR?LF)

1 2 2 2 4 2 2 ?Number of characters (15)

? Subordinate device’s response message in erroneous operation (when the data item has been mistaken)

Header Slave

address

Function

code

Error code

Error check

LRC

Delimiter

(:) (01H) (83H) (02H) (7AH) (CR?LF)

1 2 2 2 2 2 ?Number of characters (11)

In a response message when an error has occurred, "1" is set to the MSB of the function code (83H). An error code 02H (non-existent data address) is returned as the response message for the error content.

Writing SV value (SV = 10.0°C) to subordinate device No.1

?

Request message from master device

Header

Slave address Function code Data address Data Error check

LRC

Delimiter

(:) (01H) (06H) (0300H) (0064H) (92H) (CR?LF)

1 2 2 4 4 2 2

?Number of characters (17)

?

Response message from subordinate device in normal operation (SV = 10.0°C)

Header

Slave address Function code Data address Data Error check

LRC

Delimiter

(:) (01H) (06H) (0300H) (0064H) (92H) (CR?LF)

1 2 2 4 4 2 2

?Number of characters (17)

?

Subordinate device’s response message in erroneous operation (when a value out of range is set)

Header

Slave address Function code Error code Error check

LRC

Delimiter

(:) (01H) (86H) (03H) (76H) (CR?LF)

1 2 2 2 2 2

?Number of characters (11)

In a response message when an error has occurred, "1" is set to the MSB of the function code (86H). An error code 03H (value outside of setting range) is returned as the response message for the error content.

(2) RTU mode

Reading SV value from subordinate device No.1

?

Request message from master device

Idle 3.5 characters Slave address Function code Data address Number of data Error check CRC Idle 3.5

characters

(01H) (03H) (0300H) (0001H) (844EH)

1 1

2 2 2

?Number of characters (8)

?

Response message from subordinate device in normal operation (SV = 10.0°C)

Idle 3.5 characters Slave address Function code Response data length Data Error check CRC Idle 3.5

characters

(01H) (03H) (02H) (0064H) (B9AFH)

1 1 1

2 2

?Number of characters (7)

?

Subordinate device’s response message in erroneous operation (when the data item has been mistaken)

Idle 3.5 characters Slave address Function code Error code Error check CRC Idle 3.5

characters

(01H) (83H) (02H) (C0F1H)

1 1 1 2

?Number of characters (5)

In a response message when an error has occurred, "1" is set to the MSB of the function code (83H). An error code 02H (non-existent data address) is returned as the response message for the error content.

Writing SV value (SV = 10.0°C) to subordinate device No.1

?

Request message from master device

Idle 3.5 characters Slave address Function code Data address Data Error check CRC Idle 3.5

characters

(01H) (06H) (0300H) (0064H) (8865H)

1 1

2 2 2

?Number of characters (8)

?

Response message from subordinate device in normal operation (SV = 10.0°C)

Idle 3.5 characters Slave address Function code Data address Data Error check CRC Idle 3.5

characters

(01H) (06H) (0300H) (0064H) (8865H)

1 1

2 2 2

?Number of characters (8)

?

Subordinate device’s response message in erroneous operation (when a value out of range is set)

Idle 3.5 characters Slave address Function code Error code Error check CRC Idle 3.5

characters

(01H) (86H) (03H) (0261H)

1 1 1 2

?Number of characters (5)

In a response message when an error has occurred, "1" is set to the MSB of the function code (86H). An error code 03H (value outside of setting range) is returned as the response message for the error content.

7. Communication data address

7-1. Details of communication data addresses

Note: Error response codes here follow Shimaden protocol.

(1) Data address and read/write

? In a data address, binary numbers (16-bit data) are expressed by hexadecimal numbers, with 4 bits as a unit.

? R/W means that data are capable of being read and written.

? R means that data are only for reading.

? W means that data are only for writing.

? In case a data address only for writing is designated by a read command (R), or a data address only for reading is designated by a write command (W), it results in a data address error and the error response code "0", "8" (30H, 38H) "error in data format, data address or the number of data in text section" is returned.

(2) Data address and the number of data

? If a data address which is not included in the data addresses for SR90 is designated as the start data address, it results in a data address error, and the error response code "0", "8" (30H, 38H) "error in data format, data address or the number of data in text section" is returned.

? Even if a start data address belongs to the data address list, the actual data includes data which address is out of the data address list, it results in an error of the number of data, and error response code "0", "8" (30H, 38H) " is returned.

(3) Data

? Since data comprise binary numbers (16-bit data) without a decimal point, the data type or with/without decimal point, etc., have to be confirmed. (See the instruction manual of the instrument itself.)

Example: How to express data with a decimal point

Hexadecimal data

20.0% → 200 → 00C8

100.00°C → 10000 → 2710

–40.00°C → –4000 → F060

? In data of which the unit is UNIT, the position of decimal point depends on the measuring range.

? Otherwise, data is handled as signed binary numbers (16-bit data: –32768 to 32767).

Example) How to express 16-bit data

Signed number

Decimal Hexadecimal

0 0000

1 0001

: :

32767 7FFF

–32768 8000

–32767 8001

: :

–2 FFFE

–1 FFFF

(4) Read/Write of data

When data in the address list is read or written by a Read (R) or a Write (W) command, normal response code "0", "0" (30H, 30H) is returned.

(5) Option-related parameters

When parameter data for unmounted option is designated, error response code "0","C" (30H, 43H) "specification, option error" is returned to a Read command (R) as well as a Write command (W).

(6) Parameters not displayed on the front panel

Even parameter data which is not displayed on the front panel screen for its specifications or settings is able to Read/Write through communication.

相关文档