Windmill Data Acquisition Software Logo
30 April 2013

Windmill Software Ltd
Data Acquisition Intelligence
Call now: +44 (0)161 834 6688


-------------------------Monitor------------------------
The Newsletter for PC-Based Data Acquisition and Control
Issue 177         www.windmill.co.uk          April 2013
--------------------ISSN 1472-0221----------------------

Welcome to April's newsletter. If you are interested in 
measurement and control tips, why not also join the new 
Google+ Data Acquisition Community? 
https://plus.google.com/communities/112455140252887229395

I hope you enjoy this issue, but should you wish 
to remove yourself from our mailing please go to 
Monitor Newsletter

CONTENTS
========
* Capturing Data from High-Numbered Com Ports
* Excel Corner: Finding the Last Empty Row
* Data Acquisition Exhibitions
* DAQ News Round-up

Follow @DataAcquisition on Twitter Google+ Data Acquisition News Feed (RSS)
________________________________________________________
________________________________________________________

Capturing Data from High-Numbered Com Ports
________________________________________________________

By default, the free Windmill ComDebug software 
logs data from instruments connected to Com ports 
numbered between 1 and 24. This month a Windmill user 
asked us how to select a virtual port with a higher 
number than 24. 

There are two ways to do this.

1. Assign a lower number to the virtual COM port.
2. Use, for example, Notepad to edit the ComDebug Instrument File

Assigning a New Virtual COM port number
=======================================

Many people use a USB-to-Serial converter to access data 
from their measurement instruments.

When you plug the converter into the computer's USB port, 
Windows will assign it a COM port number. You can find out 
what this is by opening Windows Control Panel and choosing 
first System then Device Manager then Ports. It will look 
something like "USB serial port(Com X)", where X is the 
COM port number assigned. (A question mark indicates that 
there is a problem with the drivers or the connection.) 

To resassign a lower number to the port, use Windows Device 
Manager. Select your converter and click Properties. Choose 
Port Settings then Advanced.
Com port settings

Windows may list all the lower COM port numbers as in use. 
This is not always so: look at the computer's actual COM ports 
physically available and you may find a lower port number.

For more information see our USB-Serial Converter page at 
https://www.windmill.co.uk/usb-serial.html.

Editing the ComDebug Instrument File
====================================

You can alternatively keep the high virtual port number, 
and adjust settings in ComDebug. 

Within ComDebug, save your current ComDebug settings - 
select Save .IMD File from Main Menu. 



You can now edit this file manually. Use Notepad (or 
similar) to open the *.IMD file you have just saved and 
edit the port parameter.  Change Port=4 (for example) to, 
say, Port=25. Save and close the file.  In ComDebug open 
the new IMD file: from the opening screen choose "Edit an 
Existing Windmill Instrument File".

Download the Free ComDebug Serial Data Collection Software
==========================================================

ComDebug is free to all Monitor subscribers.  It logs 
data from sensors and devices connected to the PC's Com 
port over RS232, RS422, RS485 and Modbus. It also helps 
you solve serial connection problems with many trouble-
shooting capabilities.
________________________________________________________
________________________________________________________

Excel Corner: Finding the First Empty Row
________________________________________________________

One of our readers, Thomas Hundebøl Thomsen, writes:
"I use Windmill dde to log data into Excel next 
row via a macro. It works fine too. But when 
the screen is filled by row No. 25, the new data will not 
be visible until I manually user page down. How do I get 
the screen to follow the latest data as when (one) 
normally keys data into Excel? Currently it is a weight 
of harvested tubers and the tractor operator must check 
that the weight is ok before lifting the next 
experimental plot."

To do this you could find the first empty row, jump to 
this and then write in the data.

The macro code to find the first empty row is:

Dim LastRow As Long
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
LastRow = LastRow + 1

Actually, what this does is find the number of the last 
row in Column A with data in it and then adds 1 to give 
the first empty row. The code above assumes you are 
collecting data in a worksheet called "Sheet1".

How the Code Works
==================
Rows.Count returns a count of the number of rows in 
the worksheet: eg 65536 in many versions of Excel or 
1,048,576 in Version 10 of Excel.

Sheet1.Cells(Rows.Count, "A") means the last cell in 
column A - eg Cell A65536.

End(xlUp) is equivalent to pressing the Ctrl and Up Arrow 
keys on the keyboard when in Excel. That is, it moves to 
the top cell in the current data range. If no data is in 
the currenct cell (as in our case) it moves to the 
first cell above which contains data. 

LastRow = LastRow + 1 just adds one to this to give 
the first empty cell in Column A.

To stop this macro press the Esc key.

The full code is as follows


Data Acquisition with Excel

----------------------------------------------

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub SampleData()

'Ask for sample interval.
SamplePeriod = InputBox("Enter sample interval in secs", "Sample Interval")

' Convert to milliseconds - needed for sleep statement below.
SamplePeriod = SamplePeriod * 1000

'Repeats data collection
DoAgain:

'Initiates conversation with DDE_Panel
ddeChan = DDEInitiate("Windmill", "Data")

'Requests data from all channels and stores it in
'memory in an array called mydata.
mydata = DDERequest(ddeChan, "AllChannels")

' Ignores any warnings generated
On Error Resume Next

'Finds the lower & upper boundaries of array, to determine the
'number of columns needed to store the data.
Lower = LBound(mydata, 1)
Upper = UBound(mydata, 1)

'Finds first empty row
Dim LastRow As Long
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
LastRow = LastRow + 1
ActiveSheet.Cells(LastRow, Column).Select

'Inserts data from the array into a row of cells in Sheet1.
For Column = Lower To Upper
Sheets("Sheet1").Cells(LastRow, Column).Value = mydata(Column)
Next Column

'Closes the DDE conversation
DDETerminate (ddeChan)

'Waits for the specified sample interval
Sleep SamplePeriod

'Repeats the process
GoTo DoAgain

End Sub
----------------------------------------------

More Excel macros - including timestamping, logging only 
when new data arrives and automatically starting and 
stopping logging - are on our website at 
https://www.windmill.co.uk/excel/excel-tips.html

Have an Excel question? Send it to 
monitor@windmillsoft.com.
________________________________________________________

Data Acquisition Exhibitions and Conferences
________________________________________________________
________________________________________________________

The quarterly update of data acquisition and control 
exhibitions around the world.

SPIE Defense, Security, and Sensing
  29 April - 3 May 2013
  Baltimore United States
  Conferences on optics, imaging and sensing for 
  defence, security, industry and the environment.
  http://spie.org/defense-security-sensing.xml

Israchem
  30 April - 2 May
  Tel Aviv, Israel
  Trade show for processing, chemical engineering, 
  measurement, control and instrumentation.
	
Medtec UK
  1-2 May
  London UK
  Conference for medical equipment manufacturers. 
  Topics include: wearable wireless sensors and devices 
  and agile approaches to electronic device development.
  http://medtecukshow.com/
	
National Manufacturing Week
  7-10 May
  Melbourne Australia
  Biennial exhibition includes process & 
  control and manufacturing.
  http://www.nationalmanufacturingweek.com.au/

International Fair of Technique and Technical Achievements
  13-17 May
  Belgrade, Serbia
  Covers measuring devices and instruments and 
  processing equipment. 
  http://www.beogradskisajamtehnike.rs/
	
Manutec Africa
  14-16 May
  Gauteng South Africa
  Manufacturing technologies expo including process 
  control, automation, computers in manufacturing, 
  sensors and instrumentation and drives and controls.
  http://www.exhibitionsafrica.com/ems/manutec.html

Sensor +  Test
  14-16 May
  Nurnberg Germany
  Fair of sensors, measuring, and testing systems.
  http://www.sensor-test.de/

Product Design + Innovation
  15-16 May
  The Oval, London, UK
  Conference explores how product design can drive 
  economic growth. Topics include: Internet of things - 
  designing connected objects; Emerging industries - new 
  fields for design and The circular economy - designing 
  for reuse, repair and recycling.
  http://www.pdesigni.com/

MTA Vietnam
  2-5 July
  Ho Chi Minh City Vietnam
  Incorporating Metrology and Automation Vietnam.
  http://www.mtavietnam.com/
________________________________________________________
________________________________________________________

DAQ News Round-up
________________________________________________________

Welcome to our round-up of the data acquisition and 
control news.  If you would like to receive more 
timely DAQ news updates then grab our RSS newsfeed 
at https://www.windmillsoft.com/monitor.xml.  Read 
https://www.windmill.co.uk/newsfeed.php for notes
on how to display the news on your own web site or 
automatically tweet it.

In-Road Sensors Weigh Lorries in Motion
   A project in Norway aims to deter hauliers from 
   overloading their vehicles by developing a system 
   that checks and weighs HGVs whilst they are in 
   motion. Advanced sensors installed in the road 
   surface, combined with number plate recognition 
   systems, will enable the detection of far more 
   incorrectly loaded trailers.
   Source: The Engineer
   https://www.theengineer.co.uk/
	 
Wireless "Smart Skin" Sensors could provide remote Monitoring of Bridges
  Major bridge failures in recent years have focused 
   attention on the need to monitor highway bridges and 
   other infrastructure. Researchers are developing a 
   novel technology that would facilitate close monitoring 
   of structures for strain, stress and early formation 
   of cracks. Their approach uses wireless sensors that 
   are low cost, require no power, can be implemented on 
   tough yet flexible polymer substrates and can identify 
   structural problems at a very early stage. The only 
   electronic component in the sensor is an inexpensive 
   radio-frequency identification (RFID) chip.
  Source: Georgia Institute of Technology
  http://www.gatech.edu/newsroom/release.html?nid=206881
	
Underwater Robot Successfully Tested at Sea
   Underwater robot passes test to retrieve aircraft 
   black boxes at sea.
   Source: SCUBA News
   http://news.scubatravel.co.uk/underwater-robot.html

Remote Sensing Study Yields Unprecedented Detail on Arctic Wetlands 
   A team of geoscientists using newly available remote-
   sensing technology has achieved unprecedented detail 
   in quantifying subtle, long-period changes in the water 
   levels of shallow lakes and ponds in hard-to-reach 
   Arctic wetlands. 
   Source: Southwest Research Institute
   http://www.swri.org/9what/releases/2013/alaska-wetlands.htm
________________________________________________________
________________________________________________________

* 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/monitorindex.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.

Subscribe Monitor

*  Email:
*  Format:

Previous Issue Next Issue