MDBUS



Comments



Description

GETTING STARTEDMODBUS SIMULATOR (Mdbus) FOR WINDOWS 95/98/NT/2000 Modicon, An AEG Company, Modicon Modbus Protocol Version Calta Computer Systems Limited ............................ 6 TASKBAR STATUS TRAY AREA....................... 2 GENERAL.......................................................................................................................................................................31 2000-Dec-17 Computer Systems Limited Page 2 ........................................................... 18 MONITOR CONNECTION DRAWING............ 5 SLAVE MODE........................................................ 7 DDE GENERAL..........................................................................................................................Index INDEX............................................................................................................................. 3..... Rev... 12 EXCEL MACROS......................... 8 DDE REQUEST COMMANDS................................................................................................................................................................................................................................................................... 3 HOST MODE......................................................................................................................................................................................................... 6 MONITOR MODE................. 19 Calta Getting Started With Modbus for Windows................................................................................................................................... 17 CONTACT INFORMATION................................................................................................................................................................................................................................................................................................................................. 6 MODBUS RTU/TCP COMMUNICATIONS................. 13 EXCEL LANGUAGE CONFIGURATION........................................................................................................................................................... 11 EXCEL EXAMPLES.......... Any Data type with a number of zero will be grayed. enter master1 for the File Ident. 30 input registers starting at register 1 (index 0). will poll a Slave). If the default configuration is not suitable. and uses this as the start register address in its poll requests. 200 input status starting at point 1 (index 0). Statistics can be reset by Double clicking anywhere on the Statistics Window. For familiarization purposes. The Mode will be MASTER (ie.General The program can be installed on any IBM or compatible PC equipped with a 386 or higher microprocessor. the page up/down keys. the various Windows for displaying the values for the different Data Types can be invoked. and the fourth . The Slave polled will have an address of 1. If the Header line of a Window is displayed in Red. the third MDBUS1. select Off on the Main Window. the Main MDBUS Window will always be on Top of all Windows for quick reference. it can be modified. It will poll for 200 coil status starting at point 1 (index 0). When the program is invoked for the first time.e. Pressing the Help button will bring up the Windows Help Facility program. Unique Configurations can be kept via the Master/Slave Configuration-Database File (i. MDBUS will begin polling the Slave. The two instances can also communicate via TCP/IP protocol. 100 holding registers starting at register 1 (index 0). the following conditions will apply. The machine must be running Windows 95 or NT with at least one available serial communications port or a network card. tab. Via the Search feature of this window. The word after Comm. subtracts 1. The data retrieved from a Slave can be viewed by invoking the appropriate Window via the Displays menu item. edit box and pressing the Load File(s) button. It will attempt each poll three times if necessary for a successful response. This file can be later recalled by entering master1 in the File Ident. If it is Fail (steady). 3.MDBUS2. the Configuration Window will appear. Clicking on the icon in the upper left-hand corner of a Calta Getting Started With Modbus for Windows. If it alternates between Fail and Nrml. Data in any Display Window can be viewed by using the scroll buttons. Transmitted and received messages can be viewed by selecting the Monitor Display.Run" option of the DeskTop Manager by typing either A:\setup or B:\setup in the open space as required. Communication statistics can be viewed by invoking the Statistics Menu item. The Slave will be polled via communications port one at 1200 baud with no parity and RTU format. The 3 1/2 inch floppy contains an installation program which can invoked via the "Start . Under the Display Menu. a full explanation of each configuration item can be obtained. one or more of a Database type's configuration is wrong for the slave being polled. two instances of Mdbus can be run at the same time in the same machine and be made to communicate if two serial ports are available and TX and RX are crossed from one serial port to another. One instance should be configured as a Master and the other as a Slave. and press the Save File(s) button. on the second line of the Main Window should be Nrml (steady). Note that Mdbus takes the starting point number for each Data Type.31 2000-Dec-17 Computer Systems Limited Page 3 . To determine the problem. and the ctrl home/end keys. Rev. and no floating point or long integer values. The first instance of MDBUS is named MDBUS. the second MDBUS0. Any display window can be printed. the cursor up/down/right/left keys. It is possible to invoke up to four instances of the program simultaneously if memory and serial ports or network cards are available. If the "Main Always On Top" box is checked. If the On menu item on the Main Window is invoked. MDBUS will raise RTS for 55 milliseconds before any characters are transmitted (in case communications is via a 202 type modem or Radio link). If the Ok button is pressed. no successful communications is occurring. The Configuration should now be checked to ensure that the number and start of the errant Data Type is correct. the data was not successfully retrieved. 31 2000-Dec-17 Computer Systems Limited Page 4 . Holding Register. Rev. 3. and Longs) can be sent to the Slave by selecting the Control menu item. Calta Getting Started With Modbus for Windows. Floats. Controls (Coil.Display Window and selecting the Print item will do this. Calta Getting Started With Modbus for Windows. No Resp. and not have the Invalid CRC/LRC box checked. Excel Sprdsht. The Idents. 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. Normal type.31 2000-Dec-17 Computer Systems Limited Page 5 . If the "One Scan" box is checked. Rev. A particular configuration can be enabled or disabled from polling via DDE the poke commands HOSTENAB and HOSTDISB. When Mdbus is turned On. the slot will be cleared. DDE T. in the Host Configuration Window must be defined as Master. See DDE POKE and the CONTROL Item (page 10)./Request. Poll Delay. When the "Poll Configurations" box is checked. each configuration is standalone. Please note that when sending commands to Mdbus via DDE in Host mode you must also select the configuration to which the control is being sent.. Mdbus is set up to poll one Slave. On the Main Mdbus Window is the Menu item "Host". Excel DDE. Fmt. Clicking on this item will bring up the Host Configuration Window. Fail Try Count. the second's into columns 7 to 12. This window allows a configuration in the poll list to be selected. the following parameters from the first configuration are used for polling all configurations: Comm. RTS/TX Delay. If the Cancel button is selected in the File Dialog instead of a configuration. However. A saved File used as an Ident. Once a configuration is selected. The “DCD Alerts” box has meaning only if an AT modem is being used for communicating with Slaves. Mdbus can be configured to poll multiple Slaves./Py. each configuration's data is dumped into the specified spreadsheet if the Excel DDE box is checked.O. The Host Control/Display Window will appear. 3. It is only enabled when Mdbus is Off. TCP Enable. of a configuration to poll. T. If the “Excel DDE” box is checked. a disabled from polling configuration is shown in red. Clicking on a slot will bring up a File Dialog for selecting the Ident. only one poll of all configurations will be done and then Mdbus will turn off automatically. must have been saved via the Main Configuration Window. data can be viewed from and controls can be sent to the selected configuration. If the Host Window is shown. The Idents./Bd. After a Poll. etc. Mdbus is now in Host Mode. Macro. the configuration currently being polled is shown on the Main Window. If the "Prime" box is checked.O. The first configuration's data goes into columns 1 to 6. In Host mode. RTS Extra. Regs. and CTS Enable. could have been set up for 32 different Slaves or 32 different configurations for the same Slave or any combination. configuration of a Slave to be polled.. Macro DDE. IP Address. Appl.Host Mode In Master Mode. There are 32 slots available for defining the File Ident. all data from all configurations will be dumped into Excel after all configurations are polled.Topic. If the "Prime" box is unchecked.. Port. If the box is checked. and Long Controls sent from a Master can be viewed in a Window. Holding register. Mdbus will be reduced to an icon in the Taskbar Status area. Messages can also be logged to a capture file. Data sent to the Master can be changed via a data display. of 255 is a special case. Selective messages can be configured for viewing based upon Slave number. In Slave Mode. function code.Slave Mode If MDBUS is configured as a SLAVE and the appropriate serial port is specified or Modbus/TCP is enabled. Up to 1000 values of one data type can be updated in Mdbus by the application with one DDE poke. If Mdbus is hidden via a DDE command it cannot be unhidden except via a DDE command. and CRC errors. A Modbus Slave No. 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. Rev. It responds to requests for the address contained in the Modbus Slave No. the Coil. Passing the cursor over the Taskbar icon will display a line of status concerning Mdbus. For this value.31 2000-Dec-17 Computer Systems Limited Page 6 . Floats. 3. Data to be sent by Mdbus can be supplied via DDE pokes by another application. in the Configuration Window when the On menu item is invoked. Taskbar Status Tray Area The Main Window of Mdbus can be hidden. Calta Getting Started With Modbus for Windows. The Change Window also allows data values to be perturbed for a few scans or continuously for testing the way a Master responds to changes. Monitor Mode If MDBUS is configured for MONITOR mode (serial communications only). it will respond to requests from a Master. If the Control Menu item is selected. The Control messages are tagged with the current time. Both TX and RX lines of a communications port can be monitored if they are diode coupled before being connected to the RX of the communications port configured to monitor. Please review “FIFO Notes” (click on Icon in mdbus folder) or Help on FIFO for information on detecting messages. If the right mouse button is clicked when the cursor is in the two-line status area of the Main Window. Mdbus will respond to all addresses received from a Master. Double clicking on a point in a Data Display Window will bring up a Change Window for altering the value. Mdbus can provide a simple Modbus Interface to another computer system via a serial interface or TCP/IP connection. messages incoming on the RX line of a serial port can be viewed in Hex using RTU protocol and in ASCII using ASCII protocol. and change the value on the meter. Coil number 5 is the state of the light and coil number 6 is the state of the wheel (1 is on). HTML links on the page turn the light on or off.41. Note! If there are problems with the Opto 22 demonstration page (lower frame does not appear) in step 1 above. The procedure is as follows: 1.shtml) using a Web Browser. It will connect to the Opto 22 I/O using Modbus/TCP protocol. The site can be found at http://www. Mdbus will be configured in Master mode. Calta Getting Started With Modbus for Windows. Now turn Mdbus On.internetio. 4. Float number 1 is the temperature and Float number 25 is the meter value.com) can be tried. Box should be checked. Rev. use Pt. a light bulb. www. For the Wheel spinning. Now start up Mdbus (Start/Run C:\mdbus\mdbus. and Coil Windows. the IP address of the TCP device to be polled is required. Opto 22 (Temecula. all serial communication parameters are grayed. When Mdbus is turned off it will disconnect from the Opto 22 I/O. enter 25 in the Float Pt. Enter 5 in the Coil Pt. 3. No. 127. When this is done. No. The IP address for the Modbus/TCP interface on this page is 206. 6. When you do this. Modbus/TCP protocol utilizes port 502. 3. Load the Configuration file opto22 that is included with the Mdbus installation into Mdbus from the Configuration Window (enter opto22 in the File Ident.1 should be set on the instance that is Master.com/camera2frameset. The Modbus RTU/TCP Comm. This site showcases their SNAP Ethernet I/O.shtml.com) have an excellent web site for demonstrating Modbus/TCP.com/cam1frameset.internetio. wheel. Box will contain 206. and the number 0 to 10 in the Value box and press Send.). 7.internetio.40. To turn the light on or off. On the web page is a Web Camera that shows a rack of I/O. stop or start the spinning of the wheel. Now click Ok. The IP addr. To change the meter value (0 to 10). and meter value. Bring up the Opto 22 demonstration page (Browser/HTML if selected from www.152. California – 909-695-3000. 5. Click Off. Box and press Load File). Longs. and the IP Addr. Two instances of Mdbus (one set as Master. These same changes can also be done with Mdbus using Modbus/TCP.com/camera1frameset. The bulb will turned On. No.exe.126. etc.internetio.0.com) (http://www. bring up the Float.internetio. the other as Slave) can communicate using TCP protocol on the same machine for testing.0. the Modbus TCP box will be checked. Under displays. and click On. and the bulb will be turned Off. 6.152.31 2000-Dec-17 Computer Systems Limited Page 7 .shtml) (Browser/XML if selected from www.opto22. In Master mode. 2. The Camera updates constantly.126. bring up the Control Window of Mdbus. an alternate demonstration page (http://www. Long Integer 401 is the value of the wheel revolutions.Modbus RTU/TCP Communications Mdbus can be a Master or a Slave utilizing Modbus/TCP protocol. Excel must be up and running with the specified spreadsheet. polling statistics. 3. and Word for Windows. When this happens.31 2000-Dec-17 Computer Systems Limited Page 8 . For all poke/request commands the DDE application name is MDBUS. The text will indicate whether Mdbus is On or Off. Mdbus can be made hidden via a DDE poke command. Each Database type is stored in a column under a heading defining the Mdbus Instance and the type. These changes are temporary and are not saved but remain in effect until Mdbus is closed. Floating Point. Access. its communication state. Mdbus can be made to turn On or Off via pokes from Excel or any other program supporting DDE pokes. Mdbus in Master Mode can be made to send out Coil. and Long Integer control commands. the data has not been successfully retrieved from the Slave. If the Heading includes a *. Mdbus does not support DDE Hot Links. check the Excel DDE box and supply an Excel spreadsheet name in the Configuration Window.DDE General Mdbus in Master Mode can be easily set up to poke its data into an Excel SpreadSheet. Mdbus will also respond to DDE Requests for data. In both Master and Slave mode. Requested data can be Database values. and the number of polls and errors. Clicking the left mouse button will bring up a menu for display selection. When Mdbus has data to be sent to Excel. The spreadsheet that Mdbus dumps its data into should not be the first sheet on the sheet tab. The Slave number and the Database points (start and number) can also be changed. This includes all the Database values as well as Time and Poll Statistics. MDBUS1. When Mdbus is unhidden. Calta Getting Started With Modbus for Windows. an icon is added to the Taskbar Status tray. 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). Via pokes. The DDE topic is always POKE. A cell with the word "End" terminates a column. it will make a DDE connection to Excel. MDBUS0. To enable this feature. time. Holding Register. Examples of supporting applications are Excel. Mdbus can execute a Macro in another application that supports DDE Execute. and MDBUS2 depending on the instances in use. and communication status. Moving the mouse cursor over the icon will produce a tooltip text box. Rev. the Taskbar Status tray icon will be removed. xx.x. of Coils to xxxx xxxx Sets start no. Regs. yyy. etc. of F. to xxxx xxxx Sets start no. yyy+1. to xxxx xxxx Sets no. Rev.x. . (Mdbus must be OFF. to x (either 1 or 0)(Mdbus must be in Slave Mode) xxxx. of Holding Regs. etc. etc. of Status to xxxx xxxx Sets no. to xxx (+/.xxx. yyy+1. yyy. to load. of F.must start with AT Clears Statistics Control Coil yyy to x (either 1 or 0) (Mdbus must be ON in Master Mode) x. yyy+1. of Input Regs.x Sets Status yyy.31 2000-Dec-17 Computer Systems Limited Page 9 .DDE Poke Commands The following details the DDE POKE commands (Item and Data) which Mdbus will accept. Regs. of L. etc. to xxxx ON Enables 212 AT modem OFF Disables 212 AT modem xxxxxxxx Where xxxxxxxx is the File Ident. to xxxx xxxx Sets no. yyy+1. to xxxx xxxx Sets start no. and the Calta Getting Started With Modbus for Windows.xx Sets Float yyy. yyy+1.P. xx. etc. of Coils to xxxx xxxx Sets no. of L.xxxx Sets Input Reg. to xxxx xxxx Sets start no. of Input Regs.2147483647) (Mdbus must be ON in Master Mode or in Slave Mode) xxx. to xxxx (+ or – 32767) (Mdbus must be in Slave mode) xxxx Sets no. to xxxx xxxx Sets no. 3. etc. to x (either 1 or 0) (Mdbus must be in Slave Mode) xxxx Control Holding Reg.xxx Sets Long yyy. of Holding Regs. Regs. (Mdbus must be in Slave Mode) xxx Control Long yyy to xxx (+/.xxx. Regs. to xxxx xxxx Sets start no. etc.I.I.xxx (Mdbus must be ON in Master Mode) xxx.x Sets Coil yyy.xx.P. yyy+1. Item Data STATE STATE STATE STATE STATE SHCONF SLAVE PHONE STATISTICS COIL yyy ON OFF CLOSE HIDE UNHIDE ON xxx ATxxxxxxx 1 x COIL yyy HREG yyy HREG yyy FLOA yyy FLOA yyy LINT yyy LINT yyy STAT yyy IREG yyy NOCOIL STCOIL NOSTATUS STSTATUS NOIREG STIREG NOHREG STHREG NOFLOAT STFLOAT NOLINT STLINT AT212 AT212 CONFIG Meaning Turns Mdbus on Turns Mdbus off Closes out Mdbus Hides Mdbus(icon added to the Taskbar Status tray) Unhides Mdbus Brings up Mdbus Configuration Window Sets Slave number to xxx (0 to 255) Sets Phone no. yyy to xxxx (+ or . xxxxxxx must have been previously saved via the Configuration Window. Config. of Status to xxxx xxxx Sets start no.xxxx.2147483647) (Mdbus must be in Slave Mode) x.xxxx Sets Holding Reg.32767) (Mdbus must be ON in Master Mode) xxxx. to xxx.xxx Control Float yyy to xxx. to xxxx (+ or – 32767)(Mdbus must be in Slave mode) xxx. 31 2000-Dec-17 Computer Systems Limited Page 10 .) Sets function code 15 for Coil commands Sets function code 5 for Coil commands (default) Sets function code 16 for H. Send time to a Daniel’s Flow Computer Calta Getting Started With Modbus for Windows.R. configuration used for Control and Display in Host mode. xxxxxxx must have been previously saved via the Configuration Window.R. 3. (Mdbus must be ON and in Host Mode. x is the configuration slot to enable (0 to 31). commands (default) This disables a configuration from polling in Host Mode. x is the configuration slot to disable (0 to 31).HOST HOST CONTROL ON OFF xxxxxxxx MUCO MUCO MUHR MUHR HOSTDISB ON OFF ON OFF x HOSTENAB x TMDN 4995 0 Configuration Window must be closed. Rev. This enables a configuration from polling in Host Mode. commands Sets function code 6 for H.) Turns Host mode on Turns Host mode off Where xxxxxxxx is the File Ident. Incompletes. Rev. set x to 1 and y to 4. If all are required. HREG.32767. The values consist of a maximum of 15 digits. The values range from a maximum /minimum of + or . Returns the database values starting at Long Integer point xxxx. IREG. STAT. The values are 0 or 1.DDE Request Commands The following details the valid DDE REQUEST commands that Mdbus will accept.R. Some request commands support multiple values. FLOA. 3. either ON or OFF. If this number is 100 (the queue size). Returns the database values starting at Input reg. Returns the state of Coil function code 15. If only requests are required.K.2147483647. set x to 1 and y to 1. commas separate the values. Returns the database values starting at Coil point xxxx. or 4 for Requests. COMM xxxx COIL xxxx yyy STAT xxxx yyy IREG xxxx yyy HREG xxxx yyy FLOA xxxx yyy LINT xxxx yyy CMND Calta Getting Started With Modbus for Windows. point xxxx. Returns the state of H. yyy is the number of Long Integer values requested. point xxxx. Returns the number of controls in the queue to be sent. CRC errors. No Responses respectively and y is the number to return. bad) is returned for the database type selected. Returns the state of Mdbus. 2. The values range from a maximum /minimum of + or . either ON or OFF. or LINK. yyy is the number of Coils requested.) or a 1 (comm. A 0 (comm. either ON or OFF. O. yyy is the number of Input registers requested. they will overwrite those currently in the queue. In multiple value cases. Item Meaning TIME ONOF HOST MUCO MUHR STTS x y Returns time in the following format dd-mmm-yyyy hh:mm:ss. Returns Communication Statistics where x=1. 3. Returns the database values starting at Floating reg. Returns the database values starting at Status point xxxx. Returns the database values starting at Holding reg. yyy is the number of Status requested. point xxxx. function code 16. and controls are sent.32767. The values are 0 or 1. The values are + or . yyy is the number of Floating Point values requested. Returns Communication state where xxxx is COIL. yyy is the number of Holding registers requested. either ON or OFF. Returns the Host state of Mdbus.31 2000-Dec-17 Computer Systems Limited Page 11 . Excel Examples This following is an example of an Excel spreadsheet showing the data that has been poked into it by Mdbus. Rev. "poke") End Sub 'start up mdbus 'initiate dde channel to mdbus Calta Getting Started With Modbus for Windows. The following is an example of an Excel auto open macro used to start up Mdbus and obtain the DDE identification of Mdbus.31 2000-Dec-17 Computer Systems Limited Page 12 . 3. Dim channel ' ' auto open macro ' Sub auto_open() Shell ("c:\mdbus\mdbus.exe") channel = DDEInitiate("mdbus". "Floating Point Change". value ' Sub set_fp() Dim fpval Dim fpno fpno = Application. . . "definitions!r4c1" 'turn mdbus off End Sub ' 'Close Mdbus ' Sub auto_close() DDEPoke channel. "definitions!r2c1" 'tell mdbus to close DDETerminate channel 'close dde channel to mdbus End Sub ' ' set f. 2). .Value = fpval DDEPoke channel. . . "definitions!r3c2" 'set coil value End Sub Calta Getting Started With Modbus for Windows.InputBox("Enter Coil value (either 0 or 1)". 1) Worksheets("definitions"). "definitions!r2c2" 'set f.InputBox("Enter Floating Point Register No. "Coil Change".". .InputBox("Enter Coil Point No. . 2) fpval = Application. . . .p. . ' 'Turn Mdbus On ' Sub mdbus_on() DDEPoke channel. value End Sub ' ' set coil value ' Sub set_coil() Dim coilval As Integer Dim coilno coilno = Application. Rev. "Floating Point Change". . "state". "definitions!r3c1" 'turn mdbus on End Sub ' 'Turn Mdbus Off ' Sub mdbus_off() DDEPoke channel. . .31 2000-Dec-17 Computer Systems Limited Page 13 .Cells(3.InputBox("Enter Floating Point Register value". "FLOA " + fpno.". "Coil Change".Value = coilval DDEPoke channel. . . 1) Worksheets("definitions"). 2). "state".Excel Macros The following are examples of Excel macros used to poke commands into Mdbus. 3. .p. . . "COIL " + coilno.Cells(2. . "state". 2) coilval = Application. "Holding Register Change". "sthreg". . 2). "definitions!r12c5" 'set start status to 6 DDEPoke channel.InputBox("Enter Holding Register value (+ or . . "definitions!r11c5" 'set no. "slave". "noireg". "definitions!r8c5" 'set start status to 4 DDEPoke channel. . "nostatus". of status to 11 DDEPoke channel.InputBox("Enter Holding Register Point No. "HREG " + hrno. of coils to 5 DDEPoke channel. "Holding Register Change". . "definitions!r10c5" 'set start status to 5 DDEPoke channel. "stireg". "definitions!r14c5" 'clear statistics mdbus_on 'turn mdbus on End Sub ' ' Load Test Configuration (Note!!! This is the easiest way of changing Mdbus’s config. .) ' Sub load_test() mdbus_off 'turn mdbus off DDEPoke channel. "stfloat". of status to 12 DDEPoke channel.Value = hrval DDEPoke channel. "statistics". . of status to 13 DDEPoke channel. "definitions!r9c5" 'set no. . "definitions!r4c1" 'set slave address End Sub ' ' Miscellaneous Sample Initialization (See Load Test Config. 2) hrval = Application. 3. "definitions!r13c5" 'set phone no. "definitions!r6c1" 'load configuration test mdbus_on 'turn mdbus on End Sub Calta Getting Started With Modbus for Windows.32767)". "slave". 1) Worksheets("definitions"). "definitions!r4c5" 'set start coil to 2 DDEPoke channel. below for an easier way) ' Sub misc_init() mdbus_off ' turn mdbus off DDEPoke channel. "definitions!r3c5" 'set no. "definitions!r4c2" 'set holding register value End Sub ' ' Set Slave Address to value in definitions sheet row 5 column 1 ' Sub set_slave() DDEPoke channel.' ' set holding register value ' Sub set_hr() Dim hrval As Integer Dim hrno hrno = Application. "ststatus". . . of status to 14 DDEPoke channel. . "stcoil". "definitions!r2c5" 'set slave address to 3 DDEPoke channel. "config". "phone". "nohreg". Rev. "definitions!r7c5" 'set no.". "nofloat". "definitions!r5c5" 'set no. to atdt-403-555-1212 DDEPoke channel. "definitions!r6c5" 'set start status to 3 DDEPoke channel. "nocoil".31 2000-Dec-17 Computer Systems Limited Page 14 .Cells(4. 1). 3.Cells(i + 1. 2).The following is an example of an Excel macro used to set up the Control Configuration. "definitions!r6c1" End Sub 'Set Host Control/Display The following are examples of Excel macros used to request data from Mdbus. macro ' Sub request_hreg() Dim datamg Dim i As Integer datamg = DDERequest(channel. Please note that for these examples to work.31 2000-Dec-17 Computer Systems Limited Page 15 . ' ' Set Host Control/Display Configuration ' Sub control_display() DDEPoke channel. "hreg 1 20") 'get data array from mdbus For i = LBound(datamg) To UBound(datamg) Worksheets("data request").Formula = datamg(i) 'xfer data to data request Next i End Sub ' ' request coils macro ' Sub request_coil() Dim datamg Dim i As Integer datamg = DDERequest(channel. you must have at least 20 holding registers starting at 1 and 15 coils starting at 1 configured in Mdbus.Formula = datamg(i) 'xfer data to data request Next i End Sub Calta Getting Started With Modbus for Windows. Rev. "coil 1 15") 'get data array from mdbus For i = LBound(datamg) To UBound(datamg) Worksheets("data request").Cells(i + 1. This is required for all Control from Excel in Host mode. ' ' request holding reg. "control". The following details the values from the definition spreadsheet used in the previous Excel macros. 3. The following is an example of Excel macro that can be called from Mdbus. Rev. ' ' test_beep ' Sub test_beep() Beep End Sub Calta Getting Started With Modbus for Windows.31 2000-Dec-17 Computer Systems Limited Page 16 . The French version of Excel requires [test.xls]scada.xls]scada.5 instead of [text.xls]scada (English default) in the Excel Sprdsht edit box.xls]scada. For instance. Note that the database extension is not used.xls and Worksheet scada and an Access macro called macro1 will be executed in the database db1.xls]scada. the Spanish version uses letters F and C.mdb. and the Polish version of Excel requires [test. The following portion from the Configuration Window shows that data will be poked into an Excel Workbook test. Rev. the German version uses letters Z and S.4. etc.xls and Worksheet scada and a Word macro called macro1 will be executed in the document doc1. the French version of Excel uses letters L and C.Excel Language Configuration The following portion from the Configuration Window shows that data will be poked into an Excel Workbook test. the German version of Excel requires [test.3.31 2000-Dec-17 Computer Systems Limited Page 17 . the Dutch version of Excel requires [test.xls]scada. Different language versions of Excel abbreviate row and column with different letters than R and C.doc.2. Calta Getting Started With Modbus for Windows. Mdbus needs this information to successfully poke data into an Excel spreadsheet. the Spanish version of Excel requires [test.1. 3. The following portion from the Configuration Window shows that data will be poked into an Excel Workbook test.xls and Worksheet scada and an Excel macro called test_beep will be executed. calta.E. 3.403-252-5102 E-mail Web Site . Calgary.31 2000-Dec-17 Computer Systems Limited Page 18 .com .71st Ave.Contact Information For technical support or suggestions for future enhancements. 550 . Canada T2H 0S6 Phone Fax .403-252-5094 .ccompute@calta. Rev.com/ Calta Getting Started With Modbus for Windows. please contact Calta Computer Systems Limited Suite 230. S.http://www. Alberta. 31 2000-Dec-17 Computer Systems Limited S h e e t Page 19 1 . 1 9 9 7 Calta Getting Started With Modbus for Windows. 3.0 1 o f 1 .Monitor Connection Drawing M o n it o r I n t e r c o n n e c t A s s e m b ly 1 5 6 9 2 4 7 8 3 T X 8 T o P L C 3 7 4 R X 9 T o P C 2 6 5 G N D D B 9 M 1 D B 9 F 1 6 2 7 3 8 4 9 5 D B 9 F T o M o n it o r P C r u n n in g M D B U S C a lt a C o m p u t e r S y s t e m s L im it e d T it le M D B U S M o n it o r C o n f ig u r a t io n S iz e D o c u m e n t N u m b e r A D a te : R E V C A B L E IN T E R C O N N E C T Ju n e 1 8 . Rev.
Copyright © 2024 DOKUMEN.SITE Inc.