Windmill Software Ltd |
August 1999 |
Monitor Newsletter Archive |
Issue 13: Feeding Laboratory Instrument Data into Excel, VB Programs, etcCONTENTSWindmill News | Linking to Excel, Access, etc. | DDE Links | VB Corner WINDMILL NEWS: MORE FREE TECHNICAL SUPPORT ON THE WEBWe are striving to offer the best possible technical support for our free Windmill software. To this end we have improved our web-based support offerings.
We hope you find the new and improved pages useful. Don't forget that you can also obtain the full, printed, manuals from our shop. Finally, if you can't find what you're looking for on the web or in the manual, please fill in our technical support form or telephone us on +44 (0)161 833 2782. LINKING WINDMILL TO EXCEL, ACCESS OR OTHER SOFTWAREWindmill software reads data from instruments and devices connected to your PC. You could use it, for instance, to monitor and control temperatures. We have a range of drivers for many types of hardware, and our serial instrument driver is now free to our newsletter subscribers. You may want to use the data you get through Windmill in other applications - perhaps to average readings over time or a number of sampling points; to calculate control outputs; or to put data directly into reports and databases. You can either collect data with the Windmill Logger, and after collection has finished import it into your spreadsheet or database. Alternatively you can transfer data as it arrives, using dynamic data exchange. The simplest way to do this is to use the free Windmill DDE Panel to act as a gateway to get and send data values from your application. This works well for Office programs such as Microsoft Excel, Access or Word. You can also use DDE if you are writing your own application code, in say Visual Basic, C, or another application generator. Alternatively you may wish to use Windmill's IML Toolkit to send and get data values from the hardware directly. Details of the IML Toolkit are at http://www.windmill.co.uk/test.html * DDE LinksUsing dynamic data exchange to communicate between applications, the Windmill DDE Panel lets you copy and paste live data into Excel, Access or Word. For more sophisticated tasks, you can use macros. Analysis and control with an Excel spreadsheet To try out data acquisition into Excel
Issue 16 of Monitor gives details of charting data from Excel. VB CornerOver the next few months we're including a "VB Corner". This section will give you hints, tips and code samples for using Windmill applications and data from Visual Basic programs. (You don't need to do any programming to use Windmill, but if you want to create your own Visual Basic applications you will find this section useful.) * Using DDE to get Data from your Instrument into your VB ProgramThis month we discuss how to get data from your instruments, via the Windmill software and dynamic data exchange, into your VB program for analysis, processing and so on. Hint: When you're trying out communication between your software and Windmill - use the free Software Signal Generator. This generates data quickly and without the need for additional hardware. The Software Signal Generator (the SIGGEN device) is supplied with all versions of Windmill. You can download the project and code for this month’s VB corner. We use a label control on the VB form with the following properties: Name laDDEmessage Visible False The subroutines that do the work are as follows. When the VB application loads, we need to open the DDE conversation with the DDE Panel application. You should open the conversation once, when you load, because repeatedly opening and closing the conversation causes a memory leak which will eventually crash your application Private Sub Form_Load() ' the default DDE name for the Windmill DDE Panel is Windmill laDDEMessage.LinkTopic = "Windmill|Data" laDDEMessage.LinkMode = 2 End Sub Here Windmill is the default name given to the Windmill DDE Panel for its DDE conversations. You can change this in the Panel by selecting the DDE item from the File menu. When the VB application terminates we can tidy up by resetting the LinkMode to close the DDE conversation. Private Sub Form_Unload(Cancel As Integer) laDDEMessage.LinkMode = 0 End Sub The Receiving and Sending of data values is done as follows: Private Function GetIMLdde(IMLChanName$, ReplyMessage$) GetIMLdde = False laDDEMessage.LinkItem = IMLChanName$ On Error GoTo GetIML_Error laDDEMessage.LinkRequest DoEvents GetIMLdde = True ReplyMessage$ = laDDEMessage.Caption GetIML_Exit: Exit Function GetIML_Error: Resume GetIML_Exit End FunctionAnd: Private Function SendIMLdde(IMLChanName$, DataMessage$) As Integer SendIMLdde = False laDDEMessage.LinkItem = IMLChanName$ laDDEMessage.Caption = DataMessage$ On Error GoTo SendIML_Error laDDEMessage.LinkPoke DoEvents SendIMLdde = True SendIML_Exit: Exit Function SendIML_Error: Resume SendIML_Exit End Function Note that the routine to get data from an IML input channel uses the .LinkRequest method, while the routine to send a data string to an IML output channel uses the .LinkPoke method. That's the end of this month's VB Corner. Our other Visual Basic articles are in:
Do you have a comment or suggestion for this newsletter? E-mail the editor - Jill - at monitor@windmill.co.uk Copyright 1999 Windmill Software Ltd. All rights reserved. This newsletter may be distributed in its entirety. However, individual sections may not be reproduced without the prior written agreement of Windmill Software Ltd. SubscribingTo receive Monitor every month please fill in your email address below. We will not pass your address to any third parties. | |
Previous Issue
Recommend this Monitor newsletter to a Friend
Home | On-Line Shop | Free Literature and Software Demos | Contents | Search
Next Issue
| Copyright Windmill Software Ltd 2006 PO Box 58, North District Office, Manchester, M8 8QR, UK. E-mail:monitor@windmill.co.uk, Tel:+44 161 833 2782 http://www.windmill.co.uk/ Designed by Studholme.net |