Page 1 of 1

libphidget22 raw analog input interface?

Posted: Sat May 19, 2018 3:05 pm
by wbclay
I'm porting a Python app from libphiget21 to libphidget22 and, if possible, would like to continue to operate with the native 10-bit integer input (right?) provided by my single USB-connected Interface Kit 1203_2 ver. 204 analog inputs. Is there perhaps an API hidden below the onVoltageChange() or getVoltage() interfaces that would pass me the raw 10-bit integer values (plus 2 bits LSB padding?) provided by the device? It's no problem in this environment if any such hidden API is unavailable for more recent Phidget devices and/or network support.

Motivation: Current logic seems to work well, and I'd rather not rewrite it. I'm doing 32 ms interval sampling and my own smoothing and filtering to detect brief Voltage dips. I presume skipping the floating point operations should leave the app lighter weight at no loss of precision. In any case, even if the app must deal with input as true Voltage floating point values, I still need to scale them by the calibration values for the system being monitored.

Re: libphidget22 raw analog input interface?

Posted: Tue May 22, 2018 11:10 am
by Patrick
phidget22 always gives you the full-precision value, but now as a double in Volts, rather then an arbitrary 0-1000 value.

Floating point operations are very fast on anything but the most basic micro-controllers because they are handled by hardware floating point units, so this shouldn't be an issue. Double precision floats have resolution several orders of magnitude greater then the data coming in from the analog ports.

-Patrick