Enraf B.V. P.O. Box 812 2600 AV Delft Netherlands Tel. Fax E-mail Home page : +31 15 2698600 : +31 15 2619574 : info@enraf.nl : http://www.enraf.com
Page 1
Copyright 2003 Enraf B.V. All rights reserved. Reproduction in any form without the prior consent of Enraf B.V. is not allowed. This manual is for information only. The contents, descriptions and specifications are subject to change without notice. Enraf B.V. accepts no responsibility for any errors that may appear in this manual. The warranty terms and conditions applicable in the country of purchase in respect to Enraf B.V. products are available from your supplier. Please retain them with your proof of purchase.
Page 2
Preface
Preface
This manual describes the Modbus protocol, used in the Enraf servo gauges type 854, the series SmartRadar gauges and the field indicator model 877 FDI. The document is intended for a control technician that is experienced and trained in setting up a Standard Modbus interface. For installation and commissioning of the Enraf gauges, please refer to the Installation guides and Instruction manuals of the related instrument. Refer also to the list of related documents in Appendix B. A description preceding the technical procedures gives the technical information necessary to understand its functioning. It is recommended to read this description prior to performing any of the procedures. Communication Modbus communication can only be performed via the optional RS-232C / RS-485 communication channel. Then it is not possible to connected an optional analog level output (4 - 20 mA). Also the standard Enraf field bus communication is not available. There cannot be connected a 977 TSI Tank Side Indicator to the 854 servo gauges, 873 SmartRadar and 877 FDI, however a 977 TSI can be connected to the 970, 971 and 973 SmartRadar LT series. Safety and prevention of damage "Notes" are used throughout this manual to bring special matters to the immediate attention of the reader. A Note points out a statement deserving more emphasis than the general text. Legal aspects The information in this manual is the copyright property of Enraf B.V., Netherlands. Enraf B.V. accepts no responsibility for any errors that may appear in this manual. Additional information Please do not hesitate to contact Enraf or its representative if you require additional information.
Page 3
Table of contents
Table of contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 2 3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Setup for Modbus RTU mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Modbus protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1 Communication parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 Communication procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.3 Function codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3.1 Function code 03 Read holding registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3.2 Function code 05 Force single coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 Memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.5 On-line switch in Modbus mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Modbus register contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 ProductLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 ProductLevelStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 ProductLevelAlarms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 WaterLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 WaterLevelStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 ProductTemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 ProductTempStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8 VapRoomTemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9 VapRoomTempStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10 VapRoomPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.11 VapRoomPressStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.12 ObsDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.13 ObsDensityStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix A Appendix B 11 11 11 12 12 12 12 13 13 13 14 14 15 15
Page 4
Introduction
Introduction
The modbus communication takes place via the optional RS-232C / RS-485 communication channel. Reference is made to: Instruction manual XPU-2 option RS-232C / RS-485 Instruction manual SmartRadar LT RS-232C / RS-485 output communication
These Instruction manuals describe the commissioning of the optional communication channel. In addition to that information, this manual describes the setup for the optional Modbus protocol and the implemented Modbus function codes. The RS-232C communication is used between the instrument and one other user (DCE). This can be a modem or line driver or any host system using RS-232C. The RS-232C communication is limited to 15 m (50 ft) distance and handshake signals (RTS, CTS, DTR, DSR or DCD) are not supported. The communication is half duplex. With RS-485 communication a multi-drop bus structure is possible with maximum 32 slaves (instruments) and one master (host). The maximum distance with RS-485 is approximately 1000 m (3000 ft) at 9600 baud. The communication is half duplex. The Enraf instruments communicate with the Enraf GPU-protocol on the RS-232C / RS-485 communication channel. A software switch is used to switch over from Enraf GPU-protocol to Modbus protocol RTU mode.
Page 5
Before the setup for Modbus RTU mode is made, the gauge should be commissioned and operational. When set for Modbus RTU mode, access to items is limited to the Portable Enraf Terminal via the infra-red connector. Item W2= BC= Name Protection level 2 Address byte CIU emulation Description Enter password 2. One ASCII character (default: -). For the Modbus RTU mode, it is required that there is no CIU address emulation. Therefore, this item must be set to - . Two ASCII numbers, ranging from 00 till 99 (default: 00). Read the transmission address and note it for use in the Modbus RTU addressing. One ASCII character (default: G) Selects the communication mode of the RS-232C / RS-485 communication channel G = Enraf GPU protocol M = Modbus RTU protocol Set to M, for Modbus communication. Exit protection level.
TA
Transmission address
GM=
EX
Exit
Note:
When the Modbus mode is selected, the command to return to Enraf GPU mode via the RS-232C / RS-485 communication channel, is with Modbus Function code 05: Force single coil (refer to section 3.5), or via the Portable Enraf Terminal by setting item GM to G.
Page 6
Modbus protocol
Modbus protocol
Enraf has implemented in the gauges (as option) the Standard Modbus (RTU mode), as defined by the Schneider Automation Modicon Modbus Protocol Reference Guide (PI-MBUS, Rev. J). Only a limited set of functions is used as the protocol for query / response is straight forward. Gauge commands and parameter settings (item settings) are not supported within the Modbus implementation. As with RS-485 communication a bus structure can be built, it is possible to connect a maximum of 32 gauges (as slaves) onto one host (master). Each slave has its unique address. The host (master) initiates the communication by addressing one of the slaves in its query. Only the addressed slave (gauge) will respond. With RS-232C there can be only one slave (the gauge) and one master (the host).
Page 7
Modbus protocol
start address Synchronisation 3.5 character time elapsed The address field of a message frame contains eight bits. The address must be the binary representation of the programmed address in item TA. Item TA can range from 00 to 99 (decimal), which means the largest value in this field can be: 63H (0110 0011B). A master addresses a slave by placing the slave address in the address field of the message. When the slave sends its response, it places its own address in this address field of the response to let the master know which slave is responding. function The function code field of a message frame contains eight bits. With the Modbus protocol in the Enraf gauges, only function code 03 (read holding registers) and function code 05 (force single coil) are valid. When a message is sent from a master to a slave the function code field tells the slave what kind of action to perform. For a normal response, the slave simply echoes the original function code. data The data field is constructed using sets of two 8 bit bytes (16 bit registers), in the range of 0000...FFFF. The data field of messages sent from a master to slave devices contains additional information which the slave must use to take the action defined by the function code. The data field of a response from a slave to a master contains the requested data. CRC check The CRC check field contains a 16-bit value implemented as two eight-bit bytes. The error check value is the result of a CRC (Cyclical Redundancy Check) calculation performed on the message contents. The CRC field is appended to the message as the last field in the message. end Synchronisation 3.5 character time elapsed
The register data in the response message is packed as two bytes per register with the binary contents visually right-justified within each register: Slave address 8 bits Function 03 8 bits Byte count (N) 8 bits Data (N) x 8 bits CRC check 16 bits
The amount of bytes N is double the amount of requested registers, because each register occupies two bytes.
Page 8
The normal response is an echo of the query, returned after the coil state has been forced: Slave address 8 bits Function 05 8 bits Coil address 8 bits Force data 16 bits CRC check 16 bits
There is no offset applicable for the given data. However, there is a fixed scaling which depends on the selected dimension of the measured unit. S = signed data (twos complement) D = double register (4 bytes; 32 bits) When a measured unit is in fail, the register value will contain the maximum value, considering the Modbus type. For example: a signed double register then contains: 7FFFFFFFH; a signed single register then contains: 7FFFH.
Page 9
Page 10
4.1 ProductLevel
Signed number; double register. Depending on the level dimension of the gauge (item LD), this double register contains the product level in: Level dimension item LD M F I P Modbus data representation 0.1 0.001 0.01 1 /16 mm ft inch inch Scaling (divide by) 10 1000 100 16 for for for for mm, or 10 000 for m ft inch inch
4.2 ProductLevelStatus
This register contains the bit coded product level status. This status information is coded in such a way that an ASCII code for a character is generated. The ASCII characters are listed below (refer to the ASCII table in Appendix A). The product level status depends on the type of gauge. 854 Servo gauge level status: F C B L R T W D Invalid level data hardware / software error 854 in service mode Motor limit switch reached Block or freeze active Lock test or calibrate active Density scan active (TP or IP) Test gauge (TG), searching for level, balance test or measure frequency command active Water level found (by displacer) Searching for water (downwards) Valid level SmartRadar gauge level status: F Invalid level data level fail initial status th 4 character of item LU out of measuring range rd 3 character of item LU measurement blocked nd 2 character of item LU warning general APU/ICU fail st 1 character of item LU reduced accuracy Valid level
877 FDI level status when used as HTG: F *) The characters given here are the default Invalid level data settings in item LU (level status conversion); general HPU/HCU fail it may be set to different characters. level fail P1 and/or P3 out of range P2 out of range Reduced accuracy manual P3 used last valid P3 used manual density used last valid density used manual gas density used level below item LN (minimum HTG level) Valid level
?*) -
Page 11
4.4 WaterLevel
Signed number; double register. Depending on the level dimension of the gauge (item LD), this double register contains the water level in: Level dimension item LD M F I P Modbus data representation 0.1 0.001 0.01 1 /16 mm ft inch inch Scaling (divide by) 10 1000 100 16 for for for for mm, or 10 000 for m ft inch inch
4.5 WaterLevelStatus
This register contains the bit coded water level status. This status information is coded in such a way that an ASCII code for a character is generated. The ASCII characters are listed below (refer to the ASCII table in Appendix A). F A Z Invalid water alarm data general probe failure Water above probe warning Water below probe warning Valid water level
4.6 ProductTemp
Signed number; double register. Depending on the temperature dimension of the gauge (item TD), this double register contains the product temperature in: Temperature dimension item LD C F Modbus data representation 0.01 C 0.01 F Scaling (divide by) 100 for C 100 for F
Page 12
T*) -
*) The character T is the default value of item TU (temperature status conversion); it may be set to a different character.
4.8 VapRoomTemp
Signed number; double register. Depending on the temperature dimension of the gauge (item TD), this double register contains the vapour room (gas) temperature in: Temperature dimension item LD C F Modbus data representation 0.01 C 0.01 F Scaling (divide by) 100 for C 100 for F
4.9 VapRoomTempStatus
These four registers contains the bit coded vapour room temperature status. With exception of the first register, the status information is coded in such a way that an ASCII code for a character is generated. The 8 bits ASCII coded character is placed in the Low byte of the register; the High byte remains empty (zero). The ASCII characters are listed below (refer to the ASCII table in Appendix A). Modbus address Register contents 000CH item MQ, byte 0 000DH item MQ, byte 1 000EH item MQ, byte 2 000FH item MQ, byte 3
Status byte 0: Contains one of the characters 0 to F (as a hexa-decimal number), indicating the highest immersed (spot)element of the temperature element.
Page 13
Note:
Only the bits which are set to 1 have an active status.
4.10 VapRoomPress
Signed number; double register. Depending on the pressure dimension of the gauge (item PI), this double register contains the vapour pressure in: Pressure dimension item PI P I, S K Modbus data representation 0.001 bar 0.001 psi 1 Pa Scaling (divide by) 1000 for bar 1000 for psi no scaling
4.11 VapRoomPressStatus
These five registers contain the bit coded vapour room pressure and observed density status. The status information is coded in such a way that an ASCII code for a character is generated. The 8 bits ASCII coded character is placed in the Low byte of the register; the High byte remains empty (zero). The ASCII characters are listed below (refer to the ASCII table in Appendix A). Modbus address Register contents 0012H item QF, byte 0 0013H item QF, byte 1 0014H item QF, byte 2 0015H item QF, byte 3 0016H item QF, byte 4
Status byte 0: bit 0 : General option board fail 1 : Low level alarm *) 2 : Low low level alarm *) 3 : High level alarm *) 4 : High high level alarm *) 5 : Level time out *) 6 : 1 7 : 0
Status byte 1: bit 0 : P1 exceeds min. / max. trip pressure 1 : P2 exceeds min. / max. trip pressure 2 : P3 exceeds min. / max. trip pressure 3 : Exceeding range P1 4 : Exceeding range P2 5 : Exceeding range P3 6 : 1 7 : 0
Page 14
*)
Status byte 4: bit 0 : Manual gas density used Note: 1 : Level below LN Only the bits which are set to 1 have an active 2 : Last valid level used status. 3 : Invalid level reading 4 : API underflow/overflow or negative density 5 : 0 6 : 1 *) These bits represent typical HIMS / HTG status 7 : 0 messages. Ignore for vapour pressure and observed density measurement.
4.12 ObsDensity
Signed number; double register. Depending on the density dimension of the gauge (item DI), this double register contains the observed density in: Density dimension item DI K A L Modbus data representation 0.01 kg/m 0.001 API 3 0.0001 lbs/ft
3
Scaling (divide by) 100 for kg/m 1 000 for API 3 10 000 for lbs/ft
3
4.13 ObsDensityStatus
These five registers contain the bit coded observed density and vapour room pressure status. Refer to section 4.11 VapRoomPressStatus.
Page 15
Appendix
Page 16