KROHNE ALTOSONIC-V User Manual

© KROHNE 09/2008 7.30855.35.00
Ultrasonic Flowmeters
Reference Guide
Modbus manual
Protocol description
&
setup
Applicable for
software version 0300
ALTOSONIC V
TABLE OF CONTENTS
1 INTRODUCTION TO MODBUS.................................................................................................... 5
2 SERIAL TRANSMISSION FORMAT ............................................................................................ 6
2.1 ASCII-MODE ................................................................................................................................... 6
2.2 RTU-MODE ..................................................................................................................................... 6
3 MODBUS MESSAGE FRAMING.................................................................................................. 7
3.1 THE ADDRESS FIELD ....................................................................................................................... 7
3.2 THE FUNCTION FIELD ...................................................................................................................... 7
3.3 THE DATA FIELD.............................................................................................................................. 7
3.4 THE ERROR CHECKING FIELD .......................................................................................................... 8
3.5 OTHER ERROR CHECKING METHODS ............................................................................................... 8
4 PHYSICAL COMMUNICATION LAYER....................................................................................... 9
4.1 WHEN USING RS232 TO RS485 CONVERTERS ................................................................................. 9
4.2 WHEN USING SERIAL I/O CARDS WITH RS485 DRIVERS ..................................................................... 9
5 SUPPORTED FUNCTIONS ........................................................................................................ 10
5.1 FUNCTION 01: READ COIL STATUS ............................................................................................ 10
5.2 FUNCTION 02: READ INPUT STATUS.......................................................................................... 11
5.3 FUNCTION 03: READ MULTIPLE HOLDING REGISTERS........................................................... 11
5.4 FUNCTION 04: READ INPUT REGISTERS ................................................................................... 12
5.5 FUNCTION 05: WRITE SINGLE COIL ........................................................................................... 12
5.6 FUNCTION 06: WRITE SINGLE HOLDING REGISTER................................................................ 12
5.7 FUNCTION 8: DIAGNOSTICS........................................................................................................ 13
5.8 FUNCTION 15: WRITE MULTIPLE COILS .................................................................................... 13
5.9 FUNCTION 16: WRITE MULTIPLE HOLDING REGISTERS ......................................................... 14
5.10 EXCEPTION RESPONSES............................................................................................................ 15
6 HANDLING OF LARGE DATA TYPES ...................................................................................... 16
6.1 FLOATING POINT REPRESENTATION ............................................................................................... 17
6.2 DOUBLE REPRESENTATION ............................................................................................................ 17
6.3 TRANSMIT SEQUENCE.................................................................................................................... 17
6.4 MAXIMUM REQUESTED POINTS ....................................................................................................... 18
7 SET-UP OF THE UFP-V MODBUS DRIVER ............................................................................. 20
7.1 DRIVER CONTENTS........................................................................................................................ 20
7.2 HARDWARE SET-UP ....................................................................................................................... 20
7.2.1 RS485/422 card: AX4285A............................................................................................................ 21
7.2.2 RS485/422 card: PCL-745 S ......................................................................................................... 22
7.3 SOFTWARE SET-UP....................................................................................................................... 23
7.3.1 First set the parameters for the communication line...................................................................... 23
7.3.2 Now select the parameters for the used protocol .......................................................................... 23
7.3.3 The UFP-V as SLAVE device ........................................................................................................ 23
7.3.4 The UFP-V as Master .................................................................................................................... 24
7.4 WHAT CAN GO WRONG? ................................................................................................................ 25
7.5 HOW STATUS FLAGS ARE UPDATED ............................................................................................... 25
7.6 HOW DATA IS WRITTEN TO THE FLOAT FIELD.................................................................................... 27
7.6.1 How to write in the float field to the specific application ................................................................ 27
8 MODBUS MAPPING ASSIGNMENTS ....................................................................................... 29
8.1 FIELD 0 (READ ONLY BOOLEAN FIELD)............................................................................................ 29
8.2 FIELD 1 (READ/WRITE BOOLEAN FIELD) ......................................................................................... 31
8.3 FIELD 2 (READ ONLY INTEGER FIELD)............................................................................................. 35
8.4 FIELD 3 (READ ONLY LONG INTEGER FIELD).................................................................................... 38
8.5 FIELD 4 (READ ONLY FLOAT FIELD) ................................................................................................ 40
8.6 FIELD 5 (READ ONLY DOUBLE FIELD).............................................................................................. 45
8.7 FIELD 6 (READ/WRITE FLOAT FIELD).............................................................................................. 46
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 2 of 64
ALTOSONIC V
8.8 FIELD 6 (READ ONLY ASCII FIELD 8 CHARACTERS) ........................................................................ 49
8.9 FIELD 6 (READ WRITE ASCII FIELD 16 CHARACTERS)..................................................................... 49
8.10 EXPLANATION OF DATA AVAILABLE TO MODBUS ......................................................................... 51
8.11 THE SYSTEM MESSAGES ........................................................................................................... 55
9 APPENDICES ............................................................................................................................. 57
9.1 APPENDIX A: TIME OUT VALUES...................................................................................................... 57
9.2 APPENDIX B: LRC GENERATION..................................................................................................... 58
9.3 APPENDIX C: CRC GENERATION .................................................................................................... 59
9.4 APPENDIX D: COMS0300.DAT........................................................................................................ 62
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 3 of 64
ALTOSONIC V
INTRODUCTION
This manual describes how to use the Modbus protocol with the ALTOSONIC V flow meter system.
Product Liability and warranty
Responsibility for suitability and intented use of these ultrasonic flowmeters rests solely with the operator.
Improper installation and operation of the flowmeters (systems) may lead to loss of warranty.
In addition, the “General conditions of sale” forming the basis of the purchase contract are applicable.
Nothing from this document may be copied or reproduced without the written permission of KROHNE Altometer
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 4 of 64
ALTOSONIC V
1 INTRODUCTION TO MODBUS
From this point in the manual the following abbreviations are used for the ALTOSONIC-V system: UFS-V: Ultrasonic Flow Sensor (primary flow meter body) UFC-V: Ultrasonic Flow Converter (5 converters) UFP-V: Ultrasonic Flow Processor
Introduction to Modbus
For communication with host systems the flow controller emulates a Modbus compatible controller.
The Modbus protocol defines a message structure that controllers will recognise and use, regardless of the type of network over which they communicate. It describes:
the process a controller uses to request access to other devices,
how it will respond to requests from the other devices, and
how errors will be detected and reported.
Controllers communicate using a master-slave principle. Only the master can initiate transactions (requests), and only the addressed device responds. In case of a broadcast request none of the slaves will respond.
The Modbus request consist of:
an address,
a function code defining the requested action,
data (if necessary for the requested function), and
error check for testing the integrity of the message.
The slave’s response contains:
the slave address,
data conform the request type, and
error check.
If the data integrity test fails, no response is sent back. If a request cannot be processed an exception message is returned.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 5 of 64
ALTOSONIC V
2 SERIAL TRANSMISSION FORMAT
The two transmission modes used are called:
1. ASCII, and
2. RTU.
The user has to select the desired mode along with the serial communication parameters (baud rate, parity-type).
Note that all these parameters must be the same for all controllers in the network.
2.1 ASCII-mode
Each byte of the message is sent as two ASCII characters. This means only the ASCII characters 0-9, A-F are transmitted.
Serial communication parameters: 1 start byte, 7 data bits, even/odd/no parity, 1 stop bit if parity is used and two stop bits if no parity is used.
Error check field: Longitudinal Redundancy Check (LRC).
The advantage of ASCII mode is that it allows for a time interval up to 1 second between characters without causing a timeout. A disadvantage of ASCII mode is the larger message length.
2.2 RTU-mode
Each byte of the message is sent as 8 bits.
Serial communication parameters:
1 start byte, 8 data bits, even/odd/no parity, 1 stop bit if parity is used, and two stop bits if no parity is used.
Error check field: Cyclic Redundancy Check (CRC).
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 6 of 64
ALTOSONIC V
3 MODBUS MESSAGE FRAMING
ASCII-mode
In ASCII-mode a message starts with a colon character (:) and ends with a carriage return–linefeed. Intervals up to one second can elapse between characters within the message. If the interval is longer, a timeout error occurs and the message is rejected.
RTU mode
In RTU-mode a message starts with a silent interval of at least 3.5 character times. The entire message frame must be transmitted as a continuous stream. If a silent interval of more than 3.5 character times occurs before completion of the frame, the receiving device flushes the incoming message and assumes that the next byte will be the address field for the new message. See 9.1 Appendix A for the applied timeout values.
Example of a typical message frame:
ASCII Mode RTU Mode
START
‘:’ 2 characters 2 characters N*2
3.5 characters silent interval
ADDRESS FUNCTION DATA
8 bits 8 bits N*8 bits CRC
characters
DATA CHECK LRC 2 characters
16 bits
END
CR-LF
3.5 character silent interval
3.1 The Address Field
The address field of a message frame contains:
2 characters (ASCII-mode) or
8 bits (RTU-mode).
Valid slave addresses are 1 to 247. Address 0 is used for a broadcast to address all slaves.
3.2 The Function Field
The function field of a message frame contains:
2 characters (ASCII-mode) or
8 bits (RTU-mode).
Valid codes lie in a range of 1 to 127.
The function code tells the slave which kind of action to perform. The supported functions are listed in chapter 5. A slave response always contains the function code of the request. If a function is not applicable, the slave sends an exception response. An exception is indicated by a returned function code with bit 8 (most significant byte) set.
3.3 The Data Field
The data field contains 8 bit values in the range of 0 to FF hexadecimal.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 7 of 64
ALTOSONIC V
In ASCII mode this byte is made of 2 ASCII characters.
The data field of messages contains information which both master and slave use to perform an action. This includes the register address, quantity of registers, and the necessary data.
3.4 The Error Checking Field
The error checking field contents depend on the transmission mode. Two kinds of error methods are used.
Error check with ASCII-mode
When the ASCII mode is used, the error-checking field contains two ASCII characters. The error check characters are the result of a Longitudinal Redundancy Check calculation. This is performed on the message contents with exception of the beginning colon, the carriage return and line feed characters. The LRC characters are appended to the message as the last field preceding the CR-LF characters. See 9.2 Appendix B for more information about the Longitudinal Redundancy Check.
Error check with RTU-mode
When RTU mode is used, the error-checking field contains a 16-bit value implemented as two bytes. The error check value is the result of a Cyclic Redundancy Check calculation performed on the message contents. The CRC field is appended to the message as the last field. See 9.3 Appendix C for more information about the Cyclic Redundancy Check.
3.5 Other Error Checking Methods
Standard Modbus uses two kinds of error checking methods:
1. Character based check
an additional parity bit for each character (even or odd parity).
2. Message based check
an additional error check calculated over the entire message.
Both character check and message check are generated in the transmitting device and applied to the message before transmission. The slave checks each character and the entire message frame during receipt.
The master has a predetermined timeout interval before aborting the transaction. This interval is set long enough for any slave to respond normally. The timeout interval is set by the parameter 7.2 REQUEST_TO_RESPONSE_TIMEOUT.
ASCII mode
In ASCII mode the maximum time between 2 characters is one second. If a longer interval occurs, the message will be rejected and the search for a starting character (colon) is resumed.
RTU mode
In RTU mode the entire message frame must be transmitted as a continuous stream. If a silent interval of more than 3.5 character times occurs before completion of the frame, the receiving device flushes the incoming message and assumes that the next byte will be the address field for the new message.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 8 of 64
ALTOSONIC V
4 PHYSICAL COMMUNICATION LAYER
The Modbus protocol is a half-duplex protocol. The physical layer can be half or full duplex. The Modbus driver supports both half (RS485) and full (RS232/RS422) duplex communication layers.
In case of RS485, the parameter 3.8 MODBUS_UART_HALF_DUPLEX must be turned on. The transmitter is activated when the UFP-V transmits data. The RS485 receiver may not be disabled e.g. the transmitted data must also be received by the UFP­V for correct functioning!
4.1 When using RS232 to RS485 converters
Always use isolated converters!
Use the types that enable the transmitter by means of the Request To Send signal.
Use the parameter 3.4 MODBUS_UART_RTS_MODE to define whether a high or a low level
enables the transmitter.
Check if the terminator resistor corresponds with the characteristic line impedance.
Use pull-up and pull down resistors for fail safe operation.
If possible, use the Serial Communication port that uses Interrupt Request 3.
4.2 When using serial I/O cards with RS485 drivers
Use the types that enable the transmitter by means of the Request To Send signal.
Use the parameter 3.4 MODBUS_UART_RTS_MODE to define whether a high or a low level
enables the transmitter.
Check if the terminator resistor corresponds with the characteristic line impedance.
Use pull-up and pull down resistors for fail safe operation.
Set the IO-address and Interrupt number to the correct values.
When possible, use Interrupt Request 3.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 9 of 64
ALTOSONIC V
5 SUPPORTED FUNCTIONS
All data addresses in Modbus messages are referenced to zero. For example:
Coil 1 is addressed as Coil 0000.
Holding register 40001 is addressed as 0000. Note that the function code specifies the operation of
a ‘holding register’, therefore the 4xxxx reference is implicit.
When functions which do not support broadcast requests, are accessed with a broadcast address, the request will be rejected.
5.1 Function 01: READ COIL STATUS
Description
Function 1 reads the ON/OFF status of discrete inputs or discrete variables in the slave (0 x references called coils). Broadcast is not supported.
Query
The query specifies the starting coil and the quantity of coils to read. The maximum number of coils requested each request is limited to 2000.
Example
Here is an example of a request to read coils 20-56 from slave device 17:
--
Slave Address
11(h)
Function
01(h)
Response
--
Slave address
11(h)
Function
01(h)
The coil status in the response message is packed as one coil per bit of the data field. Status is indicated as 1= ON, 0= OFF. The LSB of the first data byte contains the coil addressed in the query. The other coils follow toward the high order end of this byte and from 'low order to high order' in subsequent bytes.
If the returned coil quantity is not a multiple of eight, the remaining bits in the final data byte will be padded with zeros (toward the high order end of the byte). The Byte Count field specifies the quantity of complete bytes of data.
The status of coils 27-20 is shown as the byte value CD hex, or binary 1100 1101. Coil 27 is the MSB of this byte, and coil 20 is the LSB. Left to right, the status of coils 27 through 20 is ON-ON-OFF-OFF-ON-ON-OFF-ON.
By convention, bits within a byte are shown with the MSB to the left, and the LSB to the right. Thus the coils in the first byte are '27 through 20', from left to right, The next byte has coils '35 through 28', left to right. As the bits are transmitted serially, they flow from LSB to MSB: 20…27, 28...35, and so on.
In the last data byte, the status of coils 56-52 is shown as the byte value 1B hex, or binary 0001 1011. Coil 56 is in the fourth bit position from the left, and coil 52 is the LSB of this byte. The status of coils 56 through 52 is ON-ON-OFF-ON-ON.
Byte count
05(h)
Starting address Number of points Header
Hi 00(h)
Coil 27-20 CD(h)
Low 13(h)
Coil 35-28 6B(h)
Hi 00(h)
Data Header
Coil 43-36 B2(h)
Low 25(h)
Coil 51-44 0E(h)
Error check
--
Coil 56-52 1B(h)
Error check
--
Trailer
--
Trailer
--
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 10 of 64
ALTOSONIC V
Note how the three remaining bits (toward the high order end) are zero-filled.
If the request is not applicable an exception response will be sent. See chapter 5.10 for exception responses.
5.2 Function 02: READ INPUT STATUS
In the UFP-V Modbus protocol, function 1 and 2 perform the same processing and are interchangeable.
5.3 Function 03: READ MULTIPLE HOLDING REGISTERS
Description
Function 3 reads the binary contents of holding registers (4X references) in the slave. Broadcast is not supported. The maximum number of registers at each request is limited to 125 registers, 125 integers, or 62 long integers or 62 floats or 31 doubles.
Query
The query message specifies the starting register and the quantity of registers to be read. Registers are addressed starting at zero. Registers 1-16 are addressed as 0-15.
Example
Here is an example of a request to read registers 40108-40110 from slave device 17:
--
Slave Address
11(h)
Function
03(h)
Starting address Number of points Header
Hi 00(h)
Low 6B(h)
Hi 00(h)
Low 03(h)
Error check
--
Trailer
--
Response
Reg. 40109 Hi 00(h)
Data Header
Reg. 40109 Low 00(h)
Reg. 40110 Hi 00(h)
Reg. 40110 Low 64(h)
Error check
--
Trailer
--
--
Slave address
11(h)
Funct.
03(h)
Byte count
06(h)
Reg. 40108 Hi 02(h)
Reg. 40108 Low 2B(h)
The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register the first byte contains the high order byte, the second the low order bits.
The contents of register 40108 are shown as the two byte values of 02 2B hex (555 decimal). The contents of register 40109 are 00 00 hex and of register 40110 00 64 hex (100 decimal).
If the request is not applicable an exception response will be sent. See chapter 5.10 for exception responses.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 11 of 64
ALTOSONIC V
5.4 Function 04: READ INPUT REGISTERS
In the UFP-V Modbus protocol, function 3 and 4 perform the same processing and are interchangeable.
5.5 Function 05: WRITE SINGLE COIL
Description
Function 5 forces a single coil to either ON or OFF (0x reference). When the address is a broadcast, all slaves will process the request.
Query
The query message specifies the coil reference to be forced. Coils are addressed starting at zero (coil 1 is addressed as zero).
The requested ON/OFF status is specified by a constant in the query data field. A value of FF 00 hex requests the coil to be ON. A value of 00 00 requests it to be OFF. All other values are illegal and do not affect the coil and generate an exception.
Example
Here is an example of a request to force coil 173 ON in slave device 17.
--
Slave Address
11(h)
Function
05(h)
Coil Address Data Header
Hi 00(h)
Low AC(h)
Hi FF(h)
Low 00(h)
Error Check
--
Trailer
--
The normal response is an echo of the query, returned after the coils state has been forced.
--
Slave Address
11(h)
Function
05(h)
Coil Address Data Header
Hi 00(h)
Low AC(h)
Hi FF(h)
Low 00(h)
Error Check
--
Trailer
--
If the request is not applicable an exception response will be sent. See chapter 5.10 for exception responses.
5.6 Function 06: WRITE SINGLE HOLDING REGISTER
Description
Function 6 pre-sets a value into a single holding register (4x reference). When the address is a broadcast, all slaves will process the request.
Query
The query specifies the register reference to be preset. Registers are starting at address zero. The requested value (preset) is specified in the query data field, which is a 16-bit value.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 12 of 64
ALTOSONIC V
Example
Here is an example of a request to preset register 40002 to 00 03 in slave 17.
--
Slave Address
11(h)
Function
06(h)
Register Address Data Header
Hi 00(h)
Low 01(h)
Hi 00(h)
Low 03(h)
Error Check
--
Trailer
--
Response
is an echo of the query, returned after the register contents have been pre-set.
--
Slave Address
11(h)
Function
06(h)
Register Address Data Header
Hi 00(h)
Low 01(h)
Hi 00(h)
Low 03(h)
Error Check
--
Trailer
--
If the request is not applicable an exception response will be sent. See chapter 5.10 for exception responses.
5.7 Function 8: DIAGNOSTICS
Description
Function 8 provides a test for checking the communication system between the master and the slave.
Query
The function uses a two-byte sub-function field in the query to define the test to be performed.
Header
--
Slave address 11(h)
Function 08(h)
Sub-function 00 00(h)
Data Hi+Lo A1B8 (h)
Error check
--
Trailer
--
Only sub-function 0 is supported, which response is to loop back the query data. Function 8 is only supported in slave mode.
5.8 Function 15: WRITE MULTIPLE COILS
Description
Function 15 forces each coil (0x reference) in a sequence of coils to either ON or OFF. When the address is a broadcast, all slaves will process the request.
Query
The query message specifies the coil reference to be forced. Coils are addressed starting at zero (coil 1 is addressed as 0).
Example
Here is an example of a request to force a series of coils starting at coil 20 in slave 17. The query data contents are two bytes CD 01 hex, the binary bits correspond to the coils in the following way:
Bit
Coil
1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 1
27 26 25 24 23 22 21 20 x x x x x x 29 28
X means don’t care and are made zero.
The first byte transmitted (CD) addressed coils 27…20, where by the least significant bit addresses the lowest coil (20) in this set.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 13 of 64
ALTOSONIC V
The next byte transmitted (01) addresses coils 29 and 28, with the least significant bit addressing the lowest coil (28) in this set. Unused bits in the last data byte should be left zero.
Request:
Header
--
Slave Address
11(h)
Function
0F(h)
Coil address
Hi 00(h)
Low 13(h)
Quantity Of points
Hi 00(h)
Byte counts
Low 0A(h) 02(h)
Force data
Hi CD(h)
Low 01(h) --
Error check
Trailer
--
Response
The normal response returns the slave address, function code, starting address, and quantity of coils forced.
Header
--
Slave Address
11(h)
Function
0F(h)
Coil Address Hi 00(h)
Low 13(h)
Quantity Of points Hi 00(h)
Low 0A(h)
Error check Trailer
--
--
If the request is not applicable an exception response will be sent. See chapter 5.10 for exception responses.
5.9 Function 16: WRITE MULTIPLE HOLDING REGISTERS
Description
Function 16 pre-sets values into a sequence of holding registers (4x reference). When the address is a broadcast, the function pre-sets the same register references in all attached slaves.
Query
The query message specifies the register references to be pre-set. Registers are addressed starting at zero (register 1 is addressed as 0).
Example
Here is an example of a request to pre-set two registers starting at 40002 to 00 0A end 01 02 hex, in slave device 17.
Header
--
Slave Addres s
11(h)
Funct.
10(h)
Starting address Hi 00(h)
Low 01(h)
Quantity Registers Hi 00(h)
Byte
counts Low 02(h) 04(h)
Hi 00(h)
Low 0A(h)
Data
Hi 01(h)
Low 02(h) --
Error check
Trailer
--
Response
The normal response returns the slave address, the function code, starting address, and quantity of registers pre-set.
Header
--
Slave Address
11(h)
Function
10(h)
Starting Address Hi 00(h)
Low 01(h)
Quantity Of points Hi 00(h)
Low 02(h)
Error check
--
Trailer
--
If the request is not applicable an exception response will be sent. See chapter 5.10 for exception responses.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 14 of 64
ALTOSONIC V
5.10 Exception Responses
Except for broadcast messages, a master device expects a normal response, when it sends a query to a slave device.
One of the four possible events can occur from the master’s query:
1. If the slave device receives the query without a communication error and can handle the query
normally, it returns a normal response.
2. If the slave does not receive the query due to a communication error, no response is returned. The
master program will eventually process a timeout condition for the query.
3. If the slave receives the query, but detects a communication error (parity, CRC, LRC), no response
is returned. The master program will eventually process a timeout condition for the query.
4. If the slave receives the query without a communication error, but cannot handle it, the slave will
return an exception response informing the master of the nature of the error.
The exception response message has two fields that differentiate it from a normal response: 1 the function code field; and 2 the data field.
Ad 1 Function Code Field
In a normal response the slave echoes the function code of the original query in the function code field of the response. All function codes have a most significant bit of 0. In an exception response the slave sets the most significant bit of the function code to 1. The master recognises the exception response by means of this bit and can examine the data field for the exception code.
Ad 2 Data field
In an exception response the slave returns an exception code in the data field. This defines the slave condition that caused the exception.
The exception response message:
Header Slave address Function Exception code Error check Trailer
Exception codes
Code Name Meaning
01 Illegal function The function code in the query is not an allowable action for the slave. 02 Illegal data address The data address received in the query is not an allowable address for the slave.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 15 of 64
ALTOSONIC V
6 HANDLING OF LARGE DATA TYPES
The standard Modbus specification does not explain how data types larger than 16 bits should be handled. The standard Modbus functions to modify holding registers are used for handling larger data types.
Function 03 (read multiple holding registers), function 06 (write single holding register), and function 16 (write multiple holding registers) are used to read or modify these data types.
In the UFP-V each register-area contains a data type.
In order to maintain compatibility with older systems, a parameter 5.2 MODBUS_MODICON_COMPAT controls how the registers are counted. In modicon compatible mode the data is counted as 16 bit registers. In not-modicon compatible mode the data is counted on the data type, so a float is one register!
Notice that function 6 in not-modicon compatible mode will also write one type of the accompanying data type!
The supported data types are:
Boolean
Integer (16 bit)
Long integer (32 bit)
Float (32 bit)
ASCII 8 characters (64 bit)
Double (64 bit)
ASCII 16 characters (128 bit)
The register ranges for each data type:
(default)
1,2,5,15 1000..2999 Boolean 1 1 3,4,6,16
3000..3999 Integer 1 1
5000..5999 Long integer 2 1
6000..6999 Double 4 1
7000..7999 Float 2 1
4000..4999 ASCII (8 char) 4 1 3,16, 65, 66
14000..14999 ASCII (16 char) 8 1
Notice that in modicon compatible mode each data type larger than 16 bits should be addressed as 16 bit registers. For instance the first float is located on address 7000/7001 the next float is located on address 7002/7003.
A double would be accessed by four 16-bit registers, so the first double 6000/6001/6002/6003 and the next double 6004/6005/6006/6007.
The data in the chapter 8.4 Modbus Mapping Assignments is printed as it should be accessed in not- modicon compatible mode and modicon compatible mode.
Data type
Number of registers to request for each data type Function Address
Modicon
compatible
Not Modicon compatible
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 16 of 64
ALTOSONIC V
6.1 Floating Point Representation
The exponent is biased by 127. The mantissa is 24 bits with the most significant bit 1 (not stored), 23 bit stored.
Biased exponent Mantissa 3 (high) Mantissa 2 Mantissa 1 (low) SEEE EEEE E MMM MMMM MMMM MMMM MMMM MMMM
6.2 Double Representation
The exponent is biased by 1023. The mantissa is 53 bits with the most significant bit 1 (not stored), 52 bits stored.
Biased exponent Exp+Mantissa Mantissa 6 Mantissa 5 SEEE EEEE EEEE MMMM MMMM MMMM MMMM MMMM
Mantissa 4 Mantissa 3 Mantissa 2 Mantissa 1 MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM
6.3 Transmit Sequence Integers are transmitted and stored with the most significant part first.
Example
Integer value 1790 decimal (6FE hexadecimal) is transmitted as:
First transmitted byte in data field Second transmitted byte in data field
06 FE
Long integers could be transmitted in two possible ways: Example
Long integer value 305419896 (12345678 hexadecimal) The transmit order in both modes:
Normal mode (1)
12h
Reversed mode (3)
56h
(2) 34h (4) 78h
(3) 56h (1) 12h
Floats could be transmitted in two ways:
Example:
The float number 4.125977 will give the IEEE representation.
S EXPONENT MANTISSA 0 1000 0001 (1) 000 0100 0000 1000 0000 0000
A biased exponent of 129 (81 hexadecimal) is exponent 2.
A positive sign
Mantissa = 4 + 1/8 + 1/1024. Note that the first bit is not stored!
(4) 78h (2) 34h
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 17 of 64
ALTOSONIC V
The transmit order in both modes:
IEEE (1)
40h
Normal mode (1)
40h
Reversed mode (3)
08h
(2) 84h (2) 84h (4) 00h
(3) 08h (3) 08h (1) 40h
(4) 00h (4) 00h (2) 84h
Doubles could be transmitted in two ways: Example
The double number 4.125000001862645 will give the IEEE representation.
S EXPONENT MANTISSA 0 100 0000 0001 (1)0000 1000 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000 0000
A biased exponent of 1025 (401 hexadecimal) is exp. 2
A positive sign
Mantissa = 4 + 1/8 + 1/536870912. Note that the first bit is not stored!
The transmit order in both modes:
IEEE (1)
40h
Normal mode (1)
40h
Reversed mode (3)
80h
(2) 10h (2) 10h (4) 00h
(3) 80h (3) 80h (1) 40h
(4) 00h (4) 00h (2) 10h
(5) 00h (5) 00h (7) 00h
(6) 20h (6) 20h (8) 00h
(7) 00h (7) 00h (5) 00h
(8) 00h (8) 00h (6) 20h
6.4 Maximum requested points
The maximum points in a single request depend on the type of data.
Data type Modicon compatible mode
(count on 16 bit registers)
Boolean 2000 2000 Integer 125 125 Long integer 124 62 Float 124 62 ASCII 124 62(8chars) 31(16 chars) Double 124 31
Not Modicon compatible mode (count on type)
How to set up a redundant system
Two or more UFP-V systems If one or more UFP-V systems are used with one host system, the host system must support Modbus master mode. The UFP-V will then operate in Modbus slave mode.
Two or more host systems As a result of operational safety, some applications require more than 1 host-system communicating with one UFP-V.
If the UFP-V is used in slave mode, only one host-master may be connected.
One solution is to use the UFP-V as a Modbus master. Now the data is sent to the first addressed host (first poll block), the second poll block sends the data to the next host. The data could be different, because the measured data is updated.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 18 of 64
ALTOSONIC V
Another solution is to send the data to the hosts by means of a broadcast. Now all host systems receive the same data.
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 19 of 64
ALTOSONIC V
7 SET-UP OF THE UFP-V MODBUS DRIVER
7.1 Driver Contents
The driver contains:
Standard Modbus protocol according to Modicon.
Simulation of Modbus Master and Slave mode.
ASCII-mode and RTU mode.
Half and full duplex communication layers supported.
Transmitter ON/OFF level select for half-duplex mode.
Seven or eight data bits, Even/Odd/No parity, 1 or 2 stop bits
Extended data type support.
Function 1, 2, 3, 4, 5, 6, 8,15,16 including exception generation.
7.2 Hardware set-up
To set up the Modbus communication first the hardware should be set-up.
The UFP is equipped with a RS485/RS422 Communication Card which provide 2 serial communication channels, the first channel CH1 is used for the communication with the UFC-V, please do not change anything here. The second channel CH2 is free for communication with host systems .
There are two generations of RS485 cards:
AX4285A formerly installed
PCL745s currently installed
ModBus Manual 0300 rev07 E 7.30855.35.00 Page 20 of 64
Loading...
+ 44 hidden pages