Product manual

10
1047_0_Product_Manual - June 18, 2010 2:20 PM
Documentation
Programming Manual
The Phidget Programming Manual documents the Phidgets software programming model in a language and device
unspecicway,providingageneraloverviewofthePhidgetsAPIasawhole.Youcanndthemanualatwww.
phidgets.com >> Programming.
Getting Started Guides
We have written Getting Started Guides for most of the languages that we support. If the manual exists for the
languageyouwanttouse,thisistherstmanualyouwanttoread.TheGuidescanbefoundatwww.phidgets.com
>> Programming, and are listed under the appropriate language.
API Guides
We maintain API references for COM (Windows), C (Windows/Mac OSX/Linux), Action Script, .Net and Java. These
references document the API calls that are common to all Phidgets. These API References can be found under www.
phidgets.com >> Programmingandarelistedundertheappropriatelanguage.TolookattheAPIcallsforaspecic
Phidget, check its Product Manual.
Code Samples
We have written sample programs to illustrate how the APIs are used.
Due to the large number of languages and devices we support, we cannot provide examples in every language for
every Phidget. Some of the examples are very minimal, and other examples will have a full-featured GUI allowing
all the functionality 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 language.
API for the PhidgetEncoder Highspeed 4-Input
WedocumentAPICallsspecictothisproductinthissection.FunctionscommontoallPhidgetsandfunctionsnot
applicable to this device are not covered here. This section is deliberately generic. For calling conventions under a
speciclanguage,refertotheassociatedAPImanual.Forexactvalues,refertothedevicespecications.
Functions
int InputCount() [get] : Constant
Returns the number of digital inputs supported by this PhidgetEncoder. On the 1047, there are 4 digital inputs.
bool InputState (int EncoderIndex) [get]
Returns the state of a particular digital input.
int EncoderCount() [get] : Constant
Returns the number of encoders supported by this PhidgetEncoder Highspeed 4-Input. The 1047 supports up to
four optical quadrature encoders.
int Position(int EncoderIndex) [get,set]
Returns/sets the position of an encoder. This is an absolute position as calculated since the encoder was plugged
in. Dividing position by the number of increments per revolution will give the number of rotations the encoder has
travelled. Encoder position is returned in number of pulses, which is equivalent to four-times the number of encoder
counts.
Positioncanbeset,typicallyusedwhenanencoderhasreachedanidentiable(throughexternalmeans,suchasa
limit switch) home position. This call does not send information to the device, as an absolute position is maintained
only in the library. After this call, position changes from the encoder will use the new value to calculate absolute
position.