The VP550 supports a single RS485 (multidrop) serial port. The communication follows the Modbus®protocol‡, varied to allow single precision floating-point numbers to be represented in two consecutive registers as eight hexadecimal digits. The VP550 acts as a slave to a host computer. Up to 16 slaves, each identified by a unique address, may be connected on the same RS485 serial line.
A2.1 Serial settings
- The host computer is responsible for initiating all communications. The host computer should not poll more than once per second.
- The VP550 will normally adopt the correct protocol automatically. If necessary, however, the protocol can be set by navigating to SETUP > VP SETUP > SERIAL SETTINGS > Mode.
- The VP550 settings must match those of the slave viscometer.
- Communication parameters are set as follows:
baud rate | 9600 |
parity | EVEN |
slave address | range 1 - 16 (decimal) (≡ 0001 - 0010 hexadecimal) |
- The default slave address is 1. To view or modify the address, navigate to SETUP > VP SETUP > SERIAL SETTINGS > ADDR.
A2.1.1 Character format
- Required:
EVEN parity
8 data bits §
1 stop bit - With the exception of the end frame (see below), all characters are in the ASCII range 20* - FF*. See table left for a selection of ASCII codes.
A2.1.2 Message framing
- A Modbus® message is placed by the transmitting device into a frame that has a known beginning and ending point. Messages start with a colon character “:” (ASCII code 3A) and end with a “carriage return - line feed” (CR-LF) pair (ASCII codes 0D and 0A).
- Some PCs may require alternative start and stop characters.
- The error checking field contains two ASCII characters, which are the result of a Longitudinal Redundancy Check (LRC) calculation on the message contents exclusive of the beginning colon and the terminating CR-LF characters. The LRC is calculated by adding together successive bytes of the message, discarding any carries, and two’s complementing the result.
- All data addresses are referenced to zero, so registers 1 - 16 are addressed as 0000 - 0010 (hexadecimal).
- The VP550 supports both unsigned 16-bit scaled integers (recommended) and single-precision floating-point numbers. The corresponding data addresses are given in Sections A2.2.1 and A2.3.2 below.
- The VP550 tests the high-order digit of the requested data address to determine the format of the response message. So for example, if the data address is 0000 the VP550 reply will represent the data registers in 16-bit scaled integer format, while if the data address is 1000 the reply will represent the data registers in floating-point format.
- The maximum register count is 16 for 16-bit scaled integers and 8 for
floating-point data.
A2.2 16-bit scaled integers
A2.2.1 Data address map
- Input registers for unsigned 16-bit scaled integers are mapped as follows:
*Alarms are mapped into a floating-point register, but must be decoded as a converted integer where
bit:
0 = instrument restarted
1 = e² fail
2 = frequency (2) fail 3 = frequency (3) fail
4 = PRT read fail
5 = PRT data error
6 = CALCULATION fail
A2.2.2 Scaling factors
- For 16-bit scaled integers, the VP550 scales the registers using user-definable or preset scaling factors. Input register scaling factors are:
Note: The above viscosity and temperature scales are factory default values. These will be overridden by the corresponding user-defined 4-20mA output limits (Section 3.3.6).
- The contents of a register are calculated using the formula
where P is the actual value of the selected parameter.
For example:
If averaged live viscosity (VL) = 200 cP, DAC-1 lo scale (4 mA) is set to 0 and
hi scale (20 mA) is set to 1000:
- The maximum number of registers that can be requested in this format is 16.
A2.3 Floating-point numbers
A2.3.1 Format of floating-point numbers
• Any number n can be represented as a “floating-point number” by analysing it into a base number (also called “radix”) b, an exponent e and a mantissa m, such that
n = be × m,
• A binary floating-point number has b = 2. Then for example, the floating-point representation of 16 would be
16 = 24 × 1.0
- The Institute of Electrical and Electronics Engineers (IEEE) has produced a standard for floating-point arithmetic. This standard specifies how single-precision (32-bit) and double-precision (64-bit) binary floating-point numbers are to be represented, as well as how arithmetic should be carried out on them. The full title of the standard is IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985), also known as IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems.
- The VP550 uses single-precision (32-bit) floating-point numbers.
- The IEEE single-precision floating-point standard representation requires a 32-bit word. The first bit is the sign bit, S, the next eight bits are the exponent bits, E, and the final 23 bits are the mantissa M:
- Note that the least significant bits are to the left. S is 0 if the number is positive, 1 if it is negative.
- The exponent is biased by 2(8−1) − 1 = 27 − 1 = 127. Biasing is done because exponents have to be signed values in order to be able to represent both tiny and huge values, but two’s complement, the usual representation for signed values, would make comparison harder. To solve this the exponent is biased before being stored, by adjusting its value to put it within an unsigned range suitable for comparison.
- The most significant bit of the mantissa is determined by the value of exponent. If 0 < exponent < 127, the most significant bit of the mantissa is 1, and the number is said to be “normalized”. If the exponent is 0, the most significant bit of the mantissa is 0 and the number is said to be “denormalised” or “unnormalised”. Three special cases arise:
(1) if exponent is 0 and mantissa is 0, the number is ±0 (depending on the sign bit),
(2) if exponent = 127 and mantissa is 0, the number is ± ∞ (again depending on the sign bit), and
(3) if exponent = 127 and mantissa is not 0, the entity being represented is not a number (“NaN”).
I.e.
0 00000000 00000000000000000000000 = 0
1 00000000 00000000000000000000000 = –0
0 11111111 00000000000000000000000 = ∞
1 11111111 00000000000000000000000 = – ∞
0 11111111 00000100000000000000000 = NaN
1 11111111 00100010001001010101010 = NaN
Example
- To encode the decimal number −118.625 using the IEEE 754 system:
(1) Because it is a negative number, the sign S is 1.
(2) Write the number (without the sign) using binary notation. The result is 1110110.101.
(3) Move the point leftwards until there is only one digit to its left: 1110110.101 = 1.110110101 × 26. This is a normalised floating-point number.
(4) The mantissa is the part to the right of the point. This must be filled with trailing 0s to the right to make it up to 23 bits, giving 11011010100000000000000.
(5) The exponent is 6. The bias is 127, so the exponent becomes 6 + 127 = 133. In binary, this is written as 10000101.
A2.3.2 Data address map (floating-point numbers)
- Input registers for single-precision floating point numbers are mapped as follows:
*Alarms are mapped into a floating-point register, but must be decoded as a converted integer where bit
0 = instrument restarted
1 = e² fail
2 = frequency (2) fail
3 = frequency (3) fail
4 = PRT read fail
5 = PRT data error
6 = CALCULATION fail
- The maximum number of registers that can be requested in this format is 8.
A2.4 Query-response overview
A2.4.1 Query-response format
- The general format for a query issued by the host computer is:
- The general format for the VP550 response is:
A2.4.2 Examples of query-response messages
(1) Unsigned 16-bit scaled integer format
Request to read four input registers (function code 04) from slave address 01, starting at data address 0000:
(i) bytes
1a. Poll (Tx)
3A 30 31 30 34 30 30 30 30 30 30 30 34 46 37 0D 0A
1b. Response (Rx)
3A 30 31 30 34 30 38 30 30 37 39 30 30 37 39 30 30 37 42
30 30 37 42 30 42 0D 0A
(iii) characters as shown on screen
1a. Tx
:010400000004F7
1b. Rx
:01040800790079007B007B0B
In this example, actual values are:
VL (“live” viscosity): 1.84634
4 mA (lo scale): 0
20 mA (hi scale): 1000
hence
register content = = 121 (dec.) ≡ 79 (hex.)
(2) Floating-point format
Request to read two input registers from slave address 01, starting at data address 1000:
(i) bytes
2a. Poll (Tx)
3A 30 31 30 34 30 30 30 30 30 30 30 34 46 37 0D 0A
2b. Response (Rx)
3A 30 31 30 34 30 38 30 30 37 39 30 30 37 39 30 30 37 42
30 30 37 42 30 42 0D 0A
(iii) characters as shown on screen
2a. Tx
:010410000002E90
2b. Rx
:010408432DE6DF432DE6DF89
- In this example, the actual value of VL (“live” viscosity) is 173.90184.
Hence the IEEE 32-bit floating point representation will be
0 10000110 01011011110011011011111 (binary)
= +432DE6DF (hexadecimal).