Smartair Master Intelligent Interconnected Control: Programmer Guide Modbus-Rtu
Smartair Master Intelligent Interconnected Control: Programmer Guide Modbus-Rtu
4.1 Addresses for function code ”03h” / READ HOLDING REGISTERS ............................................................... 12
4.2 Addresses for function code ”10h” / WRITE MULTIPLE REGISTERS ............................................................ 29
3
1. General ModBus specifications
If you already know how the MODBUS RTU protocol works regarding
Node-Adress
Function code
Message Data Start Adress
Message Data
CRC Checksum
you can skip direct to chapter "3. General information SmartAir Master".
Otherwise please read the following MODBUS informations first.
1.3 General
The MODBUS is a protocol of master-slave type. Only one master can be used in a network: It polls individual
slaves as designated in the program. The slaves answer received calls according to the protocol.
ModBus exists in two modes: ASCII and RTU (Remote Terminal Unit). All devices on a MODBUS network must
working in the same mode.
The ModBus-RTU mode is to provide a flexible way of industrial machine controllers with low memory, low
processor capacities and with less density on the communication network.
MODBUS is independent of the underlying physical layer. It is traditionally implemented using RS232, RS422, or
RS485 over a variety of media (fiber, radio,…). We recommend the use of the RS485 industry standard in master-
slave or a network supporting up to 32 nodes.
The controller(s) will always be the slave(s) in the communication link. An appropriate master running ModBus
protocol in RTU mode should be used.
ModBus-RTU runs in asynchronous serial data format. The baudrate of the SmartAir interface can be adjusted in
range of 2400 .. 38400 baud.
1 start bit
8 data bits
1 stop bit
4
1. General ModBus specifications
General
The bytes of the ModBus-RTU message must be send in one message. The RTU mode allows only a maximum
pause of 1.5 byte-times in-between 2 bytes.
Basic Format
Attention !
L- and HBytes in the CRC are reversed in comparison with the other words.
Function code
The function code defines the slave operation requested – to read input values and send them to master or write
the data in registers etc. Although several types of function codes are defined by ModBus. We only handle the
function codes working with registers. These are:
Any other function codes request generates the ILLEGAL FUNCTION exception response.
The message data start address word designates the initial address from which the data is going to be processed.
The hi-byte comes before the lo-byte.
5
1. General ModBus specifications
Message Data
The Cyclical Redundancy Check (CRC) field is two bytes, containing a 16-bit binary value. The CRC value is
calculated by the transmitting device, which appends the CRC to the message. The receiving device recalculates
a CRC during receipt of the message, and compares the calculated value to the actual value it received in the
CRC field. If the two values are not equal, an error results. The CRC is started by first preloading a 16-bit register
to all 1's. Then a process begins of applying successive eight-bit bytes of the message to the current contents of
the register. Only the eight bits of data in each character are used for generating the CRC. Start and stop bits,
and the parity bit, do not apply to the CRC.
During generation of the CRC, each eight-bit character is exclusive ORed with the register contents. The result is
shifted in the direction of the least significant bit (LSB), with a zero filled into the most significant bit (MSB)
position. The LSB is extracted and examined. If the LSB was a 1, the register is then exclusive ORed with a
preset, fixed value. If the LSB was a 0, no exclusive OR takes place. This process is repeated until eight shifts
have been performed. After the last (eighth) shift, the next eight-bit character is exclusive ORed with the register's
current value, and the process repeats for eight more shifts as described above. The final contents of the register,
after all the characters of the message have been applied, is the CRC value.
Generating a CRC:
Step 1 Load a 16-bit register with FFFF hex (all 1's). Call this the CRC register.
Step 2 Exclusive OR the first eight-bit byte of the message with the low order byte of the 16-bit CRC register,
putting the result in the CRC register.
Step 3 Store the LSB and shift the CRC register one bit to the right (toward the LSB), zerofilling the MSB.
Extract and examine the stored LSB.
Step 4 If the LSB is 0, repeat Step 3 (another shift). If the LSB is 1, Exclusive OR the CRC register with the
polynomial value A001 hex (1010 0000 0000 0001).
Step 5 Repeat Steps 3 and 4 until eight shifts have been performed. When this is done, a complete eight-bit
byte will have been processed.
Step 6 Repeat Steps 2 ... 5 for the next eight-bit byte of the message. Continue doing this until all bytes have
been processed.
Result: The final content of the CRC register is the CRC value.
Step 7 When the CRC is placed into the message, its upper and lower bytes must be swapped as described
below.
Note:
This discriptions above how to generate the CRC is an original text found at the ModBus-Organisation pages. We
found this discription is not clear. We added the underlined text and deleted some words.
6
1. General ModBus specifications
The slave does not need to answer immediately, it depends on the masters 'slave response timeout' setting.
Typical less than 200ms are foreseen.
If the slave device did not receive a valid message due to a communication error (parity or CRC failure), no
response is returned, and the master will eventually process a timeout condition.
General
The address and function code fields are identical with the called ones. The message answer data depends on
the requested function code. The CRC checksum is calculated as the message one.
This is identical as the message one on a valid received message for the unit; otherwise an exception function
code response could be generated.
The exception code response message has two fields that differentiate it from a normal response:
7
1. General ModBus specifications
Answer Data
The answer data message consists of one byte indicating how many bytes will follow, and an even pair of the
bytes with the contents of the requested register.
This is at least 3 bytes answer data: 1byte for bytecount and at least 2 bytes data packed as two bytes per
register. For each register, the first byte contains the high order bits and the second contains the low order bits.
The normal response returns the slave address, function code, starting address, and quantity of registers preset.
This is 4 bytes: 2 for address, 2 for the quantity.
Problem:
No or bad response on the ModBus message
Solution:
Check if the controller is set to the correct slave address
Check if the controller is set to the correct baudrate
Check if the controller is properly set for ModBus RTU protocol
Check if the master is working in ModBus RTU mode
Check the settings of the baudrate, paritybit and number of stopbits
Check RS485 wiring, polarity…
Problem:
Last character of ModBus message is corrupted
Solution:
Check all items mentioned above
Add a delay of 1 or 2ms after last character before releasing RTS signal
Problem:
The ModBus message is reflected in the answer
Solution:
You should use a network without echo of the TX to the RX line and vice versa
8
2. CompAir terminal program
You will find in the ModBus-Package a terminal program to test the communication to any serial device.
If port opened you can input hexadezimal numbers into Send field.
Press TxD -> Slave to send the datas. See in the status line transmitted (TxD) and received (RxD) bytes showing
the number of bytes also.
Add to list Copies the marked bytes in Send field + comments for later use into memo field.
Copy selection Copies the marked bytes + comment from memo field into Send field.
Repeat TxD Start polling with desired cycle [ms]
9
3. General information SmartAir Master
10
3. General information SmartAir Master
The values for protocol, baudrate and address of the RS485-3 interface of the SmartAir Master are to find in the
menu "Adjustments SmartAir Master" – submenu "RS485 interface".
See user manual how to navigate through the menus and how to adjust values in the menues.
Baudrate: 9600 Adjustable range: 2400 / 4800 / 9600 / 19200 / 38400 Baud
Address 10h Adjustable range: 10h / 20h / .. / F0h
Character Frame:
1 start bit
8 data bits
1 stop bit
11
4. ModBus addresses SmartAir Master
Explanations:
1= Regulation switched on
The regulation of the SmartAir Master is switched on.
Bit 1 Collective signal of all warnings, that could be indicate in the installation.
Bit 2 Collective signal of all faults, that could be indicate in the installation.
Causes:
• The regulation of the SmartAir Master is switched off (Bit 0 = 0)
• A fault of the SmartAir Master is active (e.g. fault of the pressure sensor)
1= Regulation active
The regulation of the SmartAir Master is switched on and active.
12
4. ModBus addresses SmartAir Master
The warnings "Dew point 1..8" (see Warning and fault registers (Address range 2))
will be caused by an analog input of the SmartAir Master or an Extension module.
13
4. ModBus addresses SmartAir Master
Futher warning and fault registers see "SmartAir Master warning and fault registers (Address range 2)"
from register 00D6h.
14
4. ModBus addresses SmartAir Master
Explanations:
Line pressure 1: Line pressure at the analog input AI-1 of the SmartAir Master
Line pressure 2: Line pressure at the analog input AI-2 of the SmartAir Master
Volume flow: The volume flow which is used to regulate the compressors.
This could be assigned to of the volume flow 1..8
or could be calculated on the basis of the line pressure gradient.
1 = Compressor is loaded
2 = Compressor is running
3 = Compressor is blowing down
4 = Compressor is in standby
5 = Compressor is switched off
6 = Compressor has a fault
7 = Compressor is set to maintenance
8 = The communication to the compressor has a fault
9 = Software update necessary
15
4. ModBus addresses SmartAir Master
Explanations:
16
4. ModBus addresses SmartAir Master
Current profile
17
4. ModBus addresses SmartAir Master
Explanations:
These are the total and loaded hours since a user-specified time.
Thus it can be seen as the time since this newly added operating hours of the SmartAir Master to individual
compressors have been distributed.
The relative hours can be reseted at the panel of the SmartAir Master or by the ModBus communication
(see chapter 3.6).
18
4. ModBus addresses SmartAir Master
Explanations:
These are the total and loaded hours as they are listed in the compressor controls.
19
4. ModBus addresses SmartAir Master
Statistics
The statistics can be reseted at the panel of the SmartAir Master or by the ModBus communication
(see chapter 3.6).
Compressor informations
20
4. ModBus addresses SmartAir Master
21
4. ModBus addresses SmartAir Master
Menu "Regulation"
Bit 0: Monday
Bit 1: Tuesday
Bit 2: Wednesday
Bit 3: Thursday
Bit 4: Friday
Bit 5: Saturday
Bit 6: Sunday
Bit 7: (not used)
00B5h..00B7h Channel 2
00B8h..00BAh Channel 3
00BBh..00BDh Channel 4
00BEh..00C0h Channel 5
00C1h..00C3h Channel 6
00C4h..00C6h Channel 7
00C7h..00C9h Channel 8
00CAh..00CCh Channel 9
00CDh..00CFh Channel 10
00D0h..00D2h Channel 11
00D3h..00D5h Channel 12
22
4. ModBus addresses SmartAir Master
23
4. ModBus addresses SmartAir Master
24
4. ModBus addresses SmartAir Master
Explanations:
Warning Sensor:
The failure of the sensor has not caused a deactivation of the regulation of the compressors by the SmartAir
Master, i.e. the compressors will continue to be regualted by the SmartAir Master.
Fault Sensor:
The failure of the sensor has caused a deactivation of the regulation of the compressors by the SmartAir
Master, i.e. the compressors will run with their internal settings.
25
4. ModBus addresses SmartAir Master
Menu "Profiles"
Register: 00E0h Bit 0-7: Profile 1: Max. pressure ( 1/10 bar ) [Byte]
Bit 8-15: Profile 1: Max. pressure warning ( 1/10 bar ) [Byte]
00E1h Bit 0-7: Profile 1: Min. pressure warning ( 1/10 bar ) [Byte]
Bit 8-15: Profile 1: Min. pressure ( 1/10 bar ) [Byte]
00E6h..00EBh Profile 2
00ECh..00F1h Profile 3
00F2h..00F7h Profile 4
00F8h..00FBh Profile 5
00FCh..0103h Profile 6
0104h..0109h Profile 7
010Ah..010Fh Profile 8
0110h..0115h Profile 9
0116h..011Bh Profile 10
011Ch..0121h Profile 11
0122h..0127h Profile 12
26
4. ModBus addresses SmartAir Master
27
4. ModBus addresses SmartAir Master
Compressor 1
Is a compressor in status
Maintenance
Fault communication
Software update necessary
28
4. ModBus addresses SmartAir Master
Activate profile
Reset datas
Attention !
After reset with command "F000h", this register has to be reset
to the value "0000h".
Attention !
After reset with command "F000h", this register has to be reset
to the value "0000h".
Attention !
After reset with command "F000h", this register has to be reset
to the value "0000h".
29
4. ModBus addresses SmartAir Master
4.3 Examples
Request: 10 03 00 06 00 01 [CRC]
| | | | |
| | | | CRC checksum
| | | |
| | | Number registers to read
| | |
| | Register address
| |
| Function code
|
Slave address
Answer: 10 03 02 00 79 [CRC]
| |
Message data = 79h = 121 = 12,1bar
Activate profile #2
Request: 10 10 00 00 00 01 02 00 03 [CRC]
| | | | | | |
| | | | | | CRC checksum
| | | | | |
| | | | | Profile to activate
| | | | |
| | | | Number bytes to write
| | | |
| | | Number registers to write
| | |
| | Register address
| |
| Function code
|
Slave address
Answer: 10 10 00 00 00 01 [CRC]
| |
| Numbers of registers written
|
Register address
30
Gardner Denver Deutschland GmbH
Argenthaler Str. 11
55459 Simmern
Deutschland
www.compair.com
e-mail: [email protected]
31