Overview

The Windmill suite of software lets you read and control instruments connected to your PC over RS232, RS422, RS485, Modbus and TCP/IP. The first four are collectively known as serial instruments. TCP/IP is a network protocol used, for example, by instruments connected via Ethernet and Internet.

Use ComDebug to interactively establish communications with your instrument, saving your settings in a file (*.imd).

Windmill can control up to 10 instruments which are sending ASCII, binary or hexadecimal data. For each instrument use ComDebug as follows.

  1. From the opening screen select Create a new Windmill Instrument File and choose Serial or TCPIP communications. Fill in your communication settings, click OK or Connect and the Main menu appears.
  2. Choose your instrument timings: Read in background or Read directly.
  3. Create data channels to hold your data.
  4. Establish communications by sending messages and viewing the instrument’s reply
  5. Parse the reply to extract data
  6. Choose whether to automatically read data from the instrument in the background, or to read the instrument only when data is required
  7. Press Run to check everything is working
  8. Save the instrument file
  9. Define a Windmill device as a collection of .IMD files.

Free Version of ComDebug

If you have only the free version of ComDebug, without the other Windmill programs, you can log data from one instrument and test serial communications.


Entering your instrument's communication settings

You need to tell ComDebug about your instrument's communications.

From the opening screen select Create a new Windmill Instrument File and choose Serial (for RS232, RS422, RS485 and Modbus devices) or TCPIP communications (for Ethernet and Internet).

Fill in your communication settings, click OK or Connect and the Main menu appears. You can now enter your instrument's timings.

Next...


Choosing Instrument Timings

Windmill can either:

  • automatically take readings from your instrument in the background, or
  • take readings only when requested to do so (Read Directly).

To choose which method to use: from the Main Menu select Edit the Instrument Timings.

  1. If your instrument continually sends data without needing a command prompt, choose Read in the Background.
  2. If your instrument responds slowly to a request for data, choose Read in the Background.
  3. If your instrument needs a command prompt to send data, and then responds quickly, choose Read Directly.

If in doubt choose Read in the Background.

Next...


Creating Data Channels

Data channels are streams of data that can be read from, or written to, instruments.

You can give names to channels to help you remember which channel does what. The names will appear in Windmill when you start to use it. You can also set expected maximum and minimum values to help with automatic scaling of graphs.

  1. In the Main Menu select Edit the data channel details.
  2. Select Add Channel and type in a name. This should be unique and not be duplicated across instruments.
  3. To allow automatic scaling of graphs by Windmill, type the largest and smallest data values that you expect into the Max and Min cells for each channel. These values are optional, and do not impose any limits on the data collected.

Note: The Mode shows whether the channel will read data from an instrument, write (send) data to it, or is unallocated and blank. You can't edit the mode.

The Msg shows where you can find the data channel. You can't edit this: it is set automatically when you allocate a channel to a data item in a prompt or parse string.

Next...


Establishing Communications: Sending Messages and Viewing the Instrument's Reply

From the Main Menu select Edit message_1. The Terminal or Message Edit screen appears.

Here you can send commands and data to the instrument, and view the reply. For those instruments that require it, you can send an acknowledgement when the reply is received.

  1. Consult your instrument’s Manual for details of the command to send to extract data. We have some examples for various instruments on our web site at windmill.co.uk. (Some instruments automatically send data without prompting, in which case you will not need to specify a command or prompt string.)
  2. Type this command into the Prompt string grid. Use the Edit menu to delete or insert rows as necessary. If you need to enter non printing characters use the NonPrint menu. Alternatively you can enter Hexadecimal code into the Hex column.
  3. Select Send. If all is well the instrument’s reply is shown in the Reply grid. You can now parse the reply: extracting its data items and assigning them to channels.
  4. No reply? Check you've entered any non-printing characters needed in the prompt string: a Carriage Return at the end of a command for example. Also, for serial devices connected to the COM port,
    • Press the Status button to see possible errors.
    • Make sure you've entered your COM port settings correctly.
    • For more tips see Understaning RS232 or Understanding RS422 and RS485..
    • For example prompt strings for different makes of instrument, see our website.

Next...


Parsing the Reply to Extract Data

Once you have established communications, use ComDebug to parse the instrument's reply and extract the relevant data.

The reply sent by the instrument might contain just one item of data, or several. Each data item is allocated to a channel. For example, channel 0 might hold a temperature reading whilst channel 1 holds a humidity reading.

  1. Look at the instrument’s Reply and decide which part of it you want to extract.
  2. Press the Parse button. The Reply Parser window appears.
  3. You now need to tell the Parser how to find the first data item in the Reply string. To do this click the first empty cell of the Action column and select one of the options on the Add Action menu: Search, Ignore N Bytes, Ignore Until or Custom. In the Parameters column type, for example, your search string. For non-printable characters like carriage returns, use the NonPrint menu. The next parse operation will act on the character after a search string, or on the first unignored byte or character. For instruments which continually send data, choose Search or Ignore Until as you do not know where in the message you may be starting.
  4. Once you reach the data, use the Extract menu to obtain it. Click the next empty cell in the Action column and choose an item from the Extract menu.
  5. Each extracted data item is stored in a channel, so the Channel Details dialogue appears. Choose a channel you have created or Add a new channel then select it. The channel you choose is shown in the Channel column in the Reply Parser window. If you have chosen to Extract N Bytes, or Extract Until, then type the number of bytes or a character into the Parameters box. Once you now move the focus of the cursor, the data is extracted to the Value column.
  6. Should the data extracted not be what you wanted, you can examine the parser operation step-by-step. Repeatedly select the Step menu.
  7. Repeat steps 3 and 4 for each value you want to extract then press OK.

You have now configured one or more channels to provide data.

Parsing Notes

It is good practice to continue your parsing to the very end of the instrument's reply. If you finish parsing when you have the data you need, but more bytes are still to come, then Windmill might send a further Prompt message whilst the previous reply is still arriving. These final bytes might then be mistaken for the start of the next reply.

It is always best to identify the reply start in some unambiguous way if this is possible. For example if the reply message was "T=123<CR> " then you should always search for "T=" rather than ignore 2 bytes. This is especially important with continuous flow instruments, where the instrument continually sends data without any prompting.

It is always possible that we start looking for a continuous flow message just when the instrument is halfway through sending the message. In this case we will only get the later part of the message. If we can identify the message start then these bytes will be ignored and ComIML will wait for the next complete message assuming that the TimeOut is set to a sufficient value.

Sometimes identifying the start is not possible. For example if the message were "123<CR>" where the 123 could be any number and could be a variable length, then you could Extract to <CR> which would work if there was a reply to a prompt. However if this were continuous flow such an action could sometimes return less than all the digits. The best strategy would be to search for <CR> then Extract to <CR>. This would work reliably but only gets data from every other message sent by the instrument.

More notes on parsing data, and examples for specific instruments, are on our Web site.

Next...


Logging Data

Logging with ComDebug

If you have the free version of ComDebug, and your Windmill trial has expired, you can use ComDebug to log data from one instrument. We have included a demo setup to get you started. To log from your own instrument: establish communications, set instrument timings and enter instructions to extract the data from the received message. Now click Run. The Display screen appears.

  1. Select the File menu to choose whether to save logged data in a file, or just show it on screen.
  2. Click Sample Rate to choose the speed of logging.
  3. Click Start to log data.
  4. To show messages about what is going on, select Status Display.

When saved, the data is stored in a tab separated file you can later open in, for example, Excel.

Logging with Windmill Logger

Windmill and the COMIML serial driver can log many channels of data from up to 10 instruments. Follow the instructions in the Help Overview for the steps to take to use ComDebug to establish communications with your instruments and save your settings. When you have done this you can use the Windmill SetupIML program to set things like alarm levels and engineering units, and the Windmill Logger program to collect data.

Differences between Windmill Logger and ComDebug

Features | Windmill Logger | ComDebug
Number of instruments can log from: | 10 | 1
Start logging when you click Start: | yes | yes
Start logging on an alarm: | yes | no
Start logging when new data arrives: | yes | no
Start logging on a key press: | yes | no
Log different channels at different rates: | yes | no
Automatically start new data files: | yes | no
Highlight channels in alarm: | yes | no
Import data into Excel after collection: | yes | yes
Import data into Excel in real-time: | yes | no


Understanding Messages

Data communications between the COMIML serial driver and the instruments consist of one or more messages. A message comprises a sequence of 3 parts: Prompt String, Reply String and Acknowledgement String.

Prompt String

This is sent by Windmill to the instrument. You can send a fixed string, or insert output channels. These let you later enter data to be sent to the instrument, using, for example, Windmill AnalogOut or Excel. Some instruments send data without any prompting.

Reply String

This is sent from the instrument to the computer. It will contain one or more items of data. Use the Parser to extract the relevant data from the string. Each type of data item you extract is allocated to a channel. So, for a GPS receiver for example, you might have Channel 0 holding latitude readings and Channel 1 holding longitude readings.

If you used the prompt string simply to set a parameter of the instrument, there may be no reply.

Acknowledgement String

Some instruments having sent a reply require an acknowledgement to complete the message. In many instruments it will not be needed.

Each message is given a name in the sequence:

Initialisation
Message_1
Message_2
etc


Sending an Initialisation Message

An Initialisation message is sent when the COMIML driver loads, and only then. It is not generally needed and you can often leave this message blank.

If your instrument does need initialising then:

  1. From the Main Menu choose Initialisation Message. The Terminal or Message screen appears showing Prompt, Reply and Acknowledgement grids.
  2. Type the initialisation message into the Prompt grid. The currently active cell is shown in green: no need to click on it, just type away. If you make a mistake use the mouse or cursor keys to return to the cell, then type a new value. To delete or add a row, or to clear the grid completely, use the Edit menu.

Some instruments may send a reply which you can parse to extract a Data Channel,or perhaps simply to find an expected character. If the reply doesn’t come as expected an error message appears. This lets you know that the instrument hasn't configured itself properly

When you’ve finished entering the initialisation message, close the Terminal screen. You're returned to the Main Menu.


Creating a Prompt String

Use the prompt grid in the Terminal or Message screen to send commands and data to the instrument. For instruments that continually output data without needing prompting—continuous flow —you may not need a prompt string.

The Byte column numbers each byte sent. The Char column shows the character represented by that byte. The Hex column shows its Hexadecimal value.

Creating the Prompt String

You can type into the Char or Hexadecimal column—but will generally use the Char column. Click the cell where you wish to enter data. The currently selected cell is highlighted green.

Press Send to send the prompt to the instrument. Its reply is shown in the Reply grid. If there is no reply see below.

Editing the Prompt String

To change characters simply type over them.

Deleting the Prompt String

From the Edit menu select Clear Grid.

Sending the Prompt String

Press Send to send the prompt string to the instrument. Any data already in the Reply grid is cleared and replaced by the new reply.

If there is no reply:

  • Check you've entered any non-printable characters needed in the prompt string, a Carriage Return at the end of a command for example.

For serial instruments...

  • Press the Status button to see possible errors.
  • Make sure you've entered your COM port settings correctly.
  • See Steps to Obtaining a Serial Connection.
  • See our website for example prompt strings for different makes of instrument.
  • Open the Debug Screen.

Clearing the Reply Grid

When instruments continually send data without prompting (continuous flow instruments) the reply grid can fill up with constantly repeating data. As replies are added to the end of the grid, you will soon not be able to see new data without scrolling down. To clear the reply grid, so new data is again visible, send a blank prompt string.


Creating Output Channels

Instead of sending a fixed prompt string to the instrument, you can use software like Windmill AnalogOut to enter and send data. To do this you need to create an output channel.

You can use output channels, for example, to request different types of information from an instrument, or to control digital outputs, such as switches and relays.

  1. In the Terminal or Message screen, click the prompt string cell where you wish to put the output data.

  2. From the Outputs menu, choose the type of data: value, integer, etc. See below for an explanation of data types.

  3. Allocate an output channel to the data. Select Add Channel then click the new channel number in the grid. You'll be asked to confirm this is the channel you want to select. The number of the channel you have picked is shown in the Hex column.

  4. Press the Send button, you are asked to supply data.

    If you insert several channels into a grid the message will not be sent until new values have been written to all channels in the message. This prevents a message being sent out with old data in one channel and new data in another. If you insert output channels in a message that also extracts channels, when you read a channel the message will always be sent using the most recent output values.

    Note:The output channel is viewed as one byte in the grid, but will usually be several bytes in the actual message. With some formats the number of inserted bytes will vary depending on the data entered.

    Value | Lets you insert a string of data up to 12 bytes (characters) long. If, in the Windmill SetupIML program, you leave the scale as 1 and the offset as 0 for the channel, the string will pass through the software unchanged. If, however, you select any other scale and offset then Windmill will attempt to interpret the string as a number. It can understand decimal points and scientific number notation.
    Integer LSB-MSB Use when you want to output a 16-bit 2s complement integer (2 bytes). That is, values in the range -32768 to +32767. This format is the standard for programs such as Visual Basic. The least significant byte is earlier in the message than the most significant byte. Some examples:
    Value | LSB Decimal | MSB Decimal
    -32768 0 128
    -1 255 255
    0 0 0
    +1 1 0
    +32767 | 255 | 127
    Integer MSB-LSB | As above but the MSB comes first in the message.
    Word LSB-MSB | An unsigned version of the above format. It represents values in the range 0 to 65535. The LSB comes before the MSB.
    Word MSB-LSB | As above but the MSB comes first in the message.
    Long LSB-MSB | A 4-byte (32-bit) version of the Integer LSB-MSB above
    Long Byte Swap,
    Long Word Swap         		see Modbus 4 Byte Parameters
    Long MSB-LSB | A 4-byte (32-bit) version of the Integer MSB-LSB above
    Dword LSB-MSB | A 4-byte (32-bit) version of the Word LSB-MSB above
    Dword Byte Swap,
    Dword Word Swap         		see Modbus 4 Byte Parameters
    Dword MSB-LSB | A 4-byte (32-bit) version of the Word MSB-LSB above
    N Bytes as Hex | Use when you want Windmill AnalogOut to send data in hexadecimal format. In AnalogOut you can send up to 6 hex codes in one go to a channel. Windmill will convert the Hex into binary when transmitting the data.
    Signed Byte A single byte of data interpreted as a value in the range -128 to +127. Some examples:
    Value Hex Byte
    -128 80
    -1 FF
    0 00
    +1 01
    +127 7F
    Byte | A single byte of data interpreted in the range 0 to 255.
    Bit A single bit of data which can only have values of 1 or 0. It is regarded by Windmill as one channel of digital I/O. If you choose the Bit option you will be prompted for which bit of the byte: 0 for the LSB up to 7 for the MSB. Repeat for other bits of the byte as necessary. The byte in question is the one following the bit entries (Byte 3 in the example below). In this way you can control several Bits of one Byte.
    Byte | Char | Hex
    1 | Bit 0 | 0
    2 | Bit 1 | 1
    3 | 016 | 10

    In this example you’d be asked to input 0 or 1 for first Bit 0, and then for Bit 1. The values you enter are sent in Byte 3

    If you give both bits the value 1, the resulting transmitted byte is (Hex) 13. That is, (Hex) 10 + (Hex) 1 + (Hex) 2 (in binary: 0001011). The two channels have set the two lowest bits of the byte, the other 6 bits are unchanged.

    Note:When typing into the Hex column always enter 2 digits. So for Hex 0, enter 00.
    The values you enter for bits take precedence over the Hex value you enter for the byte.
    If you plan to use DigitalOut to control a multi-bit channel, please see the Trouble Shooting section.

    Float MSB LSB | 4 Byte Floating Point Number
    Float Byte Swap, Float Word Swap | see Modbus 4 Byte Parameters
    Float LSB MSB | 4 Byte Floating Point Number
    Custom Sometimes the messages to and from instruments are so unusual that no standard arrangements can cope with them. Here we can add code which will insert an output channel into a Prompt message in any format that may be needed. We can also insert items such as checksums calculated in instrument specific ways.

    If we write such code for you we will supply you with the code and a Custom Index Number. Whenever you click on Custom in one of the menus you will be asked for such a number to identify the Custom operation needed. If the operation involves an output channel you will also be asked to specify a channel.


Pausing the Prompt String

Some instruments can become overloaded if instructions arrive too quickly. To prevent this you can insert a pause into your prompt and acknowledgement strings. Windmill will wait for the length of the Wait Time before sending the next byte.

  1. In the Terminal or Message screen, click the cell where you wish to pause. It is highlighted in green.
  2. Select Wait from the menu bar.
  3. If you wish to delete a "Wait", select Delete Row from the Edit menu
  4. To change the length of waiting time, change the Wait Time. From the Main Menu choose to Edit the Instrument Timings.


Inserting a Cyclic Redundancy Check

You can insert a CRC into your prompt or acknowledgement string. This calculates its value based on all earlier bytes in the message and then adds its 2 bytes into the message. It is of the type CRC-16, which is used—for example—by Modbus.

  1. In the Terminal screen, click the cell where you wish to put the CRC value. It is highlighted in green.
  2. Select CRC from the menu bar.
  3. If you wish to delete a CRC, select Delete Row from the Edit menu.


Choosing Background or Direct Reading

Instrument Types

Instruments fall into one of several general categories which determine the way in which the Timings should be set.

  1. Instruments with a quick response to a Request for Data: choose Read Directly
  2. Instruments with a slow response to a Request for Data: choose Read in Background
  3. Continuous flow instruments: choose Read in Background
  4. Instruments which send a reading only when they have new data: choose Read in Background

Depending on your type of instrument, select to either Read the instrument Directly or Read the instrument in the Background: from the Main Menu select to Edit the Instrument Timings. These settings apply to the instrument as a whole and are the same for every channel.

Instruments with a quick response to a Request for Data

These are the simplest types. They should be read directly. The Timeout should be set to longer than the delay between sending a request and obtaining a reply. If several channels are extracted from one reply then set the Data Persistence Time long enough to avoid an unnecessary reread of the instrument. It should be less than the rate at which you wish to read data from the instrument or you will simply reread old stored data. The Wait Time then is only needed if there are Waits in the Prompt String.

Instruments with a slow response to a Request for Data

If these are handled in Direct Mode then Windmill will run slowly as it waits for data. These are best handled in Background Mode. The Timeout should be set to longer than the delay between sending a request and obtaining a reply. The Wait Time sets a time delay between the end of one reading and the start of another. The actual reading rate will then be determined by the Wait time plus the time to send a prompt and to get a reply. The Data Persistence Time should be set to longer than the actual reading rate so that a valid reading is always available. In Background mode readings are updated at a rate which is not dependent on Persistence Time unlike in Direct Mode.

Continuous Flow Instruments

These instruments give out a continuous data stream without any request being required. They must be handled in the Background. Set both the Instrument Timeout and the Data Persistence Time to longer than the rate at which the instrument sends messages. The Wait Time is not used.

Instruments which Send a reading only when they have new data

Some instruments send data only when an event occurs or data changes. These are continuous flow types but the time between data messages is unknown. These must be read in the Background. When entering a Parse String, you should extract a Record Number as the final instruction of the parse. This is a value which increments whenever a new message is received. It can always be rapidly read by Windmill programs since its value is always instantly available. If it is used as the first channel of a scan in the Logger application then you can set Logger to only record data when the record number changes. Timeout and Persistence Time can be set to large values. Logger itself should ask for data at a rate faster than the maximum expected message rate. It will only record data when the record number changes.

Read Directly

When you choose Read Directly, the COMIML serial driver only takes readings when one of the Windmill applications, eg Logger, requests it. COMIML then waits for a reply from the instrument, which results in a slower response time than with Background mode. Also, COMIML will have to send a new request for data for each Windmill program, for example if Logger and Chart both want data it will take two requests.

With Read Directly mode, if the instrument takes a long time to reply then a timeout may occur. If so, COMIML will tell the Windmill application that an reading error occured. (A timeout prevents COMIML waiting forever for your instrument to respond.)

Read in the Background

In this mode COMIML continually asks instruments for data, extracts readings from the replies and stores the latest readings. This means that when a Windmill program requests a value from COMIML, it will immediately be given the latest value. This gives an immediate response, unlike in the Read Directly mode where there will be a delay.

In Background mode ComIML allows many messages to be implemented ( on different COM ports ) and also services requests by Windmill. Whenever it returns to a Background reply it makes a fresh attempt to parse it. This means that if you view debug information you will see the early channels parsed several times before finally a complete parse is obtained.


Setting Instrument Timings

From the Main Menu select Edit the Instrument Timings. The timings apply to the instrument as whole and are the same for every channel.

TimeOut

This defines how long Windmill should wait for a reply from the instrument before giving up. If no reply is received in this time, the driver declares a reading error. This prevents the ComIML serial driver being locked waiting for data from instruments that never respond, or which send a reply which can never satisfy the Parse String. To avoid spurious timeouts set to between five and ten times the normal response time. If you don't know the response time, 5000 milliseconds should be adequate. A value for this is always required.

Wait Time / Instrument Idle Time

In Direct Mode this defines the delay created by a Wait command. In Background Mode this sets the delay between the end of one reading and the start of the next.

Data Persistence Time

Once data has been read from an instrument it is stored in COMIML and returned as a valid reading until the persistence time has expired. In Direct Mode this is important where messages extract several channels of data. If you set the persistence time to 0, every channel reading will cause a complete message to be executed. With a longer persistence time the message need only be executed once and all channels can be obtained from the stored data. However if you set the persistence time to longer than the reading rate that you are using in applications such as Logger then some of your readings will be copies of earlier data.

Generally in Direct Mode a short Persistance Time is adequate. When reading in Background Mode the persistence time should be longer than the actual background reading rate which is controlled by the Wait Time (see above). Note that in Background Mode the data can update before the Persistence Time expires so you will always get the latest available data. In general a long Persistence Tme is suitable in Background Mode.


Editing Data Channels

Data channels are streams of data that can be read from, or written to, instruments. A channel can either be extracted from the instrument’s reply, or inserted into a prompt string, but not both. Channel 0, for example, may supply pressure data whilst channel 1 lets you send data to the instrument. You define read (input) channels when specifying how to parse the instrument's reply and write (output) channels in your prompt string.

You can give names to channels to help you remember which channel does what, and set expected maximum and minimum values to help with automatic scaling of graphs. You can also add new blank channels and delete blank channels

  1. In the Main Menu select Edit the data channel details.
  2. To add a new blank channel, select Add Channel. The new channel is created below the highest channel number. To allocate data to this channel use the Terminal screen to insert or extract a data value.
  3. Give the channel a name by clicking a cell in the name column and typing into it. Each name should be unique and not be duplicated across instruments.
  4. To allow automatic scaling of graphs by Windmill, type the largest and smallest data values that you expect into the Max and Min cells for each channel. These should be values read from the message before any scale or offset has been applied (you can set these in the SetupIML software, for example to convert Celsius to Farhenheit). These maximum and minimum values are optional, and do not impose any limits on the data collected.
  5. To delete a channel, select it and choose Delete Channel. You cannot delete channels which have been allocated to data values. To remove one of these channels you need to delete that data item. There can be no gaps in channel numbering. When you delete a channel all higher numbered channels are reduced by 1. This can affect the validity of your Windmill setup files (*.IMS) since a particular channel number will now refer to a different piece of data. You may prefer to leave the channel in place but unallocated. Such a channel is a dummy channel which cannot be read from or written to.
  6. To later use Windmill Logger to log readings only when new data arrives, create an extra channel and extract the Record Number to it. Make sure this is the last channel in ComDebug's list. Whenever new data is extracted, the record number updates. When you later use Windmill Logger, make sure this channel is the first in Logger's list.

Note: The Mode shows whether the channel will read data from an instrument, write (send) data to it, or is unallocated and blank. You can't edit the mode.

The Msg shows where you can find the data channel. You can't edit this: it is set automatically when you allocate a channel to a data item in a prompt or parse string.


Deleting Channels

Be careful deleting channels. When you do so, all higher numbered channels are reduced by 1 as there can be no gaps in the numbering. This can affect the validity of your Windmill setup files (*.IMS) since a particular channel number will now refer to a different piece of data. To avoid problems you may sometimes prefer to leave a blank channel in place.

Deleting a Data Channel

  1. From the Main Menu select the message holding the channel you want to delete. Use the drop-down list
  2. Click Edit.
  3. For a read channel: select the Parse menu, look for the channel number in the Channel column and click this row.
    For a write channel: look for the channel number in the Prompt string's Hex column and click this row.
  4. From the Edit menu select Delete row or step.

Deleting a Blank Channel

A blank channel is one to which you have not allocated data item. It is a dummy channel, neither being read from nor written to. It is sometimes useful to leave a blank channel in place avoid causing problems with existing systems.

To delete a blank channel

  1. In the Main Menu select Edit the data channel details.
  2. Select a blank channel and choose Delete Channel.
  3. Close the Channel Details window (no need to save).


Using ComDebug as a Terminal Utility

If you wish to simply test your communication settings, you can use ComDebug as a Terminal utility. You can send messages to your instrument, and view replies. You can also use the communications status display to see all your computer knows about serial errors: why data won't transmit and such like. You will not be able to save your settings.

  1. From the opening start up menu, select Use the program as a Terminal Utility.

  2. Fill in your instrument’s COM Port settings.

  3. If necessary, instruct the instrument to send data.

  4. When required, parse the reply.

You might also find our Reference section useful, with its articles on RS232, RS485, TCP/IP, and Trouble Shooting.


Saving the Instrument File

When you are satisfied with your settings, return to the Main Menu and select Save .IMD File. This saves all your settings for your instrument in a file. If you have more than one instrument you can now configure the next one, saving its settings in its own instrument file. Make sure you give all data channels unique names: even across different instrument files.

When you have saved the settings for all your instruments you are ready to combine your files into a device.

Next...


Creating a Device and Describing your Instruments

Windmill lists your instruments as modules within a COMIML device. To create a device:

  1. In the opening screen select Edit Windmill Device. The ComDebug IML Device Editor appears. (The opening screen appears when you start ComDebug and when you select Cancel in the Main Menu.)
  2. Press the Add button and select one of the instrument files (*.IMD) you have saved.
  3. Select this instrument and press the Description button. Enter a few words to describe your instrument.
  4. Repeat steps 2 and 3 for any other instrument files.
  5. Press OK. You are now ready to run the SetupIML program to set—for example—engineering units and alarm thresholds for your channels. After saving your settings in SetupIML you can use Chart, Logger, DDE Panel or one of the other Windmill applications.

Note: If you have saved several *.IMD file for the same instrument, just add one. Otherwise the software will be expecting several of the same instrument to be connected, and may give a "Bad IML Device Number" error.


Opening Screen: Start Up Menu

Use the program as a Terminal utility

You can use ComDebug simply as a serial communications debugging aid. You can:

  • Send and receive messages where all characters are precisely defined and displayed.
  • Use the Communications status display to see all your computer knows about any serial errors-why data isn't being transmitted and so on.

Note that you cannot save any settings when using ComDebug as a Terminal Utility.

Related Topics: Using ComDebug as a Terminal Utility

Create a new Windmill Instrument File

To use your instrument you need to create a file containing communication and data extraction instructions. Select this option and a default file (.imd) will be created for you. You will be taken to the Main Menu screen.

Related Topics: Overview

Edit an existing Windmill Instrument File

Lets you select and edit an .imd file which you have previously created. Each .imd file defines an instrument, containing details of communication, timing and data extraction.

Edit Windmill Device

Windmill lists your instruments as COMIML devices. You create a device by adding the instrument file you save in ComDebug. Use this option after you have finished configuring your instrument.

Related Topics: Creating a Device and Describing your Instruments

Windmill Debug Screen

The Debug Screen shows displays debug messages from the ComIML serial driver. To use the screen first start a Windmill application like Logger or DDE Panel. This will automatically start the ComIML handler and it will start sending debug messages. Now start ComDebug and open the Debug screen.

Related Topics: Windmill Debug Screen

HELP Overview

Opens this Help window.

Close

Closes ComDebug.


Main Menu

The Main Menu appears when, from the Start Up screen, you opt to either create a new Windmill instrument file (*.imd) or edit an existing Windmill instrument file.

For help hold your mouse over the picture or scroll down.

Edit COM Port or Network Settings

Lets you define the serial or TCP/IP communications parameters: baud rate, comm port, etc for serial and IP address and port number for TCP/IP devices.

Related Topics: Entering your instrument's communication settings

Edit the Data Channels Details

Data Channels are items of data that can be read from, or written to, the instrument by Windmill. Select this option to edit channels you created in your messages. For example, one channel may hold temperature readings and another may be an analogue output.

Related Topics: Editing Data Channels

Edit the Instrument Timings

Lets you specify how long Windmill should wait for a reply from the instrument, the minimum interval between sending messages and how long data is considered valid. Also lets you choose whether to automatically take readings from your instrument in the background, or to take readings only when requested to do so.

Related Topics: Setting Instrument Timings

Initialisation Message

An Initialisation message is sent when the COMIML driver loads, and only then. Use it to configure an instrument for use. If your instrument does not need initialising, leave this message blank.

Related Topics: Sending an Initialisation Message

Edit the Selected Message

Lets you edit a message. Select which one from the drop-down list.

Add a New Message

Data communications between COMIML and the instrument comprise a series of messages. A message consists of a sequence of 3 parts: Prompt String, Reply String and Acknowledgement String. This option lets you add a new message to extract data from your instrument.

Related Topics: Establishing communications: sending messages and viewing the instruments reply

OK

Offers you the opportunity to save your settings in the .instrument file (*.imd), and then returns you to the opening screen.

Cancel

Returns you to the opening screen without saving your settings in the instrument file (*.imd).


COM Port Status Window

This window opens when you press the Status button in the Terminal or Message Screen. It lets you see the state of the computer’s COM port. If you are not receiving replies from the instrument this may help you identify the problem

Red indicates true or high, green false or low.

COM Input Lines

Shows the state of the input lines to the computer

CTS - Clear To Send

If you are using Hardware Flow Control in your COM Settings, CTS must be true.

DCD - Data Carrier Detect

Should have no effect on data flow and will normally be false. If it is true you may have a wiring error.

DSR - Data Set Ready

Should have no effect on data flow and will normally be false. If it is true you may have a wiring error.

RI - Ring Indicator

Should have no effect on data flow and will normally be false. If it is true you may have a wiring error.

COM Output Lines

You can control the state of these lines—check your instrument’s Manual for details of the settings it expects. (Remember, red indicates true or high and green false or low.)

RTS - Request to Send

This is set true by a computer when it wishes to transmit data.

DTR - Data Terminal Ready

This should be set true by a computer whenever it is powered on. It lets the instrument check that the computer is on line.


TCP-IP settings

TCP/IP Settings Window

The settings here must match those used by your instrument.

Instrument has fixed IP Address

An Instrument can have a fixed or dynamic IP Address. A fixed addressis allocated to an instrument by a Network Administrator. Your instrument must have some utility supplied by the manufacturer which will allow the address to be set. If your instrument has a fixed IP address enter it here in the format 255.255.255.255.

Instrument is identified by Name (Dynamic IP Address)

An Instrument can get its IP Address allocated when it powers up. This uses a process called Dynamic Host Configuration Protocol (DHCP). In this system the unit is identified by a name, for example "My Instrument". When it powers up it asks a DHCP server to allocate an IP Address to "My Instrument". If this is the case for your instrument, enter its name here.

Port Number

TCP/IP messages are sent not just to an IP Address but also to a Port Number within that address. This allows the message to be directed to one of potentially many applications running on the computer. Your Instrument documentation must tell you which port to contact.

Connect button

Click to set up a connection between ComDebug and your instrument.

Ping button

Sends a message to a defined port within your instrument. The instrument replies with a short data message. If you cannot Ping your instrument you will not be able to talk to it.

Serial button

If your instrument connects to the COM port over RS232, RS422, RS485 or Modbus, instead of entering TCP/IP settings you need to enter COM port settings. Click this button to do so.

Related Topics:

Understanding TCP/IP


COM Port Settings

The settings here must match those used by your instrument. If you are using a USB-Serial converter, it must also use the same settings,

Comm Port

Select the port to which your instrument is connected.

Baud Rate

The baud rate must be the same as that used by your instrument. Consult your instrument’s Manual for details of which rate to choose. If you can select the baud rate of your instrument we recommend that you use a fast rate such as 38400. This reduces the transmission times when sending and receiving messages. If the instrument is a long way from the computer and transmissions are unreliable, you may need to use a lower baud rate.

Data Bits

May be 7 or - 8 if in doubt start with 8.

Parity

Consult your instrument’s Manual. If in doubt start with none.

Stop Bits

May be 1 or 2 - if in doubt start with 2 (this will at worst slow the message down slightly).

Flow Control

Consult your manual. Flow control may be referred to as handshaking. If your Manual specifies Hardware Handshaking, choose Hardware as the Flow Control. If Software Handshaking choose Xon\Xoff. If in doubt start with none.

TCP IP Button

If your instrument connects to a network over TCP/IP - using Ethernet or Internet for example - you need to enter the TCP/IP settings and not the Com port settings. Press the TCP IP button.


Reply Parser Window

The Reply Parser extracts data from the instrument’s message. Use the Add Action menu to pinpoint the location of the data in the reply. To obtain the data use the Extract menu. You will be asked to allocate each data item to a channel.

Edit Steps

Lets you delete or insert a parse step. Click the grid row you wish to edit and select Delete or Insert.

NonPrint Menu

Lets you insert carriage return, line feed, escape and other "non-printing" characters.

NonPrint Decimal | Lets you type a number between 0 and 255. The parser converts this digital number to its ASCII character. This appears in the parameter column as \C(nnn), where nnn is the number you entered. You can also enter such characters by using the NumLock key on the keyboard, and pressing a numeric keypad key.
Carriage Return | Places a carriage return into the Parameters column. It appears as \C(013).
Line Feed | Places a line feed into the Parameters column. It appears as \C(010).
Escape | Places an escape into the Parameters column. It appears as \C(027).

Add Action Menu

Inserts a parse action.

Search | The parser searches through the reply looking for the string of characters you entered in the Parameters column. When it finds the string the next parse operation starts on the following character. For example, if the search string is temperature= the next parse step will start on the character after =
Ignore N Bytes | The parser skips the number of bytes specified in the Parameters column. One character occupies one byte: see the Bytes column of the reply. If you chose, say, to Ignore 12 Bytes, the next parse operation will start on 13th.
Ignore Until | The parser will search for the first occurrence of any of the characters you entered in the Parameters column. The next parse operation will start on the discovered character.
CRC | The parser inserts a cyclic redundancy check of the type CRC-16 into the message.
Custom | It may be that finding data in a message requires some unusual action. For example the start of a message might be indicated by only part of a byte whilst the rest of the byte carries data. In these cases you can use the Custom option. If you wish we can write the custom operation for you. We we then supply you with the code and a Custom Index Number. Whenever you click on Custom you will be asked for such a number to identify the Custom operation needed.

Extract

Lets you extract data values from the Reply string. The two Extract options most often used are Extract N Bytes and Extract Until.

Related topics: Extract menu

Step

Lets you examine the parser operation step-by-step. ComDebug shows you the result of each step by colouring the cells in the reply message green. Extracted data items are shown in the Value column.

Action

Shows the parse action to be implemented. This might be an instruction on how to find a data item in the reply string, selected from the Add Action menu. Or it might be an instruction about extracting data, selected from the Extract menu.

Parameters

Shows the parameters needed by that step’s action. For example, if the action is to Search, the parameter shows the characters for which you are searching. If the action is to Extract N Bytes, the parameter shows how many bytes to extract.

Channel

When you extract an item of data, it is allocated to a channel. You might have a channel holding temperature data, a channel holding humidity data, and so on. If data is extracted in a parse step, this column shows the number of the channel which you want to hold the data. You select this from the Channel Details box which appears when you right-click a channel cell.

Value

Shows the data which you have extracted to a channel.


Custom Options

Sometimes the messages to and from instruments are so unusual that no standard arrangements can cope with them. The Windmill software has been arranged so that custom code can easily be added to deal with these situations. A Custom option has been added to several menus.

Custom Outputs

Here we can add code which will insert an output channel into a Prompt message in any format that may be needed.

We can also insert items such as checksums calculated in instrument specific ways.

Custom Actions

It may be that finding data in a message requires some unusual action. For example the start of a message might be indicated by only part of a byte whilst the rest of the byte carries data.

Custom Extractions

We can extract data from any unusual format.

If we write such code for you, we will supply you with the code and a Custom Index Number. Whenever you click on Custom in one of the menus you will be asked for such a number to identify the Custom operation needed. If the operation involves an input or output channel you will also be asked to specify a channel.


Channel Details Window

Channels are items of data that can be read from, or written to, the instrument. A channel can be extracted from the instrument's reply string, or inserted into a prompt or acknowledgement string—but not both.

For help, move the mouse over the picture.

Add Channel

When you add a channel a new, blank, channel is created. Enter a prompt or parse string to select this and allocate it a data item.

Delete Channel

You can delete channels that are not allocated to data items. Select the channel and choose Delete Channel.

Channel

Shows the number of each channel you have defined.

Name

Use this column to name the channel, so you know which channel you allocated to which piece of data. If you wish you can change the name later with the SetupIML program. Each name should be unique and not be duplicated across instruments.

Maximum and Minimum Values

These allow Windmill to automatically scale its graphs. Enter the largest and smallest data values that you expect for each channel. These should be as values read from the message before any scale or offset has been applied (which you set in the SetupIML software). These values are optional, and do not impose any limits on the data collected.

Mode

You can't edit this column: it shows whether the channel will read data from an instrument, or write (send) data to it. Any unallocated channel with have a blank mode. If you wish you can use blank channels as place fillers to make numbering schemes consistent.

Message

The message where you can find the data channel. You can't edit this—it is set automatically when you allocate a channel to data items in a prompt or parse string.


Terminal or Message Screen

This window opens when you select to Add or Edit a message in the Main Menu, or Use the program as a Terminal Utility from the Opening Start Up Menu.

For help, click over the picture.

>


Instrument Timing Window

These settings apply to the instrument as a whole and thus the entire .IMD file. They are not on a per channel or per message basis.

TimeOut

The number of milliseconds that the instrument driver (COMIML) will wait between sending out a prompt string and obtaining a reply. A reading error will be declared if this is exceeded. To avoid spurious timeouts set to between five and ten times the normal response time.

Wait Time / Instrument Idle Time

In Direct Mode this defines the delay created by a Wait command. In Background Mode this sets the delay between the end of one reading and the start of the next.

Data Persistence Time

Data Persistence Time

Once data has been read from an instrument it is stored in COMIML and returned as a valid reading until the persistence time has expired. In Direct Mode this is important where messages extract several channels of data. If you set the persistence time to 0, every channel reading will cause a complete message to be executed. With a longer persistence time the message need only be executed once and all channels can be obtained from the stored data. However if you set the persistence time to longer than the reading rate that you are using in applications such as Logger then some of your readings will be copies of earlier data.

Generally in Direct Mode a short Persistance Time is adequate. When reading in Background Mode the persistence time should be longer than the actual background reading rate which is controlled by the instrument idle time (see above). Note that in Background Mode the data can update before the Persistence Time expires so you will always get the latest available data. In general a long Persistence Tme is suitable in Background Mode.

Read Directly

Messages are only sent when Windmill reads from or writes to a channel. Windmill then waits for a reply from the instrument for the number of milliseconds specified in the Timeout (above). If no reply is received in this time, Windmill gives an error message.

Choose Read Directly only when your instrument responds quickly to requests for data, and needs a command prompt in order to reply. When no command is needed, or to remove delays in capturing readings, choose Read in the Background.

Read in the Background

Messages are continually sent. When you request data it will be obtained from stored values, avoiding the delays of actually sending the serial messages. In this case the instrument idle time controls the minimum time between readings. This should be shorter than data persistence time so that stored data does not expire before the next reading is taken. If you have an instrument that sends data regularly without any prompting (a continuous flow instrument), you usually need to choose Read in the Background. Another reason for using this mode is when an instrument responds slowly to the Prompt. In direct mode Windmill would Time Out waiting for the reply. In Background mode it gets an immediate response.


Display Screen

This window opens when you click Run in the Terminal or Message screen. It lets you use comDebug to log data to disk or screen. If you have the Windmill suite of software then you may prefer to use Logger to save data as this offers many more options.

File Menu

You can choose to save data in a tab separated file which you can later open in, for example, Excel. From the File menu choose Data File. Alternatively you can show data on screen without logging to file.

Sample Rate Menu

Lets you choose the interval between readings in seconds. For example, you could choose to log data every second.

Status Display Menu

Lets you open a window showing what ComDebug is doing behind the scenes. You can choose Standard status or Full status. Standard Status shows: the Reading starting; the Reply received; the outcome of the reading - OK or an Error; any bytes flushed from the Serial Buffer before the next reading starts. Full Status shows the above plus details of parsing the reply message string.

Start Button

Starts data logging.

Stop Button

Stop data logging.

Close Button

Closes the Display screen.

>


Logging Status Screen: Display Screen Status

This screen shows debug messages from the Display Screen. To use the screen click Status Display and select either Standard Status or Full Status. The Status Screen will now display messages whilst the display screen is running. You can click on Pause to stop the scrolling in order to examine the messages in detail.

Each message starts with a Time in hundredths of a second since logging started.

Standard Status:
The messages for this option show
  • The Reading starting,
  • The Reply received
  • The outcome of the reading - OK or an Error
  • Any bytes flushed from the Serial Buffer before the next reading starts
Full Status:
This shows the above plus details of the parse. Each parse step is shown and its effect on the reply string is shown.

The Display screen only handles one message at a time. A message which works in the Display screen is very likely to work in ComIML. However ComIML is a much more complex application. The exact timings of ComIML are bound to differ from those of the display screen. Because of this a message which works in the display screen is not guaranteed to work in ComIML. Use the Windmill Debug Screen to identify any problems which occur in Windmill.


Understanding RS232

If RS232 is a standard why can't I just use a standard lead to connect together two RS232 ports and expect them to talk to one another ? That's a good question. The answer is that the RS232 standard was created for just one specific situation and the difficulties come when it is used for something else. The standard was defined to connect computers to modems. Any other use is outside of the standard. The authors of the standard had in mind the situation below:

The standard defines how computers ( it calls them Data Terminal Equipment or DTEs) connect to modems ( it calls them Data Communication Equipment or DCEs). The standard says that computers should be fitted with a 25 way plug whilst modems should have a 25 way D socket. The interconnecting lead between a computer and a modem should be simply pin1—pin1, pin2—pin2, etc. The main signals and their direction of flow are described below

It is important to note that a signal which is an output from a computer is an input to a modem and vice versa. This means that you can never tell from the signal name alone whether it is an input or an output from a particular piece of equipment.

TXD Transmitted Data, Pin 2 of 25 way D :

This is the serial encoded data sent from a computer to a modem to be transmitted over the telephone line.

RXD Received Data, Pin 3 of 25 way D :

This is the serial encoded data received by a computer from a modem which has in turn received it over the telephone line.

DSR Data Set Ready, Pin 6 of 25 way D :

This should be set true by a modem whenever it is powered on. It can be read by the computer to determine that the modem is on line.

DTR Data Terminal Ready, Pin 20 of 25 way D :

This should be set true by a computer whenever it is powered on. It can be read by the modem to determine that the computer is on line.

RTS Request To Send, Pin 4 of 25 way D :

This is set true by a computer when it wishes to transmit data,

CTS Clear To Send, Pin 5 of 25 Way D :

This is set true by a modem to allow the computer to transmit data. The standard envisaged that when a computer wished to transmit data it would set its RTS. The local modem would then arbitrate with the distant modem for use of the telephone line. If it succeeded it would set CTS and the computer would transmit data. The distant modem would use its CTS to prevent any transmission by the distant computer.

DCD Data Carrier Detect, Pin 8 of 25 Way D:

This is set true by a modem when it detects the data carrier signal on the telephone line.

PC Serial Ports

A nine pin D plug has become the standard fitting for the serial ports of PCs, although it's nothing to do with the RS232 standard. The pin connections used are:

Pin | Direction | Signal
1 | Input | DCD | Data Carrier Detect
2 | Input | RXD | Received Data
3 | Output | TXD | Transmitted Data
4 | Output | DTR | Data Terminal Ready
5 |  |  | Signal Ground
6 | Input | DSR | Data Set Ready
7 | Output | RTS | Request To Send
8 | Input | CTS | Clear To Send
9 | Input | RI | Ring Indicator

Steps to Obtaining a Serial Connection

  1. Obtain all the information available about your instrument or device. You will certainly need to know Baud Rates, Bits in the Data Byte and Parity. If you have information about the Stop Bits then use it, otherwise set them to 2. This will at worse slow the message down slightly.

  2. If you can persuade your device to send a message, perhaps a power on message or a message that can be initiated by a button press, then do so. This will verify your signal connections. At this stage you should select the no handshake option when setting up the COM Port. If you still can't receive any data, you may have a wiring error. Use the COM Port Status window to check the state of the lines to and from the computer, and see points 3 and 4 below.

  3. Check if the COM port is working correctly. This loopback test works if your instrument is a DTE computer type with a 9-pin connector. (See above for more on DTE type instruments).
    1. Disconnect the RS232 cable from your instrument and check it has a socket on the free end.
    2. Unravel a paperclip, insert one end into the pin 2 hole on the cable socket and the other into the pin 3 hole. (Pin 1 is to the right of the long edge, pin 2 is next to it.)
    3. Send a message. It should echo back to the computer, confirming that messages are arriving at your instrument and the COM port is working correctly.

  4. If you suspect a wiring error, you could try contacting the manufacturer of your instrument to see if they sell the correct cable, or, if your instrument is a DTE computer type, buying a Null Modem adaptor. Alternatively, you may want to try rewiring the cable connector yourself

    When wiring the cable yourself, the first signals to connect are the ground, RXD and TXD. Try to establish, from your device's documentation, which signal wire carries its output data—connect this to the computer's RXD. The signal which inputs data to your device should be connected to the computer's TXD. Don't rely on the signal names, remember the signals can be either inputs or outputs depending on whether your device is a computer or modem type. It's not unusual for Instrument Manuals to neglect this vital information, but you may be able to get a clue from other signals. For instance if the manual says that DTR is an output then the instrument should be a computer type. If on the other hand it says that DSR is an output then it should be a modem type. In fact if you know the direction of any one of the signals you should be able to deduce the rest. Beware when doing this: we have encountered manufacturers who change the names of the data signals when dealing with modem types - after all it must be confusing to tell a user that Transmitted Data is an input! If the signals are correctly named then a computer to modem link connects TXD to TXD and RXD to RXD. A computer to computer link (more common when dealing with instruments) connects TXD to RXD and RXD to TXD. This crossed arrangement is sometimes called a Null Modem connection, and buying an adaptor may solve your wiring problems.

    If all else fails you can determine which data signal is the output by measuring the unconnected data lines with a voltmeter or using one of the plugs with built in LED indicators which show the line state. The output signal will be at a definite negative voltage, properly 9 Volts or more. The input line will be close to 0V. The only time this strategy will fail is if your device is of the multidrop variety. These only drive the output line for the duration of the transmitted message.

  5. If you are confident that the signal wires are properly connected, but you still can't retrieve a message from your instrument, you may need to tie the handshake lines.

    Handshake arrangements can be used for 2 purposes. Firstly the computer can prevent the device from sending data when it is not able to receive it. Secondly the device can prevent the computer from sending data when it is not ready for it. The fact that your device comes equipped with inputs and outputs that can be used for handshaking is no guarantee that handshaking is needed. The signals are often provided simply because the processor used in the device provides them, so the manufacturer feels he may as well put them on the plug. It is usually best to start with the intention of tieing any potential handshake lines to fixed voltages so that they do not affect operation. In fact many manufacturers add tieing resistors to handshake lines so that if you do not want to use them you simply make no connection.

    If you start with no handshaking what symptoms might indicate that it really is needed ?. Well one possibility is that the computer misses part of a message because its input buffer overflows. In COMIML the buffers are 3000 bytes long so you are unlikely to be bothered by this problem. The other possibility is that the device misses part of a message sent by the computer. This will presumably cause the device not to operate as desired. If you do decide that handshaking must be used then COMIML uses DTR / CTS handshaking. This means that the computer uses its DTR output to indicate when it is able to receive data and its CTS input can be controlled by the device to prevent transmission of data from the computer. Once you select the hardware handshake option the state of the CTS input to the computer becomes important. When hardware handshake is not selected the CTS line state is ignored, the DTR output however is maintained permanently high so you can use it to tie unused inputs on your device.

  6. Xon \ Xoff Handshaking is a software protocol that is often used to control data flow. Supposing that the computer were sending data to a device which could accept no more data for the time being - the device would send the single Xoff character to the computer which would stop sending data until it received an Xon character to restart transmission. The same arrangements would apply for the reverse direction of data flow. If your device requires this type of handshaking then simply select it.


Understanding RS422 and RS485

p>RS422 and RS485 define only the electrical characteristics of the driver. They provide just enough information for an IC (Integrated Circuit) manufacturer to design a chip which will convert a logic signal to an RS422 / RS485 signal - what use the electronics engineer makes of such a chip is entirely up to him or her.

RS485 and RS422 drive lines in a differential fashion. This means that 2 wires are required for each signal. If you wish to transmit 4 signals then 8 wires are needed. The figure below shows a single RS485 / RS422 signal being transmitted. To transmit a logic 1 line B is high and line A is low. To transmit a logic 0 then line B is low and line A is high. The advantage of this arrangement is that signals can be transmitted faster and over greater distances than is possible with a single wire.

In both RS422 and RS485 one driver can drive many receivers. In RS485 each driver can be switched off allowing multiple units to send data over a single pair of wires. This is not possible in RS422. This extra feature causes extra problems for RS485 units. Other differences are small so hereafter I will refer to units as RS485 but the remarks apply to RS422 also. Interface units often describe themselves as RS422/RS485 because a RS485 unit not using its extra capability is RS422 compatible.

When instruments are described as having an RS485 interface this tells you nothing for sure about the signals being transmitted. Usually though only the Transmit Data (TX) and Receive Data (RX) of a normal serial port are converted to RS485 or RS422. The other signals of the serial port are not used. Three arrangements though are commonplace.

Write Only System

In this arrangement the computer sends data out over a single RS485 pair of wires to many instruments. It never reads any data back. An example of this is the remote control of CCTV cameras. The operator can send out messages to move the camera. His feedback is the TV picture so no return data is needed. This requires only conversion of the RS232 TX signal to RS485.

4 Wire ( Full Duplex ) System

Full Duplex means that data can pass simultaneously both to and from the instruments. This requires 4 wires - one pair to Transmit and one pair to Receive. The computer alone controls the TX transmit line. It sends out a message which includes an Address. The addressed instrument alone replies by driving the RX line. This does mean that all the connected instruments must use the same software protocol - otherwise there will be confusion as to which instrument is being addressed. A simple conversion of RS232 to RS485 will suffice for this arrangement and no special demands are made on general purpose software such as ComDebug.

2 Wire ( Half Duplex ) System

Half Duplex means that data can only pass in one direction at a time. In this arrangement both TX and RX signals share a single pair of wires which can provide a saving in installation costs.

The computer drives these lines to send out its request message, but must turn its driver off to allow the instrument to reply. This is the tricky bit. Many RS232 to RS485 converters recruit the RTS line of the serial port to switch the RS485 driver On and Off. However Windows has never made more than a half hearted attempt to support such an arrangement.

The multi-tasking nature of Windows means that it is always difficult to make actions occur at exact times - in this case there can be a significant delay between the request being sent out and the driver being switched off. If the instrument starts its reply before the switch off then the start of the reply will be missed. Instrument manufacturers are forced to find their own solutions to this problem. This may include special software, special hardware or both.

In recent years most Serial Ports have been implemented as USB to Serial arrangements. These units always include a microprocessor and this can perform the task of controlling the RS485 driver very well. If you need to implement a 2 wire RS485 system you should always obtain a USB to RS485 converter that advertises this special feature. An example type that we use is Moxa 1130. This unit automatically switches off the driver when there is no more data to send. Such a unit can work with general purpose software such as ComDebug or HyperTerminal. Beware though that it may not work with the special software supplied by instrument manufacturers which may assume a particular RS232 to RS485 converter and may produce errors when used with any other unit.

RS485 Line Terminations

When a signal is sent down a cable there is always a reflection voltage which returns up the cable. This reflection is bigger as signals edges get faster and lines get longer. It can be minimised by terminating the ends of the line with the characteristic impedance of the system. This is 120 ohm for RS485. This means that ideally an RS485 system consists of a single linear cable ( no branches ) with 120 ohm resistors connected across the 2 wires at each end of the cable. RS485 can handle speeds of over 10 Mbits per second and line lengths of over 1 km and if you are operating anywhere near these values you must arrange your wiring close to the ideal.

For many applications where baud rates are slow (say 9600 baud), and lines are only tens of meters long, this is not essential. The wiring requirements can then be relaxed to allow cables to run in star arrangement from the computer and the terminating resistors become optional.

Line Pull Ups

In many RS485 multidrop systems there are times when no unit is driving the RS485 lines. They can then go to any voltage and may produce serial errors. To avoid this it is often necessary to fit resistors which pull one line high and the other line low putting the line into the passive state. The RS485 converters usually include such resistors which can be connected if needed.

Signal Names

You will find that your RS485 signal names for a line pair are either A,B or +,-. In an ideal world you would simply connect A on the computer to A on the instrument. However these names are not consistently applied by manufacturers and you may need to connect A on the computer to B on the instrument.


Understanding TCP/IP

TCP/IP is a network protocol. This is a standard method for sending messages across a network. It is used on many networks including the Internet. You do not need to be a network expert to use it but some key facts will make it more understandable.

IP Address

Each computer on the network has an IP Address. This is in reality a 32 bit binary number. Since such numbers are not user friendly they are usually presented in Dotted Decimal Notation. This splits the 32 bits into four 8-bit chunks. Each chunk is then converted to a decimal number in the range 0 to 255. For example
01011001 00011101 11001100 00011000 becomes 89.29.204.24
You can think of this address as being roughly like a postal address arranged as Country / City / Street / House Number.

Static IP Addresses

An Instrument can have a fixed IP Address. This must be allocated to it by a Network Administrator. The allocated address will be appropriate to the network and unique for the network. Your instrument must have some utility supplied by the manufacturer which will allow the address to be set.

Dynamic IP Addressses

An Instrument can get its IP Address allocated when it powers up. This uses a process called Dynamic Host Configuration Protocol (DHCP). In this system the unit is identified by a name eg "My Instrument". When it powers up it asks a DHCP server to allocate an IP Address to "My Instrument". If you wish to send a message to "My Instrument" then you need to know its IP Address. This can be obtained from a Name Server. This may sound complicated but you, as the user, need only decide to Address the instrument by Its IP Address or by its Name the rest is done for you by the operating system.

Port Number

TCP/IP messages are sent not just to an IP Address but also to a Port Number within that address. This allows the message to be directed to one of potentially many applications running on the computer. Some port numbers are allocated to functions which all computers will support whilst others are for more general use. Your Instrument documentation must tell you which port to contact.

Subnets

Large networks are physically divided into subnets. Two devices which are on the same subnet can send messages directly to each other without the messages being seen by the rest of the network. This reduces traffic in the wider network. The subnet is defined by the Subnet Mask. You can view this via Control Panel and the TCP/IP properties of your computer. This is another dotted decimal arrangement. For 2 units to be on the same subnet the parts of their IP Addresses which are covered by a 1 in the Mask must be the same. So if the Mask is 255.255.255.0 then the first 3 elements of both IP Addresses must be the same to be on the same subnet.

If a unit whose IP Address puts it onto one subnet is physically plugged into another subnet then you will not be able to talk to it since your messages will be sent to the wrong subnet.

Gateways

When your computer wishes to send a message to a device on another subnet it sends the message via a Gateway. This is another computer which relays the message to the destination address. Your computer needs to know the IP Address of the Gateway. You can view this in the TCP/IP properties of your computer.

Name Servers

When your computer wishes to send a message to a named destination then it asks a Name Server to resolve the name to an IP Address. Your computer needs to know the IP Address of the Name Server. You can view this in the TCP/IP properties of the computer.

Ping Utility

This is a test utility which sends a message to a defined port within your instrument. The instrument replies with a short data message. Virtually every unit on TCP/IP will support this action. If you cannot Ping your instrument you will not be able to talk to it.

Direct Connection Instrument to Computer

It is a good idea when first connecting instruments to keep things as simple as possible. A direct connection between Instrument and computer with no wider network connection seems sensible but it has some pitfalls.

  • To connect your computer Ethernet port direct to the Instrument requires a special twisted cable. The cable used to connect your computer to a network hub will not work.
  • If your computer uses a Dynamic IP Address then it cannot get an IP Address unless connected to a DHCP server. So in this arrangement it will not work.
  • If the instrument uses a Dynamic IP Address it will not work unless your computer is configured as a DHCP server.
  • Your computer will also need to perform the Name Server function to deal with such an instrument.
  • Both computer and instrument will need to be on the same Subnet.

A direct connection is only easy if both computer and instrument use fixed IP Addresses on the same subnet and you have the correct cable.

Connection via Wider Network

Using the wider network provides the servers needed for DHCP and Names. Once a Dynamic IP Address instrument is plugged into the network then it should be possible to find it via its Name and the Ping utility. If it is a fixed IP Address and it is plugged into the correct subnet it should again be possible to Ping it.

Trouble Shooting

  • I can Ping my Instrument but I can't Connect to it : - If you are sure that you are Pinging your instrument and not some other unit then it is likely to be because the port number is incorrect. You cannot connect to a port number which your instrument does not support.
  • I cannot Ping my Fixed IP Address instrument : - Obviously you must enter the correct IP Address. The Instrument must be physically plugged into the correct subnet to match its IP Address.
  • I cannot resolve the Name of my Instrument to an IP Address. Ping the IP Address of the Name Server to check that it is on line. Ask your Network Administrator to check that your instrument is being registered with the name server.


Modbus Settings

As you will be sending binary rather than ASCII messages, use the NonPrint menu to enter all bytes (addresses, codes, etc).

For example, to enter a device address, select NonPrint Decimal from the NonPrint menu. Type the device address into the blue box. Address 1, for example, would be shown as Char 001 and Hex 01.

For more examples of using Windmill with Modbus see the Windmill Web Site.

To Read a Single Modbus Register

Byte 1 = device address

Byte 2 = Modbus function code: 3 or 4

Byte 3 = msb of register

Byte 4 = lsb of register

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

The Reply Comprises

Byte 1 = device address

Byte 2 = function code

Byte 3 = number of bytes read

Byte 4 = 1st word, msb

Byte 5 = 1st word, lsb

Byte 6 = 2nd word, msb

Byte 7 = 2nd word, lsb

:

:

Byte n = CRC

To Write to a Register

Byte 1 = device address

Byte 2 = Modbus function code: 6

Byte 3 = address of word, msb

Byte 4 = address of word, lsb

Byte 5 = value of word, msb

Byte 6 = value of word, lsb

Byte 7 = CRC

The Reply Comprises

Byte 1 = device address

Byte 2 = function code: 6

Byte 3 = address of word, msb

Byte 4 = address of word, lsb

Byte 5 = value of word, msb

Byte 6 = value of word, lsb

Byte 7 = CRC


Modbus 4 Byte Parameters

In Modbus all data is sent as 2 byte parameters. The standard says these should be sent in the sequence MSB LSB. However the standard does not mention 4 byte parameters. These are needed when transmitting signed and unsigned 32 bit values and also floating point numbers. If we regard a 4 byte number as
 | Bytes |  |  |  |
MSB | A | B | C | D | LSB
Standard Sequence would be | ABCD
Byte Swap Sequence would be | BADC
Word Swap Sequence would be | CDAB
Byte and Word Swap Sequence | DCBA

All these sequences are used by manufacturers. If you are not sure which to use, try them until one gives sensible values.


Windmill Debug Screen

This screen displays debug messages from ComIML. To use the screen, first start a Windmill application such as DDE Panel or Logger. This will automatically start the ComIML handler and it will start sending out debug messages. Now start ComDebug and from the opening window click on Windmill Debug Screen. Messages will now be displayed. You can click on Pause to stop the scrolling in order to examine the messages in detail.

Each Line starts with a number. This is a count of Milliseconds from the start of the Serial Message. It enables you see the time delays in getting a response from the instrument. A range of messages are supplied:

0 Start of Message Name
This is sent when ComIML starts to implement a message.
Send String
Sent when ComIML transmits a Prompt or Acknowledgement string. Non print characters are shown as < 123 >.
Start of Parse Attempt
ComIML is starting its attempt to parse the reply message. Timeout measurement starts from here.
Channel + Num + Value
The value extracted by the parse.
Parse OK
The full parse string has been implemented on the Reply Message.
Parse Timeout
The Timeout value has been exceeded before a Reply satisfying the Parse has been received. To change the Timeout, from the Main Menu select Edit the Instrument Timings.
Reply
The Reply string that was available when the parse terminated.
Channel + Num + Read
Windmill caused a full reading of this channel.
Channel + Num + Persist
Windmill read the stored value of this channel because the persistence time had not yet expired.
Flush Serial Buffer
Before ComIML starts a new message it reads and discards any bytes remaining in the serial buffer. These are displayed. No message is displayed if there are no discarded bytes.
Start of Wait Command
Some instruments can become overloaded if instructions arrive too quickly. To prevent this you can tell ComIML to wait for the length of the Wait Time. The end of the wait is indicated by the next action specified by the message.

Differences between Direct and Background readings (set in Instrument Timings)

When a direct reading is being made, Windmill waits for the reply so the process continues until the reply is available or a Timeout occurs. In Background mode ComIML does not wait for replies to be received. Instead it allows other messages to be implemented (on different COM ports) and also services requests by Windmill. Whenever it returns to a Background reply it makes a fresh attempt to parse it. This means that you will see the early channels parsed several times before finally a complete parse is obtained.

In Background mode the wait time delay is enforced between the end of one read of the module and the start of the next. This appears as a Wait message.


Trouble Shooting

You may also find the Technical Support page on our Web site useful.

The Instrument is not replying to my Prompt String

See the Sending the Prompt String section for help.

My Instrument is sending data but it is not shown

Some instruments continually send data without any prompting. New data is added to the end of the reply string. This means that once the reply grid is full, you will not see any new data unless you scroll down. To clear the reply grid press the Send button. This clears the grid ready for new data.

When sending an integer ComDebug won't accept my entry

Make sure you have included a + or - sign in your entry.

I've used the Outputs menu to send a command, but am not getting a reply

Make sure you've entered any carriage return, or other non-printable character needed, in the cell after the Output value.

How do I request different information from my Instrument?

Some instruments will send back different data depending on the commands you send to them. GPS receivers, for example, can send a variety of NMEA messages. You can use the Outputs menu to create a channel which will let you send different commands to your instrument.

I'm having problems using DigitalOut to control multiple data bits

Each digital channel (or line) is initially controlled by a single bit. It is therefore said to be 1 bit wide. This means that the state of the channels will be set individually. You might, however, want to switch several channels at the same time—for example to open or close 4 relays at the same instant. In this case the channel width is set in SetupIML to be 4 bits.

Windmill DigitalOut sends data only when you wish to change a digital state and does not allow you to manually refresh an existing state. COMIML, however, will not send a message with several output channels until new values have been written to all channels. This prevents old data from being sent to one channel and new data to another. This means that you will not be able to switch several channels at the same time with DigitalOut. To avoid this problem use another program, such as Windmill Test-Seq to control multi-bit channels.

Slowing the Requests for Data

In Background mode, the Instrument Idle Time sets the minimum interval between sending messages to an instrument. This is especially important for instruments that do not like being read too quickly. Go to the Instrument Timing window and set the Instrument Idle Time. For instruments that need a prompt string, enter a command into the prompt telling Windmill to wait. To do this select Wait from the menu bar.

Data from only some Channels are Shown

If you can see data from some channels but not all; make sure that all channel names are unique, including across several instruments.

Data shown in ComDebug but not Logger

You may have entered an "Initialisation Message", which is only sent once, rather than a data collection message, which is repeatedly sent. Open your *.imd file using, for example, Wordpad. If it shows prompt and parse details for [Message0] Initialisation, but none for [Message1], just copy the Prompt and Parse lines from one to the other.

Bad IML device number in SetupIML or Logger

There are two possible causes for this. Firstly make sure ComDebug is closed. If open it will have control of the COM port and the COMIML serial driver, and hence the other Windmill programs won't be able to access it. A second possibility is that you may have instruments listed in your Windmill Device file which you are not using. For example, if you have added more than one *.imd file for a single instrument. Choose to Edit a Windmill Device. Make sure the *.imd file you have created is listed and remove any that you no longer need.

Serial Buffer Clearing

ComIML clears its serial input buffer when it starts sending a message. Errors can occur if unexpected data is arriving at this time. See the following items for possible causes.

Parsing to the end of Instrument data

You should always continue your parsing to the very end of the instrument reply. If you finish parsing when you have the data you need but more bytes are still to come then Windmill might send a further Prompt message whilst the previous reply is still arriving. These final bytes might then be mistaken for the start of the next reply.

Identifying Reply Start

It is always best to identify the reply start in some unambiguous way if this is possible. For example if the reply message was "T=123<CR> " then you should always search for "T=" rather than ignore 2 bytes. This is especially important with instruments that continually send data without any promting.

Continuous Flow Reply Start

Where an instrument continually sends data without prompting, it is always possible that we start looking for a continuous flow message just when the instrument is halfway through sending the message. In this case we will only get the later part of the message. If we can identify the message start then these bytes will be ignored and ComIML will wait for the next complete message; assuming that the TimeOut is set to a sufficient value. Sometimes identifying the start is not possible. For example if the message were "123<CR>" where the 123 could be any number and could be a variable length, then you could Extract to <CR> which would work if there was a reply to a prompt. However if this were continuous flow such an action could sometimes return less than all the digits. The best strategy would be to search for <CR> then Extract to <CR>. This would work reliably but only gets data from every other message sent by the instrument.

TCP/IP Devices

See Understanding TCP/IP for trouble-shooting tips.

Dashes not data

If, when pressing the Run button, you see dashes rather than data, you are trying to read your instrument too fast. ComDebug will be asking for data at the time specified (every second by default) but the instrument isn't able to communicate this quickly. Slow down your sample rate.

None of the data extraction options suit my instrument

Sometimes the messages to and from instruments are so unusual that no standard arrangements can cope with them. The Windmill software has been arranged so that custom code can easily be added to deal with these situations. A Custom option has been added to several menus: Outputs, Action and Extract. If we write such code for you we will supply you with the code and a Custom Index Number. Whenever you click on Custom in one of the menus you will be asked for such a number to identify the Custom operation needed. If the operation involves an input or output channel you will also be asked to specify a channel .

Need More Help?

Fill in the technical support form on our web site. Visit http://www.windmill.co.uk/techsupp.html.


Error Messages

Channel already allocated

If you have an empty Channel Details grid, select Add Channel.

No Value

You have edited a byte in the prompt or acknowledgement string—leaving it empty. You should delete the empty byte row. Select the row, then from the Edit menu choose Delete Row.

Inserted Value has no Channel Number

You've inserted an instruction that lets you write data to an instrument (an Output value) into the Prompt string, but haven't allocated this data item to a channel. If you don't allocate a channel you will not be able to enter or send the data to the instrument.

Failed to open the COM Port

There three possible reasons for this error.

  1. The COM port is already in use. ComDebug needs sole control of the port: if other software has already opened the COM port, ComDebug will not be able to access it.
  2. You have selected a COM port that isn't present on your computer - choose a lower COM port number.
  3. If your are using a USB-Serial device that is "designed for Windows" then it will have a unique serial number. Windows reads this and uses it to remember which driver and COM port number to use for that device. This means that when you unplug the converter, Windows continues to consider its COM port number in use. It also means that if you swap converters the port number assigned will be different. You can over-ride this with Device Manager. More details are on our web site: USB-Serial Converters

Bad IML device number

This error is given in the other Windmill programs: SetupIML or Logger for example. There are two reasons for this error.

  1. ComDebug is running. When open ComDebug will have control of the COM port and the ComIML serial driver, and hence the other Windmill programs won't be able to access it. Make sure you close ComDebug before starting the other programs.
  2. You may have instruments listed in your Windmill Device file which you are not using. For example, if you have added more than one *.imd file for a single instrument. Go back to ComDebug and choose to Edit a Windmill Device. Make sure the *.imd file you have created is listed and remove any that you no longer need.

Invalid Port Number

When configuring a TCP/IP instrument, the port number should comprise 5 digits, eg 47471. Check you have no spaces at the end of the number.


Decimal and Hexadecimal Character Codes

Char | Control | Decimal | Hexadecimal
NUL | ^@ | 000 | 00
SOH | ^A | 001 | 01
STX | ^B | 002 | 02
ETX | ^C | 003 | 03
EOT | ^D | 004 | 04
ENQ | ^E | 005 | 05
ACK | ^F | 006 | 06
BEL | ^G | 007 | 07
BS | ^H | 008 | 08
HT | ^I | 009 | 09
LF | ^J | 010 | 0A
VT | ^ | K011 | 0B
FF | ^L | 012 | 0C
CR | ^M | 013 | 0D
SO | ^N | 014 | 0E
SI | ^O | 015 | 0F
DLE | ^P | 016 | 10
DC1 | ^Q | 017 | 11
DC2 | ^R | 018 | 12
DC3 | ^S | 019 | 13
DC4 | ^T | 020 | 14
NAK | ^U | 021 | 15
SYN | ^V | 022 | 16
ETB | ^W | 023 | 17
CAN | ^X | 024 | 18
EM | ^Y | 025 | 19
SUB | ^Z | 026 | 1A
ESC | ^[ | 027 | 1B
FS | ^\ | 028 | 1C
GS | ^] | 029 | 1D
RS | ^^ | 030 | 1E
US | ^_ | 031 | 1F


Glossary

Background Reading

See Read in the Background

Channel

An item of data that can be read from, or written to, the instrument by Windmill.

COMIML

COMIML is the serial driver which Windmill uses to read data from your instruments, and send commands to them. When the Windmill Logger program (for example) needs a reading it asks COMIML to supply its latest reading from the instrument. COMIML runs in the background—with no interaction from you apart from the initial configuration which you perform with ComDebug.

COM Input Lines

Wires in the RS232 cable which provide input to the computer at the COM port.

COM Output Lines

Wires in the RS232 cable which the computer uses to send data to your instrument.

Continuous Flow

When an instrument sends out data without any prompting, it is known as a continuous flow instrument.

CTS

Clear To Send line in the COM port. If you are using Hardware Flow Control in your COM Settings, CTS must be true.

DCD

Data Carrier Detect line in the COM port. Should have no effect on data flow and will normally be false. If it is true you may have a wiring error.

Direct Reading

See Read Directly.

DSR

Data Set Ready line in the COM port. Should have no effect on data flow and will normally be false. If it is true you may have a wiring error.

Instrument Idle Time

See Wait Time.

LabIML

Windmill 4.3's serial driver: the forerunner to COMIML. You can use ComDebug to interact with your instrument and find the correct settings for LabIML. LabIML, though, cannot read the *.IMD files saved by ComDebug and you will have to type your settings into LabIML by hand.

Message

All data communications between the Windmill serial driver (COMIML) and instruments consist of messages. These comprise a sequence of 2 or 3 parts: the prompt string, the reply string, and, for some instruments, the acknowledgement string.

Module

A module, when talking about RS232 instruments, is one instrument. .

Output Channels

Let you use software like Windmill Test-Seq or Microsoft Excel to send data to your RS232 device. For example, you can request different types of reply sentence from a GPS receiver ($GPGLL, $GPBOD, etc), or, for digital outputs, can turn switches on and off.

Ping Utility

This is a test utility which sends a message to a defined port within your instrument. The instrument replies with a short data message. Virtually every unit on TCP/IP will support this action. If you cannot Ping your instrument you will not be able to talk to it.

Port Number

TCP/IP messages are sent not just to an IP Address but also to a Port Number within that address. This allows the message to be directed to one of potentially many applications running on the computer. Your Instrument documentation must tell you which port to contact.

Read Directly

Windmill only reads the instrument at the time data has to be logged or displayed. As Windmill has to wait for a reply from the instrument, this may mean a slow response time. See also Read in the Background.

Read in the Background

Windmill automatically reads your instrument at regular intervals. When the other Windmill or Windows applications need this data, they are immediately supplied the most recently acquired values.

Record Number

This is a value which increments whenever a new message is received. If you want to only log readings when new data arrives, in your parsing instructions use the Extract menu to allocate the Record Number to the last channel in ComDebug's list.

RI

Ring Indicator line in the COM port. Should have no effect on data flow and will normally be false. If it is true you may have a wiring error.

RS232 Port

The COM or serial port on the instrument and the computer.

TimeOut

The number of milliseconds that the instrument driver will wait between sending out a prompt string and obtaining a reply.

Wait Time

In Direct Mode this defines the delay created by a Wait command. In Background Mode this sets the delay between the end of one reading and the start of the next. Set in the Instrument Timings box.


Licence a Trial Copy of Windmill

Subscribers to our newsletter can download a fully-working, trial version of Windmill and the ComIML serial driver. This lets you collect data from almost any device which plugs into the PC's COM port. At the end of your trial, if you wish to keep using the software, you can purchase a release key from our data acquisition shop. This will let you go on using your set-up indefinitely.

A licenced copy of Windmill lets you control up to 10 serial instruments which are sending binary or ASCII data. You can collect many channels of data from each instrument. It includes the charting, logging, output control and DDE programs. With the DDE Panel you can send data in real-time to other programs like Excel or Access.

To obtain a release key and licence Windmill:

  1. Run Windmill Licence from the Windmill program group.
  2. You will see a screen showing your software and a Request Key. Make a note of the Request Key.
  3. Go to the Windmill data acquisition shop and add Licence your trial version of Windmill to your shopping cart.
  4. During the checkout process you will be asked for your Request Key. Enter this.
  5. We will send you back your Release Key. Enter this in the Windmill Licence screen. Your software will be re-enabled and you can continue to use it.

Keep a record of your Release Key. You will need it if you want to install Windmill on another computer.

Thank you for using Windmill
http://www.windmill.co.uk/
http://www.windmillsoft.com/


Getting Data into Excel

With Windmill and ComDebug there are two ways to get data into Excel.

  1. In real-time, using DDE links set up with the Windmill DDE Panel program (Wmdde).
  2. After collection has finished, by opening in Excel the file of data collected by Windmill Logger or ComDebug.

If you have the free version of ComDebug, and your Windmill trial has expired, then you will only be able to use method 2. You can transfer data in real-time if you licence Windmill.

Note: We also sell a dedicated program to send data to Excel: the Windmill Real Time Data Server. This is more robust than DDE links. More information is on our web site at http://www.windmillsoft.com.


World Wide Web

Web Site

You can find more information about Windmill Software on the World Wide Web at http://www.windmill.co.uk/.

Every month we publish a free newsletter - Monitor ((ISSN 1472-0221), delivered by e-mail. This gives tips on using Windmill and articles on data acquisition and control. To subscribe visit http://www.windmill.co.uk/newsletter.html.

For easy purchase of extra software modules visit http://www.windmillsoft.com/.

For more technical support see http://www.windmill.co.uk/techsupp.html

.


Streamer

Streamer is waveform capture, charting and review software for Windows. It lets you log data (temperature, strain, current, etc) at up to 100 kHz. You can set the speed of sampling from Streamer or from an external clock, and start scans from Streamer or from an external trigger.

Streamer works with Microlink high speed data acquisition hardware.

For more information on Streamer, or to download a free software demo, visit Windmill Software's web site at http://www.windmill.co.uk/.


Your Comments on the Help

Tell us any improvements we could make to our Help files. Could you quickly find what you wanted? Was the explanation clear? Have you any questions? Visit http://www.windmill.co.uk/help.html and fill in the comments form at the bottom of the page.


Windmill

Windmill is a suite of data acquisition and control software. It comprises:

Drivers - which handle the low-level communications

ConfIML - which creates a file holding details on which hardware devices are in your system

SetupIML - which creates files telling the other applications how you want the hardware configured

Applications - such as Logger and Chart which perform the data acquisition and control tasks


Contacting Windmill

Windmill Software,
PO Box 58,
North District Office,
Manchester,
M8 8QR,
UK
Telephone: +44 (0)161 833 2782
Facsimile: +44 (0)161 833 2190
E-mail: sales@windmill.co.uk
http://www.windmillsoft.com/
http://www.windmill.co.uk/


Windmill ComDebug Help Contents

Getting Started

Overview

Entering your instrument’s communication settings

Establishing communications: sending messages and viewing the instrument’s reply

Parsing the reply to extract data

Logging data

Messages

Understanding messages

Sending an initialisation message

Creating a prompt string

Creating output channels

Pausing the prompt string

Inserting a cyclic redundancy check

Timings

Choosing background or direct reading

Setting instrument timings

Data Channels

Editing data channels

Deleting channels

Terminal Utility

Using ComDebug as a terminal utility

Saving

Saving the instrument file

Creating a device and describing your instruments

Reference

Opening Screen: Start Up Menu

Main Menu

Terminal Screen

COM Port Status Window

Reply Parser Window

Channel Details Window

Instrument Timings Window

Display Screen

Understanding RS232

Modbus Settings

Trouble Shooting

Error Messages

Decimal and Hexadecimal

Glossary

Getting data into Excel

Your comments on the Help


NonPrint Menu

Lets you insert carriage return, line feed and escape characters.

Carriage Return | Inserts a carriage return character. It appears as \C(013).
Line Feed | Inserts a line feed character. It appears as \C(010).
Escape | Inserts an escape character. It appears as \C(027).

For other "special" characters either enter the hexadecimal code into the Hex column, or, on the keyboard press the Num Lock key then enter the decimal code into the Char column.


(Untitled)

.IMS Files

The Windmill .IMS files are created by the SetupIML program. This lets you lets you set engineering units, specify alarm thresholds and so on.


Add Action Menu

Inserts a parse action. This lets you locate the data values in the received message string.

Search
The parser searches through the reply looking for the string of characters you entered in the Parameters column. When it finds the string the next parse operation starts on the following character. For example, if the search string is
temperature=
the next parse step will start on the character after =
Ignore N Bytes
The parser skips the number of bytes specified in the Parameters column. One character occupies one byte: see the Bytes column of the reply. If you chose, say, to Ignore 12 Bytes, the next parse operation will start on 13th.
Ignore Until
The parser will search for the first occurrence of any of the characters you entered in the Parameters column. The next parse operation will start on the discovered character.
CRC
The parser inserts a cyclic redundancy check of the type CRC-16 into the message.
Custom
It may be that finding data in a message requires some unusual action. For example the start of a message might be indicated by only part of a byte whilst the rest of the byte carries data. In these cases you can use the Custom option.

If you wish we can write the custom operation for you. We we then supply you with the code and a Custom Index Number. Whenever you click on Custom you will be asked for such a number to identify the Custom operation needed.

Back to: Parsing the Reply to Extract Data


(Untitled)

Data Channel

A channel contains an item of data which can be read from, or sent to, the instrument by Windmill. A channel can be extracted from a Reply string or inserted into a Prompt string, but not both.


Add Action Menu

Search | The parser searches through the reply looking for the string of characters you entered in the Parameters column. When it finds the string the next parse operation starts on the following character. For example, if the search string is temperature= the next parse step will start on the character after =
Ignore N Bytes | The parser skips the number of bytes specified in the Parameters column. One character occupies one byte: see the Bytes column of the reply. If you chose, say, to Ignore 12 Bytes, the next parse operation will start on 13th.
Ignore Until | The parser will search for the first occurrence of any of the characters you enter in the Parameters column. The next parse operation will start on the discovered character.
CRC | The parser inserts a cyclic redundancy check of the type CRC-16 into the message.


Extract

Extract Menu

Lets you extract data values from the Reply string. Each value is held in a channel. When you choose an Extract option you will therefore be prompted to select or add a Data Channel in which to hold the data. The two Extract options most often used are Extract N Bytes and Extract Until.

N Bytes
Obtains the next N bytes. Type the number of bytes into the Parameters column. The maximum number of bytes you can extract for any one data item (channel) is 12.
Until
Extracts all bytes until the first occurrence any of the characters you type in the Parameters column The next parse operation will start on the discovered character.
Integer LSB-MSB
Use when you want to extract a 16-bit 2s complement integer (2 bytes). That is, values in the range -32768 to +32767. This format is the standard for programs such as Visual Basic. The least significant byte is earlier in the message than the most significant byte. Some examples:
Value | LSB Decimal | MSB Decimal
-32768 0 128
-1 255 255
0 0 0
+1 1 0
+32767 | 255 | 127
Integer MSB-LSB
As above but the MSB comes first in the message.
Word LSB-MSB
An unsigned version of the above format. It represents values in the range 0 to 65535. The LSB comes before the MSB.
Word MSB-LSB
As above but the MSB comes first in the message.
Long LSB-MSB
A 4-byte (32-bit) version of of the Integer LSB-MSB described above.
Long Byte Swap, Long Word Swap
see Modbus 4 Byte Parameters.
Long MSB-LSB
A 4-byte (32-bit) version of of the Integer MSB-LSB described above.
DWord LSB-MSB
A 4-byte (32-bit) version of of the Word LSB-MSB described above.
Dword Byte Swap, Dword Word Swap
see Modbus 4 Byte Parameters.
Dword Byte MSB-LSB
A 4-byte (32-bit) version of the Word MSB-LSB described above.
N Bytes as Hex
Type the number of bytes into the Parameters column. The maximum number of bytes you can extract for any one data item (channel) is 6. Windmill will show hexadecimal values.
Signed Byte
A single byte of data interpreted as a value in the range -128 to +127. Some examples:
Value Hex Byte
-128 80
-1 FF
0 00
+1 01
+127 7F
Byte
A single byte of data interpreted in the range 0 to 255.
Bit
A single bit of data, which can only have values of 1 or 0. Windmill regards it as one channel of digital I/O. If you choose the Bit option you will be prompted for which bit of the byte: 0 for the LSB up to 7 for the MSB. If you ask for several Bit extractions one after the other, they will all come from the same byte.
Float MSB LSB
4 Byte Floating Point Number.
Float Byte Swap, Float Word Swap
see Modbus 4 Byte Parameters.
Float LSB MSB
4 Byte Floating Point Number.
Record Number
If you want to log only newly updated data, then extract the Record Number to a final channel. This is a value which increments whenever a new message is received. When you later use Windmill Logger, make sure this channel is the first in Logger's list.
Custom
Sometimes the messages to and from instruments are so unusual that no standard arrangements can cope with them. The Windmill software has been arranged so that custom code can easily be added to deal with these situations.
Custom Extractions: We can extract data from any unusual format.
If we write such code for you we will supply you with the code and a Custom Index Number. Whenever you click on Custom in one of the menus you will be asked for such a number to identify the Custom operation needed. If the operation involves an input or output channel you will also be asked to specify a channel .

Back to: Parsing the Reply to Extract Data


(Untitled)

Instrument Files

The COMIML driver can handle up to 10 serial instruments. You define each instrument’s settings—baud rate, parse strings, etc—and save these in an instrument file. Instructions on how to do this are given in the Overview.


(Untitled)

COMIML

COMIML is the name of Windmill’s serial instrument driver.


(Untitled)

Windmill ComDebug Help
written by Jill Studholme
http://www.studholme.net/


Using LabIML

As the free LabIML driver can't read the *.IMD files you've created, you will have to enter your settings by hand. To do this open Windmill 4.3 ConfIML alongside ComDebug, positioning them so you can see both programs. (If you wish to upgrade to the COMIML serial driver, thus removing the need for the following steps, you can do so on-line at http://www.windmillsoft.com/)

  1. In ConfIML press the Add button then select LabIML RS232 ASCII Instrument handler.

  2. From ComDebug's Main Menu, select Edit the data channel details. Look for the highest channel number. In ConfIML's channels box enter one more than this number. Type a name and description for your instrument into ConfIML. Press OK and the instrument settings dialogue appears.

  3. From ComDebug's Main Menu, select Edit the Instrument Timings. Copy the settings from here to ConfIML. If Read Directly choose Request/Response On Demand or Multi Channel. If Read in the Background choose one of the background or continuous flow options.

  4. If you entered an Initialisation message in ComDebug, recreate its prompt string in the ConfIML Instrument Initialisation string.

  5. In ComDebug's Main Menu, select Edit Message_1. Press Send. Note the number of bytes returned and enter this into ConfIML's Returned Message Length

  6. In ConfIML, press the Channels button. In Channel 0, recreate the Prompt string.

  7. In ComDebug, select the Parse menu. Look for channel 0 in the right-hand column. Recreate the steps leading up to, and including, the channel 0 row in ConfIML.

  8. Repeat steps 6 and 7 for the rest of the channels.

  9. In ConfIML, OK and close the Channel and Instrument dialogues. Press the Comms button.

  10. In ComDebug, select the Com button. Copy the settings to ConfIML.

  11. Close ComDebug and save ConfIML settings.

    Note: If when using Windmill 4.3 you're not obtaining the data you expected, right-click the LabIML icon and enable debug options.


NonPrint Menu

Lets you insert carriage return, line feed, escape and other "non-printing" characters.

NonPrint Decimal
Lets you type a number between 0 and 255. The parser converts this digital number to its ASCII character. This appears in the parameter column as \C(nnn), where nnn is the number you entered. You can also enter such characters by using the NumLock key on the keyboard, and pressing a numeric keypad key.
Carriage Return
Places a carriage return into the Parameters column. It appears as \C(013).
Line Feed
Places a line feed into the Parameters column. It appears as \C(010).
Escape
Places an escape into the Parameters column. It appears as \C(027).

Back to: Parsing the Reply to Extract Data


World Wide Web

Web Site

You can find more information about Windmill Software on the World Wide Web at http://www.windmill.co.uk/.

Every month we publish a free newsletter - Monitor ((ISSN 1472-0221), delivered by e-mail. This gives tips on using Windmill and articles on data acquisition and control. To subscribe visit http://www.windmill.co.uk/newsletter.html.

For easy purchase of extra software modules visit http://www.windmillsoft.com/.

Updates of this Help file will be posted at http://www.windmill.co.uk/help.html.


Entering your serial COM port settings

You need to tell ComDebug about your instrument's serial communications.

When you start ComDebug choose to create a new Windmill instrument file. Now choose Serial communications. If you have already done this, and want to change setttings, from the Main Menu choose Edit COM Port Settings.

Comm Port

Select the port to which your instrument is connected.

Baud Rate

The baud rate must be the same as that used by your instrument. Check your instrument’s Manual for details of which rate to choose. If you can select the baud rate of your instrument we recommend that you use a fast rate such as 38400. This reduces the transmission times when sending and receiving messages. If the instrument is a long way from the computer and transmissions are unreliable, you may need to use a lower baud rate.

Data Bits

May be 7 or 8—if in doubt start with 8.

Parity

Check your instrument’s Manual. If in doubt start with none.

Stop Bits

May be 1 or 2—if in doubt start with 2 (this will at worst slow the message down slightly).

Flow Control

Consult your manual. Flow control may be referred to as handshaking. If your Manual specifies Hardware Handshaking, choose Hardware as the Flow Control. If Software Handshaking choose Xon\Xoff. If in doubt start with none.

TCP IP Button

If your instrument connects to a network over TCP/IP - using Ethernet or Internet for example - you need to enter the TCP/IP settings and not the Com port settings. Press the TCP IP button.

Next...


Entering your TCP/IP communication settings

Entering TCP/IP Instrument’s Communication Settings

You need to tell ComDebug about your instrument's TCP/IP communications.

When you start ComDebug choose to create a new Windmill instrument file. Now choose TCPIP communications. If you have already done this and want to change settings, from the Main Menu choose Edit Network Settings.

For a fuller explanation of what all these terms mean, see the Understanding TCP/IP page.

  1. If your instrument has a fixed IP address, enter the address. (Your instrument will have come with a utility to set its address: consult your instrument's Manual for details.)
  2. Alternatively, if your instrument has a dynamically allocated IP address, and is identified by name, enter its name in the "Instrument is Identified by Name" box.
  3. Enter your instrument's Port Number. This allows a message to be directed to one of potentially many applications running on the instrument. Your instrument's Manual will tell you which port to contact.
  4. Once you have entered your IP address or name, "ping" your instrument. This sends a message to the port you chose within your instrument. Your instrument should reply with a short message. Press the Ping button and a Command Prompt box appears - if all is well it will show "Reply From...". If instead it says "Request timed out" or "Destination unavailable" or just instantly closes itself then there is a problem and you will not be able to connect to your instrument. Check your cable and addresses. See the Understanding TCP/IP page for more tips.
  5. When you have successfully pinged your instrument click the Connect button.

You can now enter the other details of your instrument: timings etc.

Related Topics:

Understanding TCP/IP
About the TCP IP Settings screen

Next...


ComDebug and Windmill Trial

Subscribers to the Monitor Newsletter can download a free copy of the ComDebug program and a 28 day trial of the ComIML / Windmill suite. The free ComDebug can be used in 3 ways : -

  • As an improved terminal program which allows you to easily see all bytes sent and received - even non-printing characters. This is crucial if you need to cope with binary data.
  • As a simple logger for data obtained from serial instruments.
  • As an editor for .imd files which are used by the Windmill ComIML program as a recipe for obtaining readings from a serial instrument.

The trial includes a demo setup to get you started.