Copyright: Copyright 1995 - 1999 Calta Mdbus 3.24 99-Jul-20
Citation: Copyright 1995 - 1999 Calta Computer Systems


General
General	Topics 	Technical Support

Mdbus can be made to simulate a Master or Slave.  It can also be made to Monitor communications.  In Host Mode, multiple Slaves can be polled.  Up to four copies of Mdbus can be run simultaneously. The first copy or instance invoked will be named Mdbus and each succeeding instance will be named MdbusX where X is 0, 1, or 2.  Each must be configured to use a different communications port.  If one instance is made to simulate a Master and an other a Slave and a connection is made between their ports, they can be made to communicate.

Mdbus will create the following files in the directory in which it is installed:

1. MDBUS.INI - Contains data from the Configuration Window saved when the Ok button is pressed.  Other instances will create MDBUS0.INI, MDBUS1.INI, and MDBUS2.INI.

2. XXXXXX.CFG - Contains data from the Configuration Window saved when the Save File(s) button is pressed.

3. XXXXXX.IDB - Contains the data from the Status, Input Registers, Holding Registers, Floats, Long Integers, and Coils Database.  The data is saved when the Save File(s) button is pressed and the Include Database box is checked.

4. MDBUS.HOS - Contains data from the Host Window saved when the Ok button is pressed.  Other instances will create MDBUS0.HOS, MDBUS1.HOS, and MDBUS2.HOS.

5. MDBUS.AUX - Contains additional configuration data (such as Use Func. 15, etc.) saved when Mdbus is closed.  Other instances will create MDBUS0.AUX, MDBUS1.AUX, and MDBUS2.AUX.

XXXXXX is the File Ident..


Topics

General
Master Mode
Slave Mode
Monitor Mode
Host Mode
Normal Type
Unsolicited Type
Main Window
Configuration Window
Host Window
Host Control/Display Window
Master Control Window
Slave Control Window
Change Window
Windows General
Status Window
Holding Regs. Window
Input Regs. Window
Floats Window
Longs Window
Statistics Window
Coils Window
Monitor Window
Print Window
Abort Print
Menu Hangup
DDE


Configuration Window

This is the window used to configure Mdbus.  It can only be invoked if Mdbus is in the Off state.  Clicking on Ok or pressing the Enter key will save all the data on the display into the file MDBUS.INI (MDBUSX.INI if MDBUSX instance is active).

Mode

Comm. Port
Fmt./Bd./Py.
Type
MODBUS Slave No.
RTS/TX Delay
Invalid CRC/LRC
Database Points-Number
Database Points-Start
Floats (32 bit register)
Modicon Floats
No Resp. T.O.
Poll Delay
Fail Try Count
Mdbs Slave No. (hex)
Mdbs Func. No. (hex)
Capture CRC Error Only
Log File
212 AT Modem
Phone No. (AT)
Dial Try Count
Dial T.O. (sec.)
File Ident.
Data
Load File(s)
Save File(s)
Ok
Cancel
Help
Main Always On Top
Excel DDE
Excel Sprdsht
DDE T.O. (sec.)
Macro DDE
Appl,Topic
Macro


Host Window

In Master Mode, Mdbus is set up to poll one Slave.  However, Mdbus can be configured to poll multiple Slaves.  On the Main Mdbus Window is the Menu item Host.  It is only enabled when Mdbus is Off.  Clicking on this item will bring up the Host Configuration Window.  There are 32 slots available for defining the File Ident. of a Slave to be polled.  The Idents. must have been saved via the Main Configuration Window.  Clicking on a slot will bring up a File Dialog for selecting the Ident. of configuration to poll a Slave.  If the Cancel button is selected in the File Dialog, the slot will be cleared.  A saved File used in the Host Configuration must be defined as Master, Normal type, and not have the Invalid CRC/LRC box checked.

If the Prime box is checked, the following parameters from the first configuration are used for polling all configurations:

Comm. Port, Fmt./Bd./Py., RTS/TX Delay, No Resp. T.O., Fail Try Count, Poll Delay, Excel DDE, Excel Sprdsht, DDE T.O., Macro DDE, Appl,Topic, and Macro.

If the Excel DDE box is checked, all data from all configurations will be dumped into Excel after all configurations are polled.  The first configuration's data goes into columns 1 to 6, the second's into columns 7 to 12, etc.

If the Prime box is unchecked, each configuration is standalone.  After a Poll, each configuration's data is dumped into the specified spreadsheet if the Excel DDE box is checked.

If the One Scan box is checked, only one poll of all configurations will be done and then Mdbus will turn off automatically.

The DCD Alerts box has meaning only if an AT modem is being used for communicating with Slaves.  If the box is checked, Mdbus will produce an Alert Box and turn Off if DCD (Data Carrier Detect) is not obtained upon dial out or if DCD is lost after a successful dial out to a Slave.

When the Poll Configurations box is checked, Mdbus is now in Host Mode.  When Mdbus is turned On, the Host Control/Display Window will appear.  This window allows a configuration to be selected.  Once a configuration is selected,  Data can be viewed and Controls can be sent for the selected configuration.  In Host mode, the configuration currently being polled is shown on the Main Window.

In Host mode, the configuration currently being polled is shown on the Main Window.

A particular configuration can be enabled or disabled from polling via DDE the poke commands HOSTENAB and HOSTDISB.  If the Host Window is shown, a disabled from polling configuration is shown in red.

Prime
Poll Configurations
One Scan
DCD Alerts


Mode

This drop down list selects either Master Mode, Slave Mode or Monitor Mode of operation.  However, if the Poll Configurations box is checked in the Host Window, Mdbus will be in Host Mode.  On the Main Window, after mode will appear the word Host and instead of type on the second line the words config-xxxx will appear.  xxxx is the current selected configuration in the Host Control/Display Window.


Comm. Port

This drop down list selects the serial communications port.  One of four ports can be selected - COM1, COM2, COM3, or COM4.


Fmt./Bd./Py.

This drop down list selects the protocol (either RTU or ASCII), the serial communications port baud rate, and parity.  Baud rate values from 300 to 115200 can be selected.  For RTU or ASCII format, either none, even or odd parity can be selected.  RTU format is always 8 data bits, with or without parity, and 1 stop bit.  ASCII format is 7 data bits, parity, and 1 stop bit or 7 data bits, no parity, and 2 stop bits.


MODBUS Slave No.

Any value from 0 to 255 can be selected.  A value of 0 is treated as an all station address.  This value is used for the address when communicating to a Slave in Master Mode and is the address Mdbus will respond to in Slave Mode.  In Slave Mode, a special case exists for address 255.  For this value, Mdbus will respond to all station addresses.


RTS/TX Delay

This value is the time in milliseconds from the raising of RTS until data is sent.  This item has no effect if the 212 AT Modem box is checked.  Any value from 0 to 2000 can be entered.  If 0 is entered, RTS is always asserted.


Invalid CRC/LRC

When this box is checked, all transmitted messages are sent with a CRC which is the complement of the correct value.


Database Points-Number

This is the number of entities for a particular data type.  The maximum numbers allowed are 10000 for status, 5000 for holding registers, 1000 for input registers, 2000 for floats, 1000 for longs, and 10000 for coils.


Database Points-Start

This is the starting point number for polling a particular data type.  The start register in the transmitted message is one less than the starting point number.  The start number plus the number of entities must be less than 65536.


32 bit register

This check box determines how floating point and long integer values are handled.  The original MODBUS specification does not mention floating point values.  Modicon, an AEG company, allocates 2 16 bit registers for containing a floating point or long integer value.  Other companies allocate 1 32 bit register for the value.  If this box is left unchecked, the Modicon standard is used.


No Resp. T.O.
No. Resp. T.O.

This is the maximum time in milliseconds in Master Mode that Mdbus waits for the first character to be received from a Slave after transmitting a message to it. The minimum timeout allowed is 100 milliseconds and the maximum is 20000 milliseconds.


Poll Delay

This is the time in seconds that Mdbus in Master Mode waits between data scans.  A scan consists of a poll for all data types.  While waiting however, Mdbus still checks for commands.  The minimum Delay is 0 seconds and the maximum is 43200.


Fail Try Count

This is the maximum number of attempts by Mdbus in Master Mode to complete a message request or command to a Slave.  The minimum Try Count is 1 and the maximum is 99.


Mdbs Slave No. (hex)

This is the Modbus Slave number in Monitor Mode to match for capturing (FF hex matches all) data.


Mdbs Func. No. (hex)

This is the Modbus Func. number in Monitor Mode to match for capturing (FF hex matches all) data.


Capture CRC/LRC Error Only

This is the check box in Monitor Mode that when checked will allow only messages which fail CRC or LRC to be captured.


Log File

This is the check box in Monitor Mode that when checked will allow captured messages to be written to a file.  The box to the right of the check box is the file name.  It can be from 1 to 8 characters long.  Mdbus automatically appends ".LOG" to the file name when creating it.


212 AT Modem

If this box is checked, the phone number string is output to the modem in order to dial out.  For Unsolicited Type, this box must be checked.


Phone No. (AT)

If the 212 AT Modem box is checked, the Phone No. string is output to the modem in order to dial out and if necessary, initialize the modem.  The string must begin with AT.


Dial Try Count

This is the maximum number of attempts by Mdbus to complete a dial out attempt.  The minimum Try Count is 1 and the maximum is 99.  The default is 3.


Dial T.O. (sec.)

This is the maximum time in seconds in that Mdbus waits for DCD to be asserted after sending out the phone number string.  The minimum timeout allowed is 30 seconds and the maximum is 120 seconds.  The default timeout is 45 seconds.


File Ident.

This is the name of a file (8 characters maximum) with the extension ".CFG" that is used to save and load the Configuration Window Data for particular configurations.  Also, a file with the extension ".IDB" is used for saving and loading the Database if the Include Database box is checked.  A list of configuration files can be viewed by pressing the File Ident. button.


Data

If this box is checked, the Load File(s) and the Save File(s) Buttons also work with the file name contained in "File Ident." with the extension ".IDB".


Load File(s)

When this button is pressed, the Configuration Window is initialized with the data from the file name contained in "File Ident." with the extension ".CFG" and the Database will be initialized from the file with the extension ".IDB" if the Include Database box is checked.


Save File(s)

When this button is pressed, the current Configuration Window Data is saved in the file whose name contained in "File Ident." with the extension ".CFG" and the Database will be saved in the file with the extension ".IDB" if the Include Database box is checked.


Ok

When this button is pressed (same as if the Enter key is pressed), the current Configuration Window or Host Window Data is saved to the file MDBUS.INI or MDBUS.HOS.  The data is validity checked at this point and a Message Box Window occurs if any errors are detected.  After the Message Box is acknowledged, the errant data is focused.


Cancel

When this button is pressed, the Window is closed.


Help

When this button is pressed, the Help Window for Mdbus appears.


Main Always On Top

If this box is checked, the Main Window will always be on top of all windows for a quick reference.


Excel DDE

If this box is checked, Mdbus in Master Mode will update an Excel Spreadsheet with values for all the configured data as well as time ,communication statistics and the Slave number.  The data will be stored starting at Row 1, Column 1 in the spreadsheet.  The data requires 6 columns and the number of rows will be dependent upon the number of points defined for a data type.  In Host Mode with the Prime box checked, data will be stored in the first 6 columns for Configuration one, the next 6 columns for configuration two, and so on.

A problem exists with the DDE connection between Mdbus and Excel when dumping data into Excel (Excel DDE box is checked) and also running an Excel macro (Macro DDE box is checked).  The spreadsheet that Mdbus dumps its data into should not be the first sheet on the sheet tab.


Excel Sprdsht

This box should contain the name of the spreadsheet that Mdbus in Master Mode will poke its data if the Excel DDE box is checked.  For Excel 4 the name should be of the form SPREAD.XLS and for Excel 5 of the form [WORK.XLS]SPREAD where WORK.XLS is the Workbook and SPREAD is the name of the Worksheet.  NOTE, if only the Workgroup name is used for Excel 5 and beyond, the data is stored in the first Worksheet.  Different language versions of Excel abbreviate row and column with different letters than R and C.  For instance, the French version of Excel uses letters L and C, the German version of Excel uses letters Z and S, and the Spanish version of Excel uses letters F and C.  Mdbus needs this information to successfully poke data into an Excel spreadsheet.  The French version of Excel requires [WORK.XLS]SPREAD,1, the German version of Excel requires [WORK.XLS]SPREAD,2, the Spanish version of Excel requires [WORK.XLS]SPREAD,3, and the Dutch version of Excel requires [test.xls]scada,4 instead of [WORK.XLS]SPREAD in the Excel Sprdsht edit box.


Macro

This box should contain the name of the Macro that Mdbus in Master Mode will invoke if the Macro DDE box is checked.  For Excel 4 the name should be of the form SPREAD.XLM!MACRONAME where SPREAD.XLM is the macro spreadsheet name and MACRONAME is the Macro name.  For Excel 5, Access, and Word, the name should be of the form MACRONAME only.  The Macro is called after all the data has been retrieved from the Slave.


DDE T.O. (sec.)

This box should contain the maximum time in seconds that a DDE acknowledge can be expected from Excel when data is poked or from an application when a Macro is invoked.  If a timeout occurs, a message box will appear.


Macro DDE

If this box is checked, Mdbus in Master Mode will invoke a Macro in the named application and topic.  The macro name must appear the same as it appears in the application.  For Excel 4, the form is MACRO.XLM!MACRONAME.  For Excel 5, Access, and Word only MACRONAME is required.

A problem exists with the DDE connection between Mdbus and Excel when dumping data into Excel (Excel DDE box is checked) and also running an Excel macro (Macro DDE box is checked).  The spreadsheet that Mdbus dumps its data into should not be the first sheet on the sheet tab.


Appl,Topic

This box should contain the DDE Application name and Topic name (separated by a comma) which contain the Macro that Mdbus in Master Mode will invoke if the Macro DDE box is checked.  For Excel, the box should contain EXCEL, a comma, and the spreadsheet name complete with extension.  For Access, the box should contain MSACCESS, a comma, and the database name without extension.  For Word, the box should contain WINWORD, a comma, and the document name with or without extension.


Type

This drop down list selects either Normal Type or Unsolicited Type of operation.  Unsolicited operation requires that the 212 AT Modem box is checked. In Master Mode with Normal Type, Mdbus polls the Slave directly, or dials out to connect to it if the 212 AT Modem box is checked.  In Master mode with Unsolicited Type, Mdbus will wait for DCD to be asserted by a call from a Dial Out Slave before commencing to poll it for data.  In Slave mode with Normal Type, Mdbus waits to polled by the Master.  If the 212 AT Modem box is checked, DCD must be asserted before the Slave will expect a message.  In Slave mode with Unsolicited Type, Mdbus will Dial Out to connect to the Master.


Main Window

This is the main window which is displayed when Mdbus is invoked.  This display cannot be sized, but can be minimized.  Its title is used to display the current status of the application - On or Off.  Via it's menus, other windows can be selected.  The first line of the display area of Main shows the application's current mode, the configured MODBUS Slave number, and the communications parameters (cp) consisting of the serial port, the protocol (RTU or ASCII), the baud rate and the parity being used.  The second line shows the current Type of operation and communications status.  The various communication states are:
Nrml - For Master Mode this means a valid message has been received.  For Slave Mode at least one valid message has been received.
Fail - For the Master Mode only, this means a valid response has not been received after three attempts.
Dial - For both Master and Slave Modes this indicates a Dial Out is being attempted.
WDCD - For both Master and Slave Modes this indicates waiting for DCD to be asserted.

Also shown are RS (when RTS is asserted), TX (when characters are being transmitted), the last function code transmitted (in hex), RX (when characters are being received) and the last function code received (in hex).

The Main Window of Mdbus can be hidden.  If the right mouse button is clicked when the cursor is in the two-line status area of the Main Window, Mdbus will be reduced to an icon in the Taskbar Status area.  Passing the cursor over the Taskbar icon will display a line of status concerning Mdbus.  Clicking the right mouse button over the Mdbus icon in the Taskbar Status area will unhide Mdbus.  Clicking the left mouse button will bring up the display menu for selecting displays while Mdbus has been reduced to a Taskbar icon.  If Mdbus is hidden via a DDE command it cannot be unhidden except via a DDE command.

Displays Popup
On
Off
Control
Configuration
Host
Help Popup


Displays Popup
Displays Popup Mode

Pressing this menu item will bring up a Pop Up Window to select other windows.  These are the Status Window, Holding Regs. Window, Input Regs. Window, Floats Window, Longs Window, Statistics Window, Coils Window, and the Monitor Window.

Some of the window selection items may be dimmed if they are not applicable to the Mode or if no data points have been defined.


On

Pressing this menu item will start Mdbus polling the Slave for data in Master Mode, responding to requests in Slave Mode, and capturing messages if Monitor Mode.  For Master and Slave modes, the exact method depends upon the Type - Normal or Unsolicited selected.  The Configuration menu item will be dimmed, and the Control menu item enabled.  Mdbus can be made to go automatically into the On state upon start up.  The start up command line must be altered to include the word on after the executable mdbus.exe.  For instance, for a default directory installation, modify the Target under properties of the Mdbus icon as follows:  Change c:\mdbus\mdbus.exe to c:\mdbus\mdbus.exe on.


Off

Pressing this menu item will stop Mdbus polling the Slave for data in Master Mode , responding to requests in Slave Mode and capturing data in Monitor Mode.  The Configuration menu item will be enabled, and the Control menu item dimmed.


Control

Pressing this menu item will bring up the Master Control Window in Master Mode and the Slave Control Window in Slave Mode.


Configuration

Pressing this menu item when enabled will bring up the Configuration Window.


Help Popup

Pressing this menu item will bring up the Popup display allowing selection of the Help Display or the Mdbus About Window.


Master Mode

In Master mode, Mdbus will poll the designated Slave for configured status, input registers, holding registers, floating points, long integers and coils via standard MODBUS data type requests.  It will periodically check for commands to Coils, Holding Registers, Floating Points, and Long Integers.

In Normal Type operation with the 212 AT Modem box not checked, a direct or 202 Modem link is assumed and Mdbus sends out requests.

With the 212 AT box checked, and Normal Type selected, Mdbus will dial out to the Slave.  When DCD is sensed, the Mdbus sends out requests.  If carrier is lost, Mdbus will hang up.

With the 212 AT box checked and in Unsolicited Type operation, the Mdbus will wait for DCD after the string "ATS0=1" is output to the modem.  When DCD is sensed, Mdbus sends out requests.  If DCD is lost, the Mdbus will once again wait for DCD.


Slave Mode

In Slave Mode, Mdbus will respond to requests.  Requests must be for only the configured status, input registers, holding registers, floating points, long integers, and coils for the designated Slave.  All coil, holding register, floating point, and long integer control writes will be logged to the Slave Control Window complete with time, type, point number, and value.  The values sent will also update applicable coil, holding register, floating point, and long integer data if within the defined range.

In Normal Type operation with the 212 AT Modem box not checked, a direct or 202 Modem link is assumed and Mdbus waits for requests.

With the 212 AT box checked, and Unsolicited Type selected, Mdbus will dial out to the Master.  When DCD is sensed, Mdbus will wait for requests.  If carrier is lost, the Mdbus will hang up.

With the 212 AT box checked and in Normal Type operation, Mdbus will wait for DCD after the string "ATS0=1" is output to the modem.  When DCD is sensed, the Mdbus will wait for a message from the Master.  If DCD is lost, Mdbus will once again wait for DCD.

In Slave Mode, Mdbus can provide a simple Modbus Interface to another computer system.  Data to be sent by Mdbus can be supplied manually via the Change Window or under program control using DDE pokes by another application.  Up to 1000 values of one Database Type can be updated in Mdbus by the application with one DDE poke.


Monitor Mode

In Monitor Mode, Mdbus begins capturing data on the receive line of the selected communications port at the selected baud rate/parity when turned On.  Mdbus uses a time out (two character times) to determine receipt of a message.  The message is then checked for CRC and matching Slave number and function number to determine if this message is to be captured.  If the Log File box is checked messages will be written to the capture file.


Normal Type

In Master mode and Normal Type, Mdbus will poll the designated Slave for configured data.  If the 212 AT Modem box is checked, the designated phone number will be used to connect to the Slave.  In Slave mode and Normal Type, Mdbus waits for a poll message.  If the 212 AT Modem box is checked, the string ATS0=1 is output to the modem.


Unsolicited Type

The 212 AT Modem box must be checked for this type of operation.  In Master mode and Unsolicited Type, Mdbus will wait for the designated Slave to dial in and will then poll it for configured data.  In Slave mode and Unsolicited Type, the Slave will dial the Master using the phone number.


Master Control Window

This is the window used to send commands to the Slave when Mdbus is in Master Mode..  Command Status has three states - Pending (command is waiting to be sent), Fail (checkback from Slave not received in time), and Ok (checkback was successful).

Coil Pt. No.
Coil On
Coil Off

Use Func. 15
Holding Reg. Pt. No.
Holding Reg. Value
Holding Reg. Send

Use Func. 16
Floats Pt. No.
Floats Value
Floats Send
Long Ints. Pt. No.
Long Ints. Value
Long Ints. Send
Cancel


Coil Pt. No.

This is the point number of a Coil to which a On or Off command is to be sent.


Coil On

Pressing this button sends an On command to the selected point number.  The command status will go to "pending" and then "ok" or "failed!" depending on the result.


Coil Off

Pressing this button sends an Off command to the selected point number.  The command status will go to "pending" and then "ok" or "failed!" depending on the result.


Holding Reg. Pt. No.

This is the point number of a holding register out to which the value is to be sent.


Holding Reg. Value

This is the value to be sent to the selected holding register out point number.  The value must be between -32767 and +32767.


Holding Reg. Send

Pressing this button sends the value out to the selected holding register point number.  The command status will go to "pending" and then "ok" or "failed!" depending on the result.


Floats Pt. No.

This is the point number of the floating point register to which the value is to be sent using the multiple holding register command (function code 16)  If the 32 bit register box is not checked, 2 16 bit values are sent.  If it is, 1 32 bit value is sent.


Floats Value

This is the value to be sent to the selected floating point register.  There is no check on the value.


Floats Send

Pressing this button sends the value to the selected floating point register.  The command status will go to "pending" and then "ok" or "failed!" depending on the result.


Slave Control Window

This is the window used to display all coil, holding register, floating point and long integer point writes (if the 32 bit register box is checked) in Slave Mode.  The control is tagged with the time it was received, whether it is a coil (COIL), holding register (HREG), float (FREG) or long (LREG), the coil, holding, float or long point number, and the value.  Note that the designation FREG or LREG only appears for 32 bit registers.  If a 32 bit control write is received and it cannot be determined as a float or long, the control type is tagged as ????.  For 2 register floats or longs, the type is tagged as HREG.  Multiple writes can be determined by checking the time.  The time received will be the same.  There is room for storage of the last 100 controls.


Change Window

This is the window used to change the value of a Database Item in Slave Mode.  It can only be invoked by double clicking the left mouse button on a entry in the Status, Input Regs., Holding Regs., Floats, Coils or Longs Window.  The entry clicked on will be displayed in the Window.  The new value can then be entered in the Value edit box for input registers, holding registers floats and Longs.  For status or coils, clicking anywhere in the Value edit box will change the displayed state.  It can be closed by double clicking on the - block in the upper left hand corner of the Window.  If the Holding Regs. display is in hex mode, the Value will be displayed in hex and changes to the Value must be entered in hex.

Accept
Pt. No.
Value
Hold
Toggle Vl.
Tog. Ct.


Accept

When a new value has been entered on the Change Window, pressing the Accept button will force Mdbus to validity check it and store it in the Database if it is correct.


Pt. No.

This is the point number of the Database item to be altered when the Accept button is pressed.  Another entry on the Change Window can be selected for altering by double clicking on the appropriate Window.  Pressing the Up arrow will select the next point and pressing the Down arrow will select the previous point.


Value

This is the value to be stored for the Database item when the Accept button is pressed.  The change may or may not take place immediately.  It is dependent upon the state of Hold.


Hold

This button controls the action of altering Database values.  When the Change Window is initially invoked, the Hold is Off.  When in this state, all Database changes are made instantly.  If this button is then pressed, it will say Hold will go On.  All database changes are now queued until the button is pressed again when they all will take effect simultaneously.


Toggle Vl.

This edit box is only valid for Input Registers, Holding Registers, and Floating Point values.  It can hold any signed integer value from 0 to 32767.  The value is added to the appropriate database item whenever the Toggle Count is active.  There can be a unique value for each database point.


Tog. Ct.

This edit box is valid for all database types.  It can hold any unsigned integer value from 0 to 999.  The value is the number of times a database item will be perturbed.  The item will be perturbed each time it is requested from a Host.  The perturbation for coils or status is the changing of state from 1 to 0 or vice versa.  For Input Registers, Holding Registers, and Floating Point values, the perturbation is the Toggle Value.  The perturbations take effect based upon the state of Hold.  If Hold is Off, the perturbations begin immediately when the Accept button is pressed.  If Hold is On, the perturbations begin when Hold is turned Off.  A count of 999 will allow the perturbations to continue forever.


Windows General

The data windows all have sizing borders and can be made to scroll.  A selected window will respond to "Home", "End", "PgUp", "PgDn", and "Ctrl Home" key entries.  When the scroll bars appear, data exceeds the viewable area.  The left, right, up, and down arrows can be used to position the data.  Clicking the left mouse button on the ends of the vertical scroll bar will move the data one entry up or down.  Clicking on the ends of the scroll bar will move the data one character.  If the left button is held down when the cursor is positioned over the button on the scroll bar, and the mouse is moved, the data will follow the mouse movement.  Windows can be closed by clicking on the "Close" menu item after clicking on the system menu in the top left corner.  The point number on the Coils, Status, Input Regs., Holding Regs., Floats, and Long Ints. Windows can be displayed in hex or integer.  Right clicking on a point number will toggle the displayed point number from hex to integer.


Status Window

This is the window used to display status one point at a time.  The status is 0 and 1.  In Master Mode, the Header line will be displayed in Red if the data is not current.  In Slave Mode, double clicking on an entry will bring up the Change Window for altering the state.  Clicking on the value entry will change the displayed state which then can be accepted.  In Slave mode, an asterisk after the Pt. No. indicates that the data has a Toggle count.  If the line is in inverse video, the point is reporting perturbations to the Master.


Holding Regs. Window

This is the window used to display holding registers one point at a time.  The holding register value is normally a number from -32767 to +32767.  However, if the right mouse button is clicked on a value, the holding register values will be displayed in hex with values from 0 to ffff.  Clicking the button again, reverts the display to integer again.  In Master Mode, the Header line will be displayed in Red if the data is not current.  In Slave Mode, double clicking on an entry will bring up the Change Window for altering the holding register value.  In Slave mode, an asterisk after the Pt. No. indicates that the data has a Toggle count.  If the line is in inverse video, the point is reporting perturbations to the Master.


Input Regs. Window

This is the window used to display input registers one point at a time.  The value is a number from -32767 to +32767.  In Master Mode, the Header line will be displayed in Red if the data is not current.  In Slave Mode, double clicking on an entry will bring up the Change Window for altering the value.  In Slave mode, an asterisk after the Pt. No. indicates that the data has a Toggle count.  If the line is in inverse video, the point is reporting perturbations to the Master.


Floats Window

This is the window used to display floating point values one at a time.  The floating point values are displayed with 6 decimals.  If the value exceeds 1,000,000 the value is displayed in "E" format.  In Master Mode, the Header line will be displayed in Red if the data is not current.  In Slave Mode, double clicking on an entry will bring up the Change Window for altering the floating point value.  In Slave mode, an asterisk after the Pt. No. indicates that the data has a Toggle count.  If the line is in inverse video, the point is reporting perturbations to the Master.  If the 32 bit register button in the Configuration Window is checked, the point numbers go up by 1.  Otherwise, as 2 registers make up the value, the point numbers go up by 2.


Statistics Window

This is the window used to display Communication Statistics and is valid in both Master Mode  and Slave Mode.  Doubling clicking anywhere on this window will bring up another window asking if the statistics should be cleared.


Coils Window

This is the window used to display Coils status one point at a time.  The status is 0 or 1.  In Master Mode, the Header line will be displayed in Red if the data is not current.  In Slave Mode, double clicking on an entry will bring up the Change Window for altering the state.  Clicking on the value entry will change the displayed state which then can be accepted.  Coils are all initialized to the 1 state.  In Slave mode, an asterisk after the Pt. No. indicates that the data has a Toggle count.  If the line is in inverse video, the point is reporting perturbations to the Master.


Monitor Window

This window can be selected in any mode.  If it is invoked when Mdbus is Off, two of the three menu items associated with the Window are dimmed.  When Mdbus is turned On, the Stop Display item is bright and the Start Display item is dimmed.  In Monitor Mode, Mdbus captures data from the receive line of the selected communications port.  Capturing is dependent on the setup of the Monitor Only section of the Configuration Window.  Each captured line consists of the time - day, hour, minute, and second ( 1 m.s. resolution), CRC flag - G (good), or B (bad), and the message displayed in Hex or Ascii depending upon the protocol.  Captured lines are written to the Capture file log if the Log File box is checked.  When the Stop Display menu item is invoked, the display stops updating, but data will still be written to the Capture File.  When the Mdbus is turned Off, the Capture File is closed.  The window can be cleared at any time by invoking the Clear Display menu item.

In Master or Slave mode, Mdbus displays both the transmitted and received messages.  For Modbus RTU protocol, the data is displayed in Hex.  For Modbus ASCII protocol, the data is displayed in Ascii and a carriage return is displayed as "<" and a line feed as ">".  Other non printing characters are displayed as the character "?".


Print Window

The text from a Mdbus Window activated via the "Displays" heading menu can be printed or saved to a file.  Clicking on the icon in the upper left hand corner of the Window to be printed will bring down the System Command Menu.  Clicking on the "Print Window"menu item will bring up the Print Dialog Window.  There is capability to select printers.  If the "Print to file" box is checked, a name for a file to contain the print data will be requested.


Abort Print

Selecting this Menu entry will abort the printing of a "Displays" Window.


Menu Hangup

This topic is of interest only when Mdbus is run under Windows 3.1.  Selecting a Popup Menu (i.e. "Displays" or "Help") will cause Mdbus to cease communications until a particular menu item is invoked.  A safety timer will allow this condition to exist for only ten seconds at which time a Popup window will appear calling attention to this condition.


DDE

Mdbus in Master Mode can be set up to poke its data into an Excel Spread Sheet.  This includes all the Database values as well as Time and Poll Statistics.  Each Database type is stored in a column under a heading defining the Mdbus Instance and the type.  A column of data is terminated by a cell with the word "End".  If the Heading includes a *, the data has not been successfully retrieved from the Slave.  To enable this feature, check the Excel DDE box and supply an Excel spreadsheet name in the Configuration Window.  When Mdbus has data to be sent to Excel, it will make a connection with Excel.  Excel must be up and running with the specified spreadsheet.  In both Master or Slave mode Mdbus can be made to turn On or Off via pokes from Excel or any other program supporting pokes.  The Slave number and the Database points (start and number) can also be changed.  These changes are temporary and are not saved but remain in effect until Mdbus is closed.  Via pokes, Mdbus in Master Mode can be made to send out Coil ,Holding Register, Floating Point and Long Integer control commands.  Mdbus can execute a Macro in another application that supports DDE Execute.  Examples of Macro applications are Excel, Access, and Word for Windows.  Mdbus will also respond to DDE Requests for data.  Requested data can be Database values, time, polling statistics, or communication status.  Mdbus does not support DDE Hot Links.

A problem exists with the DDE connection between Mdbus and Excel when dumping data into Excel (Excel DDE box is checked) and also running an Excel macro (Macro DDE box is checked).  The spreadsheet that Mdbus dumps its data into should not be the first sheet on the sheet tab.

Mdbus can be made hidden via a DDE poke command.  When this happens, an icon is added to the Taskbar Status tray.  Moving the cursor over the icon will produce a tooltip text box.  The text will indicate whether Mdbus is On or Off, its communication state, and the number of polls and errors.  When Mdbus is unhidden, the Taskbar Status tray icon will be removed.

For all poke commands and requests, the DDE application name is MDBUS, MDBUS0, MDBUS1, and MDBUS2 depending on the instances in use.  The DDE topic is always POKE.

The following details the valid poke commands (Item and Data).

Item	Data 	Meaning

STATE	ON 	Turns Mdbus On
STATE	OFF 	Turns Mdbus Off
STATE	CLOSE 	Closes out Mdbus
STATE	HIDE	Hides Mdbus (an icon will be added to the Taskbar Status tray)
STATE	UNHIDE	Unhides Mdbus
SHCONF	ON	Brings up Mdbus Configuration Window
SLAVE	xxx 	Sets Slave number to xxx (0 to 255)
PHONE	ATxxxxxxx 	Set Phone no. - must start with AT
STATISTICS	1 	Clears Statistics
COIL yyy	x	Control Coil yyy to x (either 1 or 0) (Mdbus must be ON in

Master Mode)
COIL yyy	x,x,x 	Sets Coil yyy, yyy+1, etc. to x (either 1 or 0) (Mdbus must

be in Slave Mode)
HREG yyy	xxxx	Control Holding Reg. yyy to xxxx (+ or - 32767) (Mdbus

must be ON in Master Mode)
HREG yyy	xxxx,xxxx	Sets Holding Reg. yyy, yyy+1, etc. to xxxx (+ or - 32767)

(Mdbus must be in Slave mode)
FLOA yyy	xxx.xxx 	Control Float yyy to xxx.xxx (Mdbus must be ON in Master

Mode)
FLOA yyy	xxx.xxx,xx.xx 	Sets Float yyy, yyy+1, etc. to xxx.xxx, xx.xx, etc.(Mdbus

must be in Slave Mode)
LINT yyy	xxx	Control Long yyy to xxx (+/- 2147483647) (Mdbus must

be ON in Master Mode or in Slave Mode)
LINT yyy	xxx,xxx	Sets Long yyy, yyy+1, etc. to xxx (+/- 2147483647)

(Mdbus must be in Slave Mode)
STAT yyy	x,x,x	Sets Status yyy, yyy+1, etc. to x (either 1 or0)

(Mdbus must be in Slave Mode)
IREG yyy	xxxx,xxxx,xxx	Sets Input Reg. yyy, yyy+1, etc. to xxxx (+ or - 32767)

(Mdbus must be in Slave mode)
NOCOIL	xxxx 	Sets no. of Coils to xxxx
STCOIL	xxxx 	Sets start no. of Coils to xxxx
NOSTATUS	xxxx 	Sets no. of Status to xxxx
STSTATUS	xxxx 	Sets start no. of Status to xxxx
NOIREG	xxxx 	Sets no. of In. Regs. to xxxx
STIREG	xxxx 	Sets start no. of In. Regs. to xxxx
NOHREG	xxxx 	Sets no. of Ho. Regs. to xxxx
STHREG	xxxx 	Sets start no. of Ho. Regs. to xxxx
NOFLOAT	xxxx 	Sets no. of FP Regs. to xxxx
STFLOAT	xxxx  	Sets start no. of FP Regs. to xxxx
NOLINT	xxxx 	Sets no. of L.I. Regs. to xxxx
STLINT	xxxx  	Sets start no. of L.I. Regs. to xxxx
AT212	ON 	Enables 212 AT modem
AT212	OFF 	Disables 212 AT modem
CONFIG	xxxx 	Where xxxx is the File Ident. Config. to load

xxxx must have been previously saved via the

Configuration Window. (Mdbus must be Off,

and the Configuration Window must be closed.)
HOST	ON	Turns Host mode on
HOST	OFF	Turns Host mode off
CONTROL	xxxx	Where xxxx is the File Ident. configuration used

for Control and Display in Host mode.  xxxx must

have been previously saved via the Configuration

Window. (Mdbus must be On and in Host Mode.)

MUCO	ON	Sets function code 15 for Coil commands

MUCO	OFF	Sets function code 5 for Coil commands (default)

MUHR	ON	Sets function code 16 for H.R. commands

MUHR	OFF	Sets function code 6 for H.R. commands (default)

HOSTDISB	x	This disables a configuration from polling in Host

Mode.  x is the configuration slot to disable (0 to

31).

HOSTENAB	x	This enables a configuration from polling in Host

Mode.  x is the configuration slot to enable (0 to31).

The following details the valid data request commands which Mdbus will accept.  Some request commands support multiple values.  In multiple value cases, the values are separated by commas.

Item	Meaning

TIME	Returns time in the following format dd-mmm-yyyy hh:mm:ss.
ONOF	Returns the state of Mdbus, either On or Off.
HOST	Returns the Host state of Mdbus, either On or Off.
MUCO	Returns the state of Coil function code 15, either ON or OFF.
MUHR	Returns the state of H.R. function code 16, either ON or OFF.
STTS x y	Returns Communication Statistics where x=1, 2, 3, or 4 for

Requests, Incompletes, CRC errors, and No Responses

respectively and y is the number to return.  If all are required,

set x to 1 and y to 4.  If only Requests are required, set x to 1

and y to 1.
COMM xxxx	Returns Communication state where xxxx is COIL, STAT,

IREG, HREG, FLOA or LINT.  A 0 (comm. O.K.) or a 1

(comm. bad) is returned for the database type selected.
COIL xxxx yy	Returns the database values starting at Coil point xxxx.

The values are 0 or 1.  yy is the number of Coils requested.
STAT xxxx yyy	Returns the database values starting at Status point xxxx.  The

values are 0 or 1.  yyy is the number of Status requested.
IREG xxxx yy	Returns the database values starting at Input reg. point xxxx.

The values are + or - 32767 maximum.  yy is the number of

Input register requested.
HREG xxxx yyy	Returns the database values starting at Holding reg. point

xxxx.  The values are + or - 32767 maximum.  yyy is the

number of Holding registers requested.
FLOA xxxx yyy	Returns the database values starting at Floating reg. point

xxxx.  The values consist of a maximum of 15 digits.  yyy is

the number of Floating Point values requested.
LINT xxxx yyy	Returns the database values starting at Long Integer point

xxxx.  The values are + or - 2147483648 maximum.  yyy is

the number of Long Integer values requested.
CMND	Returns the number of controls in the queue to be sent.  If this

number is 100 (the queue size), and controls are sent, they

will overwrite those currently in the queue.


Calta Computer Systems
Calta Computer Systems Limited

For technical support or suggestions for future enhancements, please contact

Calta Computer Systems Limited

Suite 230, 550 -71st Avenue S.E.

Calgary, Alberta, Canada  T2H 0S6

Phone - 403-252-5094

Fax -     403-252-5102

Email - ccompute@calta.com

Web Site - http://www.calta.com/


Modicon format

This checkbox applies to transmission of a floating point value or long integer value using 2 holding registers.  If the box is checked, the least significant bytes are sent in the first register and the most significant bytes in the second register of a pair.  If the box is not checked, this is reversed.


Longs Window

This is the window used to display Long Integer Values one point at a time.  The value is a number from -2147483648 to +2147483647.  In Master Mode, the Header line will be displayed in Red if the data is not current.  In Slave Mode, double clicking on an entry will bring up the Change Window for altering the value.  In Slave mode, an asterisk after the Pt. No. indicates that the data has a Toggle count.  If the line is in inverse video, the point is reporting perturbations to the Master.  If the 32 bit register button in the Configuration Window is checked, the point numbers go up by 1.  Otherwise, as 2 registers make up the value, the point numbers go up by 2.


Long Ints. Pt. No.

This is the point number of the Long Ints. register to which the value is to be sent using the multiple holding register command (function code 16)  If the 32 bit register box is not checked, 2 16 bit values are sent.  If it is, 1 32 bit value is sent.


Long Ints. Value

This is the value to be sent to the selected Long Ints. register out point number.  The value must be between -2147483648 and +2147483647.


Long Ints. Send

Pressing this button sends the value to the selected Long Ints. point register.  The command status will go to "pending" and then "ok" or "failed!" depending on the result.


RTF_TOPIC_882374372
_


Host

Pressing this menu item when enabled will bring up the Host Window.


Prime

The Prime Check Box is found on the Host Window.

If the "Prime" box is checked, the following parameters from the first configuration are used for polling all configurations:

Comm. Port, Fmt./Bd./Py., RTS/TX Delay, No Resp. T.O., Fail Try Count, Poll Delay, Excel DDE, Excel Sprdsht, DDE T.O., Macro DDE, Appl,Topic, and Macro.

If the Excel DDE box is checked, all data from all configurations will be dumped into Excel after all configurations are polled.  The first configuration's data goes into columns 1 to 6, the second's into columns 7 to 12, etc.

If the "Prime" box is unchecked, each configuration is standalone.  After a Poll, each configuration's data is dumped into the specified spreadsheet if the Excel DDE box is checked.


Poll Configurations

The Poll Configurations check box is found is found on the Host Window.

When the Poll Configurations box is checked, Mdbus is now in Host Mode.  When Mdbus is turned On, The Host Control/Display Window will appear.  This window allows a configuration to be selected.  Once a configuration is selected,  Data can be viewed and Controls can be sent for the selected configuration.  In Host mode, the configuration currently being polled is shown on the Main Window.


One Scan

The One-Scan check box is found is found on the Host Window.

If the One Scan box is checked, only one poll of all configurations will be done and then Mdbus will turn off automatically.


File Dialog

The File Dialog Window is invoked whenever the File Ident. button is pressed on the Configuration Window or the mouse is clicked on an edit box on the Host Window or the Host Control/Display Window.  Clicking the mouse and pressing OK will result in the selected file being copied to the edit box.  If the Cancel button is pressed, the edit box will be cleared.


Host Control/Display Window

When Mdbus is in Host Mode and is turned On, the Host Control/Display Window will appear.  This window allows a configuration to be selected.  Once a configuration is selected,  Data can be viewed and Controls can be sent for the selected configuration.  In Host mode, the configuration currently being polled is shown on the Main Window.

Control Configuration


Control Configuration

This edit box is used for selecting the Configuration used for Control and Data Display in Host Mode.  Clicking on the edit box will bring up the File Dialog for selecting the required Configuration.


Host Mode

If the Poll Configurations box is checked in the Host Window, Mdbus will be in Host Mode.  On the Main Window, after mode will appear the word Host and instead of type on the second line the words config-xxxx will appear.  xxxx is the current selected configuration in the Host Control/Display Window.


Use Func. 15

If this box in the Master Control Window is checked, Mdbus will send out single Coil write commands using Modbus function 15 rather than function 5.


Use Func. 16

If this box in the Master Control Window is checked, Mdbus will send out single Holding Register write commands using Modbus function 16 rather than function 6.


DCD Alerts

The DCD Alerts check box is found is found on the Host Window.

The DCD Alerts box has meaning only if an AT modem is being used for communicating with Slaves.  If the box is checked, Mdbus will produce an Alert Box and turn Off if DCD (Data Carrier Detect) is not obtained upon dial out or if DCD is lost after a successful dial out to a Slave.


FIFO

The 16550 serial UART has fifo buffers for both transmit and receive.  The maximum buffer size is 16 characters.  Windows NT and 95/98 handle the setup of these buffers differently.  The buffer size cannot be controlled directly using the Windows Application Interface (API) under 95/98 or NT.  The size of the fifos cannot be determined under program control using 95/98, however, under Windows NT the size can be read from the registry.

The size of the Tx fifo affects the raising and lowering of RTS.  If RTS is not being used, it is of no importance.

The size of the Rx fifo affects message timeout and the ability of Mdbus to determine the end of messages in Slave and Monitor modes (should be set low for this).

As the size of the fifos cannot be read under 95/98, Mdbus assumes the size of the Rx and Tx buffers as 1 character.  Therefore, a user of Mdbus under Windows 95/98 should set the fifos to Low.

The following is the procedure under Windows 95/98 to set the Tx and Rx fifos to 1.

1.  Select Control Panel under Start, Settings.

2.  Select System Icon.

3.  Select the Device Manager Tab.

4.  Select Ports (COM & LPT).

5.  Select the Communications Port being used.

6.  Select the Port Settings.

7.  Depress the Advanced pushbutton.

8.  Set Transmit Buffer to Low (1).

     Set Receive Buffer to Low (1).

or

8.  Uncheck the "Use FIFO Buffers" checkbox

9.  Select OK.

10. Select OK.

11. Select OK.

The machine does not require a reboot for changes to take effect.

Under Windows NT the size of the buffers can be determined from the registry and Mdbus does this.  Therefore changes are not absolutely required unless a user of Mdbus wants to decrease the Rx fifo value to allow better Rx message detection in Monitor mode or quicker response to Master messages in Slave mode.

These values can be changed via the registry but the machine must be rebooted for the changes to take effect.

The following describes under NT the keys for the Rx and Tx fifo values in the registry.  These values can then be changed using the registry editor.  The registry should be exported for backup from the editor before making changes in case of error.

1. Tx Fifo (it can be found as follows)

    HKEY_LOCAL_MACHINE

        SYSTEM

            CurrentControlSet

                Services

                    Serial

                        TxFIFO

2. Rx Fifo (it can be found as follows)

    HKEY_LOCAL_MACHINE

        SYSTEM

            CurrentControlSet

                Services

                    Serial

                        RxFIFO

Remember that the machine must be rebooted for any changes to take effect.

Mdbus sets its receive message inter character timeout greater then the Rx fifo value times the character time times 2.

The values of the Tx and Rx fifo that Mdbus is using can be viewed in the Configuration Window.