libphidget22 raw analog input interface?

Supporting 2.6 and up
wbclay
Phidgetsian
Posts: 9
Joined: Mon Jan 14, 2013 8:27 am
Contact:

libphidget22 raw analog input interface?

Postby wbclay » Sat May 19, 2018 3:05 pm

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.

User avatar
Patrick
Lead Developer
Posts: 3067
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: libphidget22 raw analog input interface?

Postby Patrick » Tue May 22, 2018 11:10 am

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


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest