top01.jpg (17169 bytes)
mleft.jpg (4986 bytes) m01a.jpg (6169 bytes)     m02a.jpg (6905 bytes)     m03a.jpg (7743 bytes)    m04a.jpg (7456 bytes)     m05a.jpg (7878 bytes)     m06a.jpg (6862 bytes)     m07a.jpg (6076 bytes) mright01.jpg (5078 bytes)

ADU  Series - USB Data Acquisition Interface SDK

Multiple ADU USB Devices

The Problem

The OpenAduDevice function returns a handle to the first ADU device it finds. Unfortunately "first" means the first ADU device encountered during the search. The sequence of plugging ADU devices into the computer does not reflect their search order.

Thus if two ADU devices are plugged into the computer there is no guarantee which one the OpenAduDevice will connect with.


In the example the strain gauge may usually connect to the first OpenAduDevice call and the proximity sensor to the second OpenAduDevice call. But suddenly one day, the connections get reversed leaving the application reading weights as counts. This can occur without any changes being made to the cables, devices or application program.

The Solution

To connect to the correct devices consistently open the device pipe handles with OpenAduDeviceBySerialNumber.

Open the strain gauge handle with

        hScale = OpenAduDeviceBySerialNumber("A88101", 0);

and the proximity sensor handle with

        hCounter = OpenAduDeviceBySerialNumber("A12345", 0);


Of course, instead of hard-coding the serial number, it should be stored in the registry or a .ini file or a database or a persistent property, etc.

Manually Setting Up the Serial Number

During installation of an application the ADU devices must be associated with their usage. The program might require the technician installing the system to type in the serial numbers of attached devices. The program could show a set-up screen with fields for the scale and counter serial numbers. The technician looks at the labels on the ADU devices to see their serial numbers and types them in.

Using the ShowAduDeviceList Dialog

Alternatively the application program may call ShowAduDeviceList to show the technician a list of the ADU devices that are attached.

If the program supplies a pointer to an ADU_DEVICE_ID structure when it calls ShowAduDeviceList then the technician can select the serial number from the list. The selected serial number is in the ADU_DEVICE_ID structure when the function returns. The application program can save the serial number as a unique identifier for the scale or the counter. (for two devices ShowAduDeviceList must be called twice).

See the example code

Simplification When ADU Products Differ

If the ADU devices have different model numbers then life is simpler.


In this case use the OpenAduDeviceByProductId to connect to the correct device. The temperature sensor is always connected to the ADU100. The flow meter is always connected to the ADU200.

        hTemperature = OpenAduDeviceByProductId(100, 0); 
        hFlow = OpenAduDeviceByProductId(200, 0); 

This is preferable because if one of the ADU devices is destroyed it can be replaced without informing the application of the serial number of the new device.

For example, say a forklift runs over the ADU100. The field technician can replace the ADU100 without changing any configuration values on the PC. The application program will use OpenByProductId to connect with the new ADU100 and will not confuse it with the ADU200 device.

 

NEWS         PRODUCTS         PROGRAMMING          APPLICATIONS          CUSTOM DESIGN          ORDERING          HOME


TestPoint is a trademark of Capital Equipment Corp.   
LabVIEW is a trademark of National Instruments.
Visual BASIC is a trademark of Microsoft Corporation


Copyright © 2002 ONTRAK CONTROL SYSTEMS 764 Notre Dame Ave, Unit #1 , Sudbury, Ontario, CANADA P3A 2T2  
"Quality serial Data Acquisition Interfaces"           PH. (705) 671-2652 FAX (705) 671-6127