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.
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