background image

9

1002_0_Product_Manual - March 2, 2011 9:59 AM

Programming a Phidget

Phidgets’ philosophy is that you do not have to be an electrical engineer in order to do projects that use devices 

like sensors, motors, motor controllers, and interface boards. All you need to know is how to program. We have 

developed a complete set of Application Programming Interfaces (API) that are supported for Windows, Mac OS X, 

and Linux. When it comes to languages, we support VB6, VB.NET, C#.NET, C, C++, Flash 9, Flex, Java, LabVIEW, 

Python, Max/MSP, and Cocoa.

Architecture

We have designed our libraries to give you the maximum amount of freedom. We do not impose our own 

programming model on you. 
To achieve  this goal we have implemented the libraries as a series of layers with the C API at the core surrounded 

by other language wrappers.

Libraries

The lowest level library is the C API.  The C API can be programmed against on Windows, CE, OS X and Linux.  With 

the C API, C/C++, you can write cross-platform code.  For systems with minimal resources (small computers), the C 

API may be the only choice.
The Java API is built into the C API Library.  Java, by default is cross-platform - but your particular platform may not 

support it (CE).  
The .NET API also relies on the C API.  Our default .NET API is for .NET 2.0 Framework, but we also have .NET 

libraries for .NET 1.1 and .NET Compact Framework (CE).  
The COM API relies on the C API.  The COM API is programmed against when coding in VB6, VBScript, Excel (VBA), 

Delphi and Labview.  
The ActionScript 3.0 Library relies on a communication link with a PhidgetWebService (see below).  ActionScript 3.0 

is used in Flex and Flash 9.

Programming Hints

Every Phidget has a unique serial number - this allows you to sort out which device is which at runtime.  Unlike 

• 

USB devices which model themselves as a COM port, you don’t have to worry about where in the USB bus you 
plug your Phidget in.  If you have more than one Phidget, even of the same type, their serial numbers enable 
you to sort them out at runtime.

Each Phidget you have plugged in is controlled from your application using an object/handle specific to that 

• 

phidget.  This link between the Phidget and the software object is created when you call the .OPEN group of 
commands.  This association will stay, even if the Phidget is disconnected/reattached, until .CLOSE is called.

For full performance, the Phidget APIs are designed to be used in an event driven architecture.  Applications that 

• 

require receiving all the data streaming from the device will have to use event handlers, instead of polling.

Networking Phidgets

The PhidgetWebService is an application written by Phidgets Inc. which acts as a network proxy on a computer.  The 

PhidgetWebService will allow other computers on the network to communicate with the Phidgets connected to that 

computer.  ALL of our APIs have the capability to communicate with Phidgets on another computer that has the 

PhidgetWebService running.
The PhidgetWebService also makes it possible to communicate with other applications that you wrote and that are 

connected to the PhidgetWebService, through the PhidgetDictionary object.

Summary of Contents for 1002

Page 1: ...Product Manual 1002 PhidgetAnalog 4 Output ...

Page 2: ...Phidgets 1002 Product Manual For Board Revision 0 Phidgets Inc 2011 ...

Page 3: ...m 7 Testing Using Mac OS X 8 If you are using Linux 8 If you are using Windows Mobile CE 5 0 or 6 0 9 Programming a Phidget 9 Architecture 9 Libraries 9 Programming Hints 9 Networking Phidgets 10 Documentation 10 Programming Manual 10 Getting Started Guides 10 API Guides 10 Code Samples 10 API for the PhidgetAnalog 4 Output 10 Functions 10 Properties 11 Events 12 Technical Section 12 General 12 Is...

Page 4: ...13 Product History 13 Support ...

Page 5: ...actuators motor controls etc Programming Environment Operating Systems Windows 2000 XP Vista 7 Windows CE Linux and Mac OS X Programming Languages APIs VB6 VB NET C NET C Flash 9 Flex Java LabVIEW Python Max MSP and Cocoa Examples Many example applications for all the operating systems and development environments above are available for download at www phidgets com Programming Connection The boar...

Page 6: ... of the Phidget library installed on your PC If you don t do the following Go to www phidgets com Drivers Download and run Phidget21 Installer 32 bit or 64 bit depending on your PC You should see the icon on the right hand corner of the Task Bar Running Phidgets Sample Program Double clicking on the icon loads the Phidget Control Panel we will use this program to make sure that your new Phidget wo...

Page 7: ... a multimeter it should display the voltage as set by the slider 1 3 2 Double Click on the icon to activate the Phidget Control Panel and make sure that the Phidget Analog 4 output is properly attached to your PC Testing Using Mac OS X Click on System Preferences Phidgets under Other to activate the Preference Pane Make sure that the PhidgetAnalog 4 Output is properly attached Double Click on Phid...

Page 8: ...e to be run as root or udev hotplug must be configured to give permissions when the Phidget is plugged in If you are using Windows Mobile CE 5 0 or 6 0 Go to www phidgets com Drivers Download x86 ARMV4I or MIPSII depending on the platform you are using Mini itx and ICOP systems will be x86 and most mobile devices including XScale based systems will run the ARMV4I The CE libraries are distributed i...

Page 9: ...BA Delphi and Labview The ActionScript 3 0 Library relies on a communication link with a PhidgetWebService see below ActionScript 3 0 is used in Flex and Flash 9 Programming Hints Every Phidget has a unique serial number this allows you to sort out which device is which at runtime Unlike USB devices which model themselves as a COM port you don t have to worry about where in the USB bus you plug yo...

Page 10: ...ality of the device to be explored Most developers start by modifying existing examples until they have an understanding of the architecture Go to www phidgets com Programming to see if there are code samples written for your device Find the language you want to use and click on the magnifying glass besides Code Sample You will get a list of all the devices for which we wrote code samples in that ...

Page 11: ...RCURRENT An overcurrent condition has occured on an output Under this condition the output is clamped to 20mA ErrorCode EEPHIDGET_OVERTEMP A Thermal Shutdown state has occured The outputs will be shut down under this condition When overcurrent or overtemperature state have ended there will be an error event with the EEPHIDGET_OK code See the ErrorDescription string for specific error details ...

Page 12: ...ill limit the available current per channel at approximately 20mA For reliable results don t approach this limit as it will vary from channel to channel For maximum accuracy limit the current to 5mA If more than 20mA of current is drawn the device goes into a constant current supply mode When this happens the current will be held constant at it s maximum value and the output voltage will depend on...

Page 13: ...DC USB Max Current 300 mA USB Quiescent Current 55 mA Capacitive Load Stability 4000 pF Output Voltage Range 10 V Terminal Block min max wire gauge 16 26 AWG Isolation Not Isolated all channels share common ground Operating Temperature 0 70 C Product History Date Board Revision Device Version Comment March 2011 0 100 Product Release requires phidget21 2 1 8 Support Call the support desk at 1 403 2...

Reviews: