Phidget: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
No edit summary
m (15 revisions imported)
 
(No difference)

Latest revision as of 15:29, 31 May 2021

PHIDGET devices

Installation

Phidget

  • Get latest library and example packages
    • libphidget_2.1.8.20120131.tar.gz
    • phidget21-c-examples_2.1.8.20120131.tar.gz
  • 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

Build

  • from the examples:
gcc Analog-simple.c -o Analog-simple -pthread -lphidget21

Operation

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

Phidget 1044

(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

http://www.phidgets.com/products.php?product_id=1044_0

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

https://ladd00.triumf.ca/viewvc/midptf/trunk/src/fePhidget.c?view=log

_______________________________________________________

Details/tricks:

1) Installed the newest phidget software, described here

http://www.phidgets.com/docs/Language_-_C/C%2B%2B

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.