- Get latest library and example packages
- configure, make, make install the library package.
- Possible missing of the phidget21.h (had to download it separately).
- During compilation, possible missing declaration, in this case add to the phidget21.h the following declarations:
#include <stdint.h> #define __declspec(x) #define __stdcall #define __int64 uint64_t #define CCONV
- from the examples:
gcc Analog-simple.c -o Analog-simple -pthread -lphidget21
- In this example, the 4 DACs are available with functions for setting the DAC(voltage) and a channel enable.
CPhidgetAnalog_setVoltage(analog, 0, 1.0); CPhidgetAnalog_setVoltage(analog, 1, 2.0); CPhidgetAnalog_setVoltage(analog, 2, 3.0); CPhidgetAnalog_setVoltage(analog, 3, 4.0); CPhidgetAnalog_setEnabled(analog, 0, PTRUE); CPhidgetAnalog_setEnabled(analog, 1, PTRUE); CPhidgetAnalog_setEnabled(analog, 2, PTRUE); CPhidgetAnalog_setEnabled(analog, 3, PTRUE);
- For other devices, refer to its documentation for the API function list.
(written by T Lindner, May 2013)
I bought a Phidget 1044 accelerometer/MagneticField measurement device for the PMT test facility. The main purpose is to be able to measure the tilt of the laser/APD. This is the device I got
The C software from phidget was pretty easy to use (there were some problems, which I detail below) and I could quickly write a crude front-end for reading out the acceleration/mag-field information. The code is here
1) Installed the newest phidget software, described here
Needed to be root in order to installed the libraries in standard locations
2) Allow non-root users to be able to fully talk to USB device
cp udev/99-phidgets.rules /etc/udev/rules.d
3) Initially I couldn't correctly talk to the Phidget. It turned out that you need to have version 1. or higher libusb libraries (this is mentionned on the webpage). neut14 (SL5) where I initially tested the phidget had older libraries. On midptf01 (SL6) I had the right libraries and everything worked.
4) I used a pair of USB extender cables in order to be able to have ~40 feet of USB cable between the phidget and the computer. This seems to be working without any problem.