ADC-16 driver problem... and feature suggestions.

Post general discussions on using our drivers to write your own software here
Post Reply
Fsteff !

ADC-16 driver problem... and feature suggestions.

Post by Fsteff ! » Mon Mar 06, 2006 5:05 pm


I've been asked to make specialized interface for the ADC-16 for Excel, using VBA.

However, I find the documentation of the dll functions very(!) limited, and have had to use trail and error to get it working.

I've noticed some problems with some of the provided functions, and one error (if I understand the documentation correct).

The error first.

If I call adc16_get_filtered_value(), I expected to get a filtered sampled value. But instead I get the value of adc16_get_value() multiplied by the filter value. Not very usefull.

Here are some integer examples (filter = 4)

Code: Select all

Sampled value | Filtered value | Expected value (decimal value)
10                  |           40        |  2    (2.5)
8                    |           32        |  4    (4.5)
10                  |           40        |  7
11                  |           44        | 10   (9.75)
As can clearly be seen, the filter isn't working at all.


Okay. Now to some of the things that I'd like to see improved.

adc16_open_unit() is documented to return false if no ADC-16 is attacted to the specified port, and true if an ADC-16 is attatched.
However, it also returns false if the port is not available in the computer, or if the same port was allready opened.
It would be a huge improvement if it would return something else then a boolean value.
An idear would be that it returned the port number opened on a success, and negative numbers on errors.
For example:
2 = COM2 opened.
1 = COM1 opened.
0 = Specified comport is not present on this machine.
-1 = COM1 is allready opened.
-2 = COM2 is allready opened.


Using VBA, I'm aware that I must call adc16_poll() with regular intevals to poll values from the ADC. But what does it actualy do? Again, the documentation is too limited.
I have the problem that adc16_get_value() during start sometimes returns false (thus no data) in channels 5 thru 8, even after polling in a loop (as shown in the VBA examples) for 10000 ticks. During those 10 seconds, adc16_poll() has been called over 8000 times.

It would be very nice to know if adc16_poll() actualy needs to be called that many times. It would also be very nice if it reported some kind "sampling in progress" status.

Well, quiet much for a first posting.
I'm looking forward to your answers.

adc16_get_version() returns 516
adc16_get_driver_version() returns 4106

Best regards,

Posts: 1
Joined: Mon Mar 06, 2006 3:55 pm

Post by fsteff » Mon Mar 06, 2006 5:13 pm


Two things went wrong with that posting.
Apparently I was too slow to write it, so it was posted as a "guest" posting (and thus without email notification), and second my example filter value table was screwed up.
Here it is again:

Code: Select all

Sampled value | Filtered value | Expected value (decimal value)
10            |        40      |       2        (2.5)
 8            |        32      |       4        (4.5)
10            |        40      |       7        (7.0)
11            |        44      |      10        (9.75)


Advanced User
Advanced User
Posts: 656
Joined: Thu Jul 07, 2005 12:41 pm
Location: St Neots, Cambridgeshire

Post by Michael » Wed Mar 08, 2006 11:11 am


Our software development team have answered your questions as detailed below:

Filtered values
The filtered values are recorded as follows:
filteredValue[i] = rawValue – filteredValue[i-1] / filterFactor;

When you request a filtered value, it is then multiplied by filter factor. If therefore, there is only one reading so far, filteredValue[i] == rawValue and so you see results as the customer describes.

Non-filtered values
A non-filtered values is the median value of the last three raw values.

Port and sampling Status
We are not developing the ADC16 drivers further. Recent developments in poroduct range demands more attention, therefore the ADC16 driver will not be changed.

adc16_poll ()
The adc16_poll () routine is called using a system time every 50ms. As the ADC16 is a completely dumb device, the PC must initiate the a to d conversions via this routine.
There is no need to call this manually. The routine is a throw back to 16 bit operating systems where timers weren’t available.

Version Numbers
For the driver version, try the following:
wsprintf (str, "ADC-16 driver version %d.%d", version >> 8, version & 0xFF);

adc16_get_driver_version() returns 516, which is 0x0204 which translates to version 2.4

For the ADC16 hardware version try the following:
wsprintf(str, "\nADC-16 Unit V%d", version & 0xFF);

adc16_get_version () returns 4106, which is 0x100A, masking with 0xFF gives 0x000A, which translates to version 10

I hope this answers some of your questions.

Best regards,
Michael - Tech Support
Pico Technology
Web Support Forum

Post Reply