Windmill Data Acquisition Software Logo
27 March 2014

Windmill Software Ltd
Data Acquisition Intelligence
Call now: +44 (0)161 833 2782

Monitor - ISSN 1472-0221
The Newsletter for PC-Based Data Acquisition and Control
Issue 188, March 2014

This week a reader asked our advice about transferring his USB measurement equipment to Windows 8. If you've had any problems with USB systems under the latest version of Windows, read on below. We also have our regular Excel corner, this month with why and how to declare variables; and our Windmill question and answer section on using an energy meter with Modbus and RS485.

Thanks very much for subscribing, and if you wish to download our free data acquisition software you may do so.

You can download Monitor as a pdf file from

We hope you find Monitor useful, but should you wish to remove yourself from our mailing list you can do so at Monitor Newsletter

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


* How to Install USB Devices under Windows 8
* Questions on Using Windmill: Energy Meter using Modbus over RS485
* Excel Corner: Why Declare Variables?
* DAQ News Round-up

How to Install USB Devices under Windows 8

Web link:

With the release of Windows 8, Microsoft imposes more restrictions on what it will let you install. The casualties include legitimate USB device drivers. If Windows 8 is not recognising your USB instruments, you need to disable Windows driver enforcement before installing your USB drivers.

Disable Windows Driver Enforcement

This involves restarting your computer three times. Make sure then that you have closed any open programs before proceeding.

  1. Tell Windows you are about to temporarily change your computer settings.
    1. Move your mouse to the bottom right of your screen.
    2. Select the Settings gear and choose Change PC Settings (at the bottom of the menu).
      Installing USB device under Windows 8: Change PC Settings
    3. In the Change PC Settings menu, choose General.
      Installing USB device under Windows 8: Changing PC Settings
    4. Scroll down to Advanced startup and click the Restart now button. Your computer will reboot.
  2. When the computer restarts you'll be asked to choose an option.
    1. Select Troubleshoot
      Troubleshoot Startup Settings
    2. From the menu that appears choose Advanced Options followed by Startup Settings.
      Installing USB device under Windows 8: Change PC Settings
    3. From the Startup Settings screen, click the Restart button. You computer will again reboot.
  3. At the Startup Settings screen, press either the 7 or F7 key on your keyboard to disable driver signature enforcement. Your computer will again restart.
    1. Sign in as normal.
    2. You can now install your USB drivers.

Install the USB Device Drivers

  1. Open Control Panel and select the Hardware and Sound option.
  2. Choose Device Manager.
    Installing USB device under Windows 8: Change PC Settings
  3. Under "Other Devices" you will see your USB data acquisition hardware with a yellow warning sign. Right click the device. The USB Properties box appears.
  4. Select the Driver tab and choose the Update Driver button.
  5. Browse for your driver. For a Windmill system the driver is in your Windmill folder, for example c:\Windmill Software\Windmill\Drivers64\. Click Next.
  6. Windows will ask you confirm that you want to "install this driver software anyway".
    Installing USB device under Windows 8: Change PC Settings
  7. You are now ready to use your USB device.

When you next restart your PC, Windows' driver enforcement will be restored. Windows doesn't allow you to permanently turn it off.

Any questions e-mail [email protected]. You can see Windmill's range of USB measurement and control hardware at

Questions on Using Windmill: Energy Meter using Modbus over RS485


I've connected a USB-RS485 port. In Comdebug, I'm trying to Edit the message. The instrument manual says that 03H reads multiple register from BTU meter, 06H writes single register from BTU meter and 10H writes multiple register from BTU meter. I input Bytes1, 2 and 3 as 0,3,H. Bytes 4,5,6 as 0,6,H and Bytes 7,8,9 as 10H. The status gives all COM input lines as false and COM output lines as both true. But there is no reply from the instrument. What is wrong?


It looks like your meter is using the Modbus communications protocol. So in ComDebug's Hex column you would need to enter as follows
Byte 1: the address of the devices
Byte 2: 03
Byte 3: msb (most significant byte) of register starting address
Byte 4: lsb (most significant byte) of register starting address
Byte 5: msb of number of bytes to read (normally 0)
Byte 6: lsb of number of bytes to read, for example 2
Byte 7: CRC - use the CRC menu
For a full explanation see

Excel Corner: Why Declare Variables?

When we write Excel macros, we use variables to store values in Excel's memory.

Although not essential, it is good practice to declare the type of variables you are using. Why?

  • Your code will use less memory
  • Your code can run faster
  • It makes debugging easier, because the VBA Editor will then be able to highlight errors it would otherwise miss.
  • You'll have access to intellisense. This shows you which properties and methods you can use with your type of variable. In the Visual Basic Editor just type the name of the variable followed by a dot.

To force yourself to explicitly dimension all variables, put the line "Option Explicit" at the top of your code window. Excel will now pick up any mis-spelled variables. For example, if you are using a variable called MyData, and you later spell it MyDate, Excel will flag this as an error. Without using Option Explicit, Excel would create a new variable called MyDate and initialise it to 0 or an empty string.

Naming Variables

A variable name must contain only letters, numbers and underscores, and may not start with a number. Some people like to start a variable name with a letter which represents their data-type. For example, i for integer or str for string. This makes it clear with which type of variable you are dealing. Some common prefixes for variables are given below.

Types of Variables, their Prefixes, Storage and Range of Values

by   Byte       1 byte             unsigned integer 0 to 255

b    Boolean    2 bytes            True or False
i    Integer    2 bytes            -32,768 to 32,767

l    Long       4 bytes            Integer, approx. +/-2 billion (giga)

s    Single     4 bytes            Floating point

d    Double     8 bytes            Floating point	

c    Currency   8 bytes            approx +/-922 trillion (tera) 
                                   with 4 decimal places

dt   Date/Time  8 bytes            January 1, 100 to December 31, 9999

str  String     Length of string   1 to 65,400 characters

obj  Object     4 bytes            Any embedded object

var  Variant    16 or 22 bytes     Any kind of data except 
                                   fixed length string

Declaring a Variable

To declare a variable simply use a Dim (short for Dimension) statement like this

Dim VariableName as Data Type

for example

Dim str_VarName as String
Dim b_True_or_False As Boolean
Dim ddechan As Integer

Although you can declare all variables in one statement, like

Dim a, b, c, As Integer


You would think that that would declare a, b and c as integers. Actually, only c is declared an interger and a and b are "variant". The Variant data type can hold any sort of data. It has a numeric storage size of 16 bytes and a string storage size of 22 bytes plus the length of the string. All undeclared variables are Variants.

Instead use

Dim a As Integer, b As Integer, c As Integer 


Dim a As Integer
Dim b As Integer
Dim c As Integer

Always choose the type of variable which takes up the least storage space. This means that you should generally avoid using Variant. However, when you are using DDE Requests to obtain data, this is the variable type to use. For example,

Dim myData As Variant
myData = DDERequest(ddechan, "AllChannels")

Finally, a note on terms

Integer - Whole numbers, for example 1 and -300.

Floating Point - A number which can contain a fractional part, a real number. For example, 1.0 and -500.5. It is called floating point because there is no fixed number of digits before or after the decimal point.

More Tips on using Excel

For more on writing macros in Excel see our Excel tips page at or contact [email protected].

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 follow us on Twitter - @DataAcquisition or Google+ -

Living plant sensors can monitor pollution

By embedding carbon nanotubes into plants, MIT researchers have made them detect the gas nitric oxide. The plants fluoresce in the presence of the gas, functioning as a photonic chemical sensor.
Source: MIT

Tiger Sharks collect data for researchers

Scientists are attaching satellite transmitters, depth sensors and small video cameras to large tiger sharks in Australia. They can track their movements (when they surface) and see exactly what they are doing.
Source: OceansIQ

Smart sensor market to grow by 36%

According to a report by Markets and Markets, the total revenue of global smart sensor market is expected to grow at an estimated CAGR of 36.25% from 2013 to 2020. They expect it reach $10.46 billion in 2020 from $650 million in 2012.
Source: Markets and Markets

Sensor backpacks for oysters say when they are happy

At an oyster farm in Tasmania, shellfish are having sensors strapped onto their backs to monitor their health
Source: New Scientist

* Copyright Windmill Software Ltd
* Reprinting permitted with this notice included
* For more articles see
We are happy for you to copy and distribute this
newsletter, and use extracts from it on your own web
site or other publication, providing the above notice
is included and a link back to our website is in place.

For previous issues by subject see

As a thank you for subscribing we offer you the ComDebug data logging and Com port trouble-shooting software for free. Log data over RS232, RS422, RS485 or Modbus. Also included is a free month's trial of the Windmill 7 logging, charting and control programs.

SUBSCRIBING OR CANCELLING SUBSCRIPTION Visit and add or remove your e-mail address.

Windmill Software Ltd, PO Box 58, North District Office,
Manchester, M8 8QR, UK
Telephone: +44 (0)161 833 2782
Facsimile: +44 (0)161 833 2190
E-mail: [email protected]

Subscribe to Monitor


Previous Issue Next Issue

Previous Issue Next Issue


Tip: For a speedy response, when using Google+ comments alert us by adding +Windmill Software