PLC Excel
July 2002

------------------------Monitor-------------------------
The Newsletter for PC-Based Data Acquisition and Control
Issue 47          www.windmill.co.uk           June 2002
--------------------ISSN 1472-0221----------------------

Welcome to the Monitor newsletter. In this issue an 
experience from Windmill Technical Support illustrates 
how to configure Windmill software for a variety of 
requirements.

We only send this newsletter to people who have 
subscribed - should you wish to cancel your free 
subscription please do so at
https://www.windmill.co.uk/newsletter.html

CONTENTS
========
* Windmill News: Technical Support for Custom PLCs
  1-Identifying the start of a message
  2-Triggering messages and extracting data
  3-Setting up Windmill
  4-PLC data into Excel
  5-Opening a Windmill Logger File
* Data acquisition and control exhibitions
________________________________________________________
________________________________________________________

Windmill News: Windmill Used to Read Custom Logic 
Controller
________________________________________________________

Recently a Windmill customer wanted to use Windmill and 
COMIML to get data from a custom logic controller, 
log the data and pass it to Excel for on- and off-line 
analysis and display. The application posed a number of 
problems which provide a good illustration of how you 
can configure the software for particular requirements.

COMIML
COMIML is a generic driver which lets you acquire data 
from almost any serial device. For more details of 
COMIML see
https://www.windmillsoft.com/daqshop/rs232-modbus.html

The Custom Programmable Logic Controller
The logic controller output a set of binary and 
hexadecimal data values packed as 4 bytes of data every 
few seconds. 

                           *

Problem 1: Identifying the Start of a Message
=============================================
There is no specific start character in the 4-byte 
message sent by the PLC. This means that when COMIML 
starts running in the PC it cannot identify the 
beginning of a message and might pick-up any of the 4 
bytes as its first character. It would then continue to 
try to parse data values from subsequent messages, but 
the bytes would be out of sequence and the data values 
extracted therefore wrong.

Solution: 
Rather than increase the number of data bytes sent by 
the controller, the user decided to modify the controller 
software so that it started a new message whenever it 
received a command from the computer. The command to get 
a set of data would be a single character. COMIML would 
then parse the next 4 bytes received from the 
controller.

                           *

Problem 2: How to Trigger the Message and Retrieve Data
=======================================================
The user next wanted to know how to use Windmill to 
send the character to prompt the PLC to transmit its 
message, and how to parse the received message and 
extract the data

Solution: 
The COMIML driver is configured using the free ComDebug 
communications software. (You can download this from 
https://www.windmillsoft.com/daqshop/rs232-modbus.html).

The user started ComDebug and selected to create a new 
Windmill Instrument file. He would later save this for 
use with the other Windmill programs. He didn't need
an "initialisation message" so chose to add a 
completely new message. The Send or Prompt part of this 
was the single character to trigger a set of data. When 
this was sent, the 4 bytes were returned as the Reply 
message. The Parse option in ComDebug was then used to: 
- Extract individual bits from the first two bytes
- Extract hexadecimal numbers from the last two bytes. 
Each of these was associated with a channel of data. The 
channels are initially numbered from 0 up, but can be 
given names if required. When extracting bits, the bit 
number in the byte is entered as a parameter, with bit 0 
being the least significant bit (i.e. the right hand bit 
when expanding a character byte into bits).

The setup was tested to check that when the Prompt 
character was sent the correct Reply message came back 
and was parsed successfully into the various channels. 
The Windmill Instrument file was then saved as an *.imd 
file.

Back at the opening screen of ComDebug, there is an 
option to Edit Windmill Device. By clicking on this the 
user added his *.imd file to the list of devices which 
Windmill will associate with the COMIML driver. As 
several .imd instrument files can be saved, COMIML can 
be configured for many different devices.

                           *

Problem 3: Setting up Windmill to use the *.imd File
====================================================
When you install Windmill it always inserts the Software 
Signal Generator as the default driver or handler. The 
purpose of the driver is to handle communications with 
the hardware collecting the data. The Software Signal 
Generator creates its own data values internally and you 
can therefore use it to try out Windmill applications 
without the need for any data acquisition hardware. 
However, the user wanted instead to have COMIML as the 
default driver.

Solution:

1. Having earlier installed the Windmill programs and 
   then the COMIML driver, there will have been the 
   opportunity to change the drivers loaded for Windmill 
   applications. If you do not change anything during the 
   installation, the Software Signal Generator will be 
   selected. However, you can later change the drivers - 
   see step 2.

2. Run the Windmill program ConfIML. This shows you 
   which drivers will be loaded for the Windmill programs - 
   you can click Remove to clear out the Software Signal 
   Generator (and any others you do not require), and then 
   click Add to select from a list of installable drivers. 
   For RS232 instrument applications, select COMIML. This 
   will be associated with the *.imd file because of the
   action taken to edit the Windmill Device earlier. The 
   COMIML instrument file will be loaded as device 0 (if 
   it is first on the list of drivers).

3. Run the Windmill program SetupIML. The COMIML driver 
   should be loaded as an icon in the task bar, and the 
   screen should show the number of channels you have 
   previously defined using ComDebug. You can use SetupIML 
   to name the channels for Windmill use. Save the setup 
   you have created with SetupIML.

4. Run the Windmill DDE Panel program, WmDDE. Select the 
   setup file you just created then select all the 
   channels. The data from the controller should now start 
   appearing in the DDE Panel.

Once the data starts appearing in DDE Panel, 
communication has been established with the controller. 
If any items of data have been missed or parsed wrongly 
they can be modified by going back to ComDebug and 
editing the existing Windmill Instrument file.

                           *

Problem 4: Getting Data into Excel
==================================
Next the user wanted to get data into Excel. He wanted to 
display it there in hex format as it appears on his LED 
displays associated with his controller.

Solution: 
Clicking the Copy to Clipboard button in DDE 
Panel updated the Windows clipboard with the current data. 
In Excel, an area of cells to receive the number of data
channels was then selected. From Excel's Edit menu, 
"Paste Link Special" placed the updating data values in 
the cells.

To further analyse the data values as they come in, 
using VBA, see the sample DDE code on the Windmill 
web site at https://www.windmill.co.uk/excel/ 

                           *

Problem 5: Opening a Windmill Logger File
=========================================
The user found Windmill Logger to be useful to view 
data, but was unsure of how to get back the data once it 
had been saved to disk. 

Solution: The logged data is stored in ASCII format, and 
so he could use Windows Notepad to open and view the 
*.wl file created by Windmill Logger. This quickly 
confirmed that data has been collected. The Logger data 
files are tab separated, and depending on the length of 
the data values for each channel, a neat tabulation of 
the data may not be possible with Notepad (the tab 
settings being too close together). 

For further analysis or report generation the Logger 
data file can be read into Excel. Using File.Open in 
Excel, and selecting the option for all files, the *.wl 
file can be loaded. Excel will recognise this as a tab 
separated value file and the default options offered by 
the spreadsheet for interpreting the structure can be 
used.

                           *

We hope you found this problem solving experience from 
Windmill Technical Support useful. If you would like 
help with your application: 
Fill in the form at the bottom of 
https://www.windmill.co.uk/techsupp.html
Ring +44 (0)161 834 6688 or 
E-mail techsupport@windmill.co.uk
Don't forget that a complete guide to using each of the 
Windmill programs appears when you choose the Help item 
on the program's menu bar. The latest version of the 
Help files are free from
https://www.windmill.co.uk/help.html
________________________________________________________
________________________________________________________

Exhibitions and Conferences
________________________________________________________

Every other month we list forthcoming exhibitions and 
conferences related to data acquisition and control.

Control & Instrumentation Asia
9-12 July
Singapore
Part of PSA 2002, the exhibition runs alongside 
Watertec, Envirotec, Chemtec and Motion, Drive & 
Automation.
http://www.psa2002.com/main.htm

IEEE AutotestCon 2002
21-24-August 
Huntsville Al USA 
Conference focusing primarily on automated test and 
related technology for military, government and 
aerospace applications. 
http://www.autotestcon.com/

Scanlab
2-5 September
Bella Center Copenhagen Denmark
Fair and conference for laboratory equipment, measuring 
technology and process control.
http://www.scanlab.dk/

Instrumentation Scotland and Offshore Systems
4-5 September
Aberdeen UK
http://www.instrumentation.co.uk/

ATDC 2002
12-14 September
Slavonski Brod, Croatia
A European forum to exchange scientific, technology and 
manufacturing knowledge between Western Europe and 
Central and Eastern Europe. Topics include product 
development, production technologies, information 
technology, quality assurance and measurement.
http://www.sfsb.hr/atdc2002/atdc2002.html

Sensors Expo
23-26 September
World Trade Center Boston USA
Brings together the technologies that are shaping 
sensing, data acquisition, control and communications. 
http://www.sensorsexpo.com/

Wescon North America
24-26 September
Anaheim Convention Center California USA
Exhibition including test & measurement and hardware & 
software design.
http://www.wescon.com/ 

________________________________________________________
________________________________________________________

* Copyright Windmill Software Ltd
* Reprinting permitted with this notice included
* For more articles see https://www.windmill.co.uk

We are happy for you to copy and distribute this 
newsletter, and use extracts from it on your own web site 
or publication, providing the above notice is 
included and a link back to our website is in place.


An archive of previous issues is at 
https://www.windmill.co.uk/newsletter.html
and an index of articles at 
https://www.windmill.co.uk/newsletter.html

Windmill Software Ltd, PO Box 58, North District Office,
Manchester, M8 8QR, UK
Telephone: +44 (0)161 834 6688
Facsimile: +44 (0)161 833 2190
E-mail: monitor@windmillsoft.com

https://www.windmill.co.uk/

https://www.windmillsoft.com/



Subscribing

To receive Monitor every month please fill in your e-mail address below. We will not pass your address to any third parties, nor send you any unsolicited e-mail.

You will receive an e-mail asking you to confirm your subscription. On doing so you will be sent details of how to download the free software. If you don't receive this e-mail please contact monitor@windmillsoft.com.

You can read an archive of previous issues on our Data Acquisition Intelligence site.

Cancel Subscription

You can cancel your free subscription at any time - just return to this page or follow the instructions in the newsletter.

Previous Issue Next Issue