Modbus Constructor

advertisement
Modbus Constructor
Quick start Guide
© 2006 by KurySoft, all rights reserved
Web: www.kurysoft.com
Date: 24-Oct-2006
ModBus Constructor
Table of Contents
1. Introduction........................................................................................................ 3
2. Creating a Modbus Device Description ............................................................. 4
2.1
Coriolis Mass Flow Meter..................................................................................... 4
T1. Mass Flow Metter Holding Registers .............................................................................. 4
T2. Mass Flow Meter Coils ................................................................................................... 6
T3. Mass Flow Metter Command .......................................................................................... 6
T4. Mass Flow Metter Exception Responses........................................................................ 6
2.2
Key Parameters Descriptions............................................................................... 7
2.3
Arranging Data Fields Inside the Form Window ................................................ 13
2.4
Adding Requests................................................................................................ 14
2.5
Simulator Parameters ........................................................................................ 19
T5. Discrete value simulation.............................................................................................. 19
T6. Analogous value simulation. ......................................................................................... 20
3. Using Modbus Device...................................................................................... 21
4. Terms And Definitions ..................................................................................... 23
4.1
Objects ............................................................................................................... 23
4.2
Modbus Constructor Data Types ....................................................................... 23
4.3
Data Encoding.................................................................................................... 24
Long.................................................................................................................................... 24
Float.................................................................................................................................... 24
Double ................................................................................................................................ 24
4.4
Modbus Functions Application Rules ................................................................. 25
4.5
Format examples ............................................................................................... 25
5. Contact Information ......................................................................................... 27
Quick Start Guide
-2-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
1.
Introduction
Thank you for using Modbus Constructor!
Modbus Constructor was created to help developers, programmers and users in testing
and setting up their Modbus devices.
Modbus Constructor allows to quickly create a data management model for any of your
Modbus devices. There are similar programs on the market all of which, however, display data
as columns of abstract numbers of the same type. This makes them hard to read and analyze,
especially if your device uses randomly arranged data of various types.
In Modbus Constructor you can work with any of the key data types: integer, long (integer),
float, double (float), or byte for any individual register or a set of registers. Integer types may be
represented as signed, unsigned, HEX or binary. The same register can be represented in
various ways. For example, if there are two adjacent registers that contain long numbers, each
of these registers can be given additional data fields in which their content will be represented
as HEX or unsigned integer.
Data fields corresponding to your data elements (registers or discreet elements) can be
arranged to your liking inside the project form window. You can specify size, color, font and
caption for each field. The discreet elements occupying a continuous addresses domain can
share the same field, which makes them easier to read and saves time.
In Modbus Constructor you can setup any register data field to perform a linear
transformation to convert the internal units into conventional or alternative units of any system.
For example, if a register contains pressure in milliamperes, i.e. the device receives data from a
pressure detector equipped with a current output, the resulting value can be converted to
kgf/cm2 or lb/in2.
Modbus Constructor supports automatic requests for all supported functions (01, 02, 03,
04, 05, 06, 15, 16, 22, 23) with individual periods for each one.
You can setup requests to be executed via menus and/or dialogs, whichever preferred.
This is a convenient way of setting up control commands, changing parameters and test
requests. Any project may be used for querying a device in Master mode or simulating it in
Slave mode. For the Slave mode you may additionally include a data modification procedure
operating according to this or that rule.
In Modbus Constructor your project can be further enhanced with additional captions,
frames and images.
Modbus Constructor comes with a special utility, Modbus Reader, which operates using
the model created with Modbus Constructor to interact with your device. Modbus Reader is a
freeware program. If you have already created a Modbus Constructor project for the device you
designed, your clients will not have to purchase Modbus Constructor – it is enough to download
a freeware Modbus Reader.
Modbus Reader can run several projects at once, i.e. query or simulate several devices
using one or more COM-ports. In addition to the requests specified in your project, you can
modify any of your device's data elements by simply clicking on any associated data field,
whether in Master (by sending an appropriate request) or Slave mode.
Quick Start Guide
-3-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
2.
Creating a Modbus Device Description
In this section you will go through the steps of creating a project, with Coriolis mass flow
meter as an example:
ƒ
you will learn how to describe the device's holding registers and coils
ƒ
convert data into standard units
ƒ
use data formatting feature
ƒ
arrange data fields within the form
ƒ
define automatic and menu controlled requests (commands)
ƒ
specify parameters for simulator Slave mode
2.1 Coriolis Mass Flow Meter
Let's study the design of our device. The unit is used for measuring the mass of liquids or
gasses that are channeled though it. It can be operated both at direct and reverse flow.
At direct flow the mass flow meter counts forward, at reverse flow it counts backward and
may show negative readings.
As an extra option, the device can be operated as a dose-meter. It is equipped with two
discrete outputs (open collector) for controlling either valve or motor at direct or reverse flow.
The portion is set by the user. If a positive portion value is set, the direct flow is activated, if
negative, the reverse flow is activated.
The system uses a RS-485 Modbus RTU protocol.
Run Modbus Constructor: Start ⇒ Programs ⇒ ModbusConstructor ⇒ MBConstructor.exe
Create a new project: File⇒New
Save your project to a file titled Coriolis.mbc: File⇒Save as…
Lets analyze the mechanism of the mass flow meter's Modbus communications protocol.
In Table T1 there is a description of the unit's holding registers.
T1. Mass Flow Metter Holding Registers
Function
Address (decimal)
Data Type
Notes
Device type
0000
unsigned integer
Read-only
Firmware version
0001
unsigned integer
Read-only
Modbus address
0002
unsigned integer
Factory setting 1
Either 4800, 9600, or 19200 bod
Data transfer speed
0003
unsigned integer
Factory setting 9600
When writing any value other than 4800,
9600, or 19200 takes on a value of 9600
0-no parity
Parity
0004
byte (MSB)
1-odd parity
2-even parity
Factory setting 2 (even)
Quick Start Guide
-4-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Function
Address (decimal)
Data Type
Stop bit
0004
byte (LSB)
Portion
0005
long (1)
Notes
0 – 1 stop bit
2 – two stop bits
(3) One unit equals 0.1 kg
One unit equals 0.1 kg, can be negative
Mass counter
0007
long (1)
While reading displays accumulated mass
after meter reset
One unit equals 0.1 kg/min
Mass flow
0009
integer
Positive with direct flow
Negative with reverse flow
Density
0010
unsigned integer
One unit equals 1000/32768 kg/m3
Temperature
0011
integer
One unit equals 250/511 ºC
Overpressure detector signal 4-20 mA
Pressure
0012
unsigned integer
1023 corresponds to 20 mA (40 kgf/cm2)
205 corresponds to 4 мА (0 kgf/cm2)
Measuring time
0013
unsigned long (1)
seconds
Check register
0015
unsigned integer
(2)
Mass per single pulse
0016
unsigned integer
One unit equals 0.1 kg
Calibration factors
0017-0024
Available for recording with jumper J7
installed
Reserve
0025-0031
not used in current version
(1) Long integers are placed in holding registers in the following manner: the upper word occupies the first
register, the lower word occupies the second register.
For example, the number 01020304h (16909060 decimal) shall be placed as follows:
register A+0: 0102h
register A+1: 0304h
transferred: 01 02 03 04
(2) While reading, displays operating mode:
0 – measure mode (default)
1 – dose-meter inactive mode. Both valves are closed.
2 – dose-meter active mode. One of the valves is open, a portion is being measured.
While writing, performs the following actions:
0 – switches into measure mode from dose-meter inactive mode. Ignored if dose-meter is in active mode.
1 – when in measure mode, switches to dose-meter inactive mode, resets mass and time meters, closes
both valves.
When in dose-meter active mode, switches to inactive mode.
2 – starts measuring a portion in accordance with register 5 value (portion size)
4 – resets mass and time meters (counters) (only in modes 0 and 1)
8 – performs zero flow value adjustment (only in modes 0 and 1)
(3) used to store portion size value when in dose-meter mode.
Quick Start Guide
-5-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Table T2 represents a description of the unit's coils.
T2. Mass Flow Meter Coils
Function
Address (decimal)
Data Type
Notes
Read-only in dose-meter mode
Direct flow control output
0000
1-valve open
0-valve closed
Read-only in dose-meter mode
Reverse flow control
output
0001
1-valve open
0-valve closed
Reserve
0002-0031
not used in current version
Mass flow meter supports the following commands and exceptions:
T3. Mass Flow Metter Command
Function code
Command type
Name
01
Read
Read coil status
03
Read
Read holding registers
05
Write
Write single coil
06
Write
Write single register
15
Write
Write multiple coils
16
Write
Write multiple registers
T4. Mass Flow Metter Exception Responses
Code
Name
Description
01
Illegal function
Function code not supported.
02
Illegal data address
The data address in the request is not an allowable address for the
device.
03
Illegal data value
A value contained in the request data field is not an allowable value for
the device.
Quick Start Guide
-6-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
2.2 Key Parameters Descriptions
Add descriptions for registers and coils of your mass flow meter. In the Settings menu
select Objects: Settings ⇒ Objects
The program will display a form which is much like an electronic spreadsheet. In the
Object column highlight fifteen cells (as many as there are registers of the mass flow meter).
Right-click inside the highlighted area to view a drop-down menu showing all types of objects
used. Click Holding register.
Quick Start Guide
-7-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Now it's time to give each register its address and title according to the description.
ƒ
left-double-click on the topmost empty cell in the Label column
ƒ
enter register name: "Device type"
ƒ
left-double-click on the adjacent cell in the Address column, enter "0"
ƒ
enter names and addresses for other elements.
The numbers (long, float and double) that are represented using several registers may
reside inside the registers and, therefore, have different representations. Equipment
manufacturers normally make explicit indications as to how these numbers are represented. To
learn how the numbers are stored inside registers refer to the "Data Encoding" section.
The description suggests that our device uses different data types. Specify the required
types.
ƒ
right-click inside the Data column and select a desired item from drop-down menu
ƒ
if necessary, set Unsigned in the Show column.
Quick Start Guide
-8-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
We have specified kilograms (kg) for units of mass, but the mass counter's unit equals 0.1
kg, doesn't it? Modbus Constructor has a special mechanism to overcome such problems. If
expression Ax+B is entered in column Scale, the number held in the corresponding register or a
group of registers (if it is a complex number of type long, float, or double) will be subject to a
liner transformation. This is very convenient if you prefer to use units other than those supported
by the device.
Enter expression "0.1x+0" in the Scale column for holding registers 5, 7, 9, and 15. Now
the mass flow meter's internal units are turned to kilograms.
Density can be transformed in much the same way:
D = x * 1000 / 32768 = 0.03052x
And temperature, too: T = x * 250 / 511 = 0.489x
Quick Start Guide
-9-
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Pressure is somewhat more difficult, it requires an equation:
Pressure P = Ax + B
x1 = 205,
P1 = 0
⇒
B = - 205 * A
x2 = 1023,
P2 = 40
⇒
40 = A*1023 + 205*B
A = 40/(1023 - 205) = 0.049
B = -205*A=-205*0.049 = -10.045
You see, it is not at all difficult to convert values into units that look familiar. But what about
time? For short intervals seconds are good enough, but when the measurement involves
hundreds and thousands of seconds, they begin to get in the way. To solve this problem we
apply formatting.
Data formatting is used:
ƒ
to get better readable numbers
ƒ
to avoid numbers overcrowding the output field
Each data type has been assigned a format by default. You do not have to specify the
default format yourself if you are happy with what is already there, just leave the field blank. Use
the default format to create your own format. More information on the rules of formatting can be
found in the Format examples section.
Right-click on the Portion, kg line inside the Format column.
Select Default. The field will display a string "## ###".
The mass flow meter measures mass and mass flow with accuracy 0.1 kg and 0.1 kg/min
respectively. If the default format is left intact, we shall not see the fractional parts of the
numbers. To display them, ".0" should be added to the string. We get:
"# ### ### ##0.0" for mass and portion measured
"## ##0.0" for flow rate
Quick Start Guide
- 10 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Since the pressure detector's analog-to-digital converter delivers resolution 0.05 kg/cm2, it
makes sense to have two digits after the decimal point:
"## ##0.00"
Enter "10" in the Default value field for register "Pressure, kgs/cm2".
Click Enter. The value will be displayed in the format "10.00".
Leave temperature and density as integers.
Setup a two-mode time display. Let the first mode remain in seconds and use "hh:mm:ss"
formatting for the second mode to display time in the "hours : minutes : seconds" format.
double-click inside an empty field in the Object column
select Holding register
double-click in the same line in the Data column
select type Long
select the Unsigned attribute in the Show column
enter "Time, hh:mm:ss" in the Label field
in the address field, enter "13"
enter "hh:mm:ss" in the Format field
in the Default value field, enter "1000" (time in seconds)
click on Address column header to have holding registers sorted in ascending
order
1000 seconds will now be displayed as "00:16:40"
Quick Start Guide
- 11 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Finally, add coils descriptions:
using your mouse, highlight two empty cells in the Object column
right-click inside the highlighted area
select Coils in the drop-down menu
title one of the coils "direct flow", assign "0" for address
title the other coil "reverse flow", assign "1" for address
You have now added descriptions for all the key properties of the mass flow meter's
objects. Press "OK".
Save your project: File⇒Save.
Quick Start Guide
- 12 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
2.3 Arranging Data Fields Inside the Form Window
In the upper right-hand corner of the form window you will find data fields and tags of the
objects we have created. Left-click inside any white field to have it highlighted in dark blue. Leftclick inside the highlighted field and move it aside while holding down the mouse button. For
multiple selections, press and hold Ctrl while clicking on as many objects as you need.
Continue in the same manner to arrange the other fields until all the tags are in sight.
Please note that when a field is moved its tag follows it to a new location, but when the tag is
moved, the field stays behind.
Highlight the "Mass counter, kg" tag. Stretch the tag out by pulling its left side to make it fit
a single line. Do the same with the other tags.
For better readability, separate the fields of the parameters to be tested from all the other
fields. Start with the upper left-hand corner of the form.
To visually isolate groups of fields use frames. Right-click inside the form. From the
context menu select Add ⇒ Frame. Change frame position and size to fit it around the group of
fields.
Follow the same steps to arrange the fields pertaining to controls and communication
parameters.
Quick Start Guide
- 13 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Press Ctrl+S to save your project.
2.4 Adding Requests
For remote devices to deliver data and perform their actions, Modbus protocol uses
standard requests. In Modbus Constructor requests are processed in one of three ways:
automatically
via menu
via dialog
Open the requests setup window: Settings⇒Requests.
At the bottom of the window there is a table which contains all the elements of the data
structure. At the top there is a table for the parameters of the requests.
First let's create automatic requests to read the content of our device's registers and coils.
double-click inside an empty cell in the Function column
from the pop-up menu select 03.Read holding registers. The program will add
a line with default request settings
click once more on the new line
in the Address column of the bottom table highlight all the cells to do with
registers
right-click inside the highlighted area
Quick Start Guide
- 14 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
from the pop-up menu select Apply
Do the same for the coils. Use the function 01.Read coils.
You can change the minimum period of the request. To do so, double-click the appropriate
cell in the Min.period, ms column. Enter 300 milliseconds for both requests.
Please note that this parameter defines the least possible period for querying data
specified by the request. This period may get longer because of the time required for processing
other requests. Set this parameter to 0 to make the request period as short as possible.
To effectively control the mass counter you need to input commands. A command is
specified by entering a certain value into the check register with address 15.
create a request "06.Write single register"
in the column Write address of the bottom table highlight a cell whose address
is 15 (control register)
right-click inside the cell
in the pop-up menu click Apply
double-click inside a cell in the Write column
enter "0" – this is the value to be written into the control register when the
command is executed
in the Label column of the top table enter the name of your command:
"Measure mode". This name will appear as an item of the user menu.
double-click inside a cell in the Control column
Quick Start Guide
- 15 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
select Menu 1 from the pop-up menu
follow the same procedure to create commands:
"Dose-meter mode" (value 1)
"Measure portion" (value 2)
"Counters reset" (value 4)
"Zero adjustment" (value 8)
Create commands to control valves:
create a request "15.Write multiple coils"
in the Write address column of the bottom table highlight cells with addresses
Coils 0 and 1
right-click inside the cells
click Apply in the pop-up menu
double-click inside a cell in the Write column for address 0, enter "1"
double-click inside a cell in the Write column for address 1, enter "0"
when this command is executed, the forward valve will open and the reverse
valve will close
title this command "Forward flow open"
Create a "Reverse flow open" command:
For the coil with address 0 set value "0"
For the coil with address 1 set value "1"
Finally, create a "Shut flow" command to shut-off both valves:
set "0" for both coils
Quick Start Guide
- 16 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Some of the commands are used for controlling the unit in the dose-meter mode, while the
others are for the measure mode, because the valves cannot be controlled in the dose-meter
mode. There are two commands that are shared between the two modes: "Zero reset" and
"Zero adjustment". In the menu position them apart from each other. To do this:
create two requests, for example, "01.Read coils"
set control parameter "Menu 1"
enter symbol "-" (hyphen) in place of the name
These requests will not be available from the menu but will serve to separate the items.
left-click on a cell from the Function column
while holding the button pressed, drag the grey box to a position between the
commands "Measure portion" and "Counters reset"
follow the same steps to arrange the items as shown below
Quick Start Guide
- 17 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
In the Menu caption tab change the title from "Menu 1" to "Control". Press OK. Save
project: Ctrl+S.
There is a new drop-down menu item Control:
The same menu will appear in the Modbus Reader window as soon as you open your
project there. You will be able to use the menu to run the commands you have created. In
Modbus Constructor this menu stays inactive.
Now it is time to specify dialogs to change the settings of the remote device.
Once again open the Requests form.
create a request "16.Write multiple register"
title the request "Portion size"
set address to "5"
create a request "16. Write multiple register"
title the request "Communication parameters"
set addresses to 2 to 4
Quick Start Guide
- 18 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
create a request "06.Write single register"
title the request "Mass per pulse, kg"
set address to "16"
set a control parameter for all three commands "Dialog (menu 2)"
change title "Menu 1" to "MFM Settings"
press "OK"
save project: Ctrl+S
There is now a new drop-down menu item "MFM Settings". Open the menu and select
"Communication parameters". A dialog will appear to help you change mass flow meter's
communication parameters. When using Modbus Reader, the data fields of these dialogs will
contain either the current values received directly from the device via read commands, or the
default values. The default values are used if the corresponding data had never been read
before the dialog was open, for example, if automatic requesting had been deactivated.
2.5 Simulator Parameters
A project created using Modbus Constructor can be used with the help of Modbus Reader
either for requesting the device in Master mode or simulating it in Slave mode. In the Slave
mode you can change the values of the registers and discrete data either manually or
automatically according to a function specified. The function can be setup using parameters:
Default value, Value1, Value2, Period.
The following rule applies to discrete elements and registers which are either Hex or
Binary:
T5. Discrete value simulation.
Time
0 < t < 1/3 Period
Data Element Value
Default value
1/3 Period < t < 2/3 Period
Value1
2/3 Period < t < Period
Value2
Period < t < 4/3 Period
4/3 Period < t < 5/3 Period
Default value
Value1
…
…
For registers that contain data of types, such as Float, Double, as well as integers that are
either Signed or Unsigned, the following rule applies:
Quick Start Guide
- 19 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
T6. Analogous value simulation.
Time
0 < t < 1/3 Period
Data Element Value
linear function from Default value to Value1
1/3 Period < t < 2/3 Period
linear function from Value1 to Value2
2/3 Period < t < Period
linear function from Value2 to Default value
Period < t < 4/3 Period
4/3 Period < t < 5/3 Period
linear function from Default value to Value1
linear function from Value1 to Value2
…
…
If the Period equals to zero, the Default value is used.
Open the window Objects: Settings⇒ Objects and setup the simulation parameters as
shown below.
Please note that the Value1 of the Time element equals one third of the period value,
while Value2 equals two thirds. In this case, the Time value will match precisely the time that
elapsed since the connection was established.
press "OK"
save your project: Ctrl+S
Quick Start Guide
- 20 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
3.
Using Modbus Device
This section instructs how to interact with a device for which a description was created
using Modbus Constructor.
Instead of a real-life device we shall use a simulator. If your computer has two COM ports,
connect them with a null modem cable. One of the COM ports will be used by the master, the
other by the slave. If your computer has only one COM port, install Modbus Reader to another
computer with at least one COM port and connect two computers with a null modem cable.
You can download a separate Modbus Reader installation file here:
http://www.kurysoft.com/download.html
Run Modbus Reader: Start ⇒Programs ⇒ModbusConstructor⇒MBReader.exe
open file Coriolos.mbc.
in the Mode menu set the flag Master
in the Connection menu select the first СОМ port (for example, СОМ1)
open another file Coriolos.mbc.
in the Mode menu set the flag Slave
in the Connection menu select the other СОМ port (for example, СОМ2)
place both forms side by side so that all data fields are available. If necessary,
change window size
make sure that the communication parameters are the same for both COM
ports. To open a dialog used to change the communication parameters press
Ctrl+P
make sure that Master and Slave have the same ID. To open a dialog used to
change ID press Ctrl+I
make sure that in the Mode menu Auto request enable has been flagged for
the Master form, and Simulation enable for the Slave form
Please note that data fields are empty on the Master form and show default values in the
Slave form.
Press F3 to establish connection. You will see that data on the Master form change in step
with the data on the Slave form.
Quick Start Guide
- 21 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
When the Master form is active, two additional menus become available, those which you
had created in the "Adding Requests" section, titled Control and MFM Settings. Click on the
Master form to make it active. Use these menus to see how your data will change with your
commands.
You can directly edit the elements' data on the Slave form when the simulation mode is off:
click on the Slave form
remove the Simulation Enable flag in the Mode menu
The data will stop changing.
double-click inside the "Density" field of the Slave form
enter some number
press Enter
A corresponding field of the Master form will display the same number as soon as the
Master performs the next register read request.
In the same manner you can write individual values to your device' registers and discrete
elements.
double-click inside the "Density" field of the Master form
enter some number
press Enter
After you complete your session, don’t forget to save current settings if you feel you might
need them later. From the File menu select Save session. Save your file as Coriolis.mbs.
Now that you are familiar with the basic principles of operating Modbus Constructor and
Modbus Reader, you can create your own projects for real Modbus devices much faster than it
took you to complete this example.
Quick Start Guide
- 22 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
4.
Terms And Definitions
4.1 Objects
In Modbus specifications an object is a data element which can be either read or written
independently from other data. There are four types of objects:
1. Coil
single bit
Read-Write
2. Discrete input
single bit
Read-Only
3. Holding register
16-bits word
Read-Write
4. Input register
16-bits word
Read-Only
4.2 Modbus Constructor Data Types
Modbus Constructor supports the following data types:
Numeric types
Type
Quantity of bits
Quantity of registers
integer (signed or unsigned)
16
1
long
32
2
float
32
2
double
64
4
MSByte (signed or unsigned)*
8
½ (most significant byte - MSB)
LSByte (signed or unsigned)*
8
½ (least significant byte - LSB)
(signed or unsigned)
*Byte (MSB or LSB) cannot be read or written independently from the other byte of the holding register.
Discrete types
Type
single
multiple
Quick Start Guide
Quantity of bits
1
2-16
- 23 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
4.3 Data Encoding
Long types, long, float, and double, are represented using several consecutive holding
registers.
There are two methods of storing such numbers in the registers: direct and swapped
(inverse).
Long
B3
B2
B1
B0
MSB
LSB
Register A
Register A+1
Transmitted
first
Default
B1
B0 (LSB)
B3 (MSB)
B2
B3 (MSB)
B2
B1
B0 (LSB)
Swapped
last
Float
B3
B2
B1
B0
SEEEEEEE
EMMMMMMM
MMMMMMMM
MMMMMMMM
Where floating point value = S1.M * 2E-127
Register A
Register A+1
Transmitted
first
Default
B1
B0 (LSB)
B3 (MSB)
B2
B3 (MSB)
B2
B1
B0 (LSB)
Swapped
last
Double
B7
B6
B5-B1
B0
SEEEEEEE
EEEEMMMMM
MMMMMMMM
MMMMMMMM
Where double precision floating point value = S1.M * 2E-1023
Register A
Transmitted
first
Default
B1
Quick Start Guide
Register A+1
Register A+2
Register A+3
last
B0
B3
B2
- 24 -
B5
B4
B7
B6
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
Swapped
B7
B6
B5
B4
B3
B2
B1
B0
4.4 Modbus Functions Application Rules
You can create a request for writing or reading any data element provided such element
had been specified within your project.
For example, if at least one Holding register has been specified, you can always use
functions 03, 06.
In the Options dialog (Settings menu) you can permit or lock additional functions for
Holding register 16, 22, 23.
If any of these functions have been locked, Modbus Reader will return Exeption 1 (Illegal
Function) to any request which uses this function while in simulator mode.
Key functions*
Element
Additional functions
Coil
01 – Read coils
15– Read multiple coils
Discrete input
02 – Read discrete inputs
-
Holding register
Input register
16 – Write multiple registers
03 – Read holding registers
22 – Write mask register
06 – Write single register
23 – Read/write registers
04 – Read input registers
-
*At least one element must be specified.
4.5 Format examples
Use the formatting feature to have your data displayed in a more convenient format.
Formatting helps you avoid numbers with too many digits after decimal point.
Numeric types:
Number
Format
Displayed
12345
### ##0
12 345
12345
0 000 000
0 012 345
123.45678
# ##0.000
123.457
123.45678
0.00 E+00
1.23 E+02
12
+## 000
+ 012
0.45678
.000 000 000
.456 780 000
12345
hh:mm:ss
03:25:45
Quick Start Guide
- 25 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
If data field contains several discreet elements, formatting helps to visually separate these.
Discrete types
Bits
Format
Displayed
11110000
0000 0000
1111 0000
11110000
0000 0 0 0 0
0000 0 0 0 0
11110000
0
11110000
11110000
00
1111000 0
11110000
000 00 000
111 10 000
Default for numeric types
Type
Format
integer
## ##0
long
# ### ### ##0
byte
##0
float
0.00
double
0.000 E+00
Default for discrete types
Type
Format
single (1)
0
multiple 2
00
multiple 3
000
multiple 4
0000
multiple 5
0 0000
multiple 9
0 0000 0000
multiple 16
0000 0000 0000 0000
Quick Start Guide
- 26 -
©2006 KurySoft. www.kurysoft.com
ModBus Constructor
5.
Contact Information
Please refer to the E-mail addresses below for further information.
info@kurysoft.com
General information and feedback. Any suggestions and comments will be welcomed!
support@kurysoft.com
Customer technical support service or bug report.
sales@kurysoft.com
Purchase or registration code affairs. We will be happy to help you.
Software distribution, promotion in software compilations, or business cooperation. We
are open to various levels of cooperation.
webmaster@kurysoft.com
Exchanging links or placing advertisement.
Visit our public web-site www.kurysoft.com for further information.
Quick Start Guide
- 27 -
©2006 KurySoft. www.kurysoft.com
Download