Phidget Motor Control
[Specific Phidgets]


Typedefs

typedef struct
_CPhidgetMotorControl * 
CPhidgetMotorControlHandle

Functions

int CPhidgetMotorControl_create (CPhidgetMotorControlHandle *phid)
int CPhidgetMotorControl_getMotorCount (CPhidgetMotorControlHandle phid, int *count)
int CPhidgetMotorControl_getVelocity (CPhidgetMotorControlHandle phid, int index, double *velocity)
int CPhidgetMotorControl_setVelocity (CPhidgetMotorControlHandle phid, int index, double velocity)
int CPhidgetMotorControl_set_OnVelocityChange_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double velocity), void *userPtr)
int CPhidgetMotorControl_getAcceleration (CPhidgetMotorControlHandle phid, int index, double *acceleration)
int CPhidgetMotorControl_setAcceleration (CPhidgetMotorControlHandle phid, int index, double acceleration)
int CPhidgetMotorControl_getAccelerationMax (CPhidgetMotorControlHandle phid, int index, double *max)
int CPhidgetMotorControl_getAccelerationMin (CPhidgetMotorControlHandle phid, int index, double *min)
int CPhidgetMotorControl_getCurrent (CPhidgetMotorControlHandle phid, int index, double *current)
int CPhidgetMotorControl_set_OnCurrentChange_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current), void *userPtr)
int CPhidgetMotorControl_getInputCount (CPhidgetMotorControlHandle phid, int *count)
int CPhidgetMotorControl_getInputState (CPhidgetMotorControlHandle phid, int index, int *inputState)
int CPhidgetMotorControl_set_OnInputChange_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int inputState), void *userPtr)
int CPhidgetMotorControl_getEncoderCount (CPhidgetMotorControlHandle phid, int *count)
int CPhidgetMotorControl_getEncoderPosition (CPhidgetMotorControlHandle phid, int index, int *position)
int CPhidgetMotorControl_setEncoderPosition (CPhidgetMotorControlHandle phid, int index, int position)
int CPhidgetMotorControl_set_OnEncoderPositionChange_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int time, int positionChange), void *userPtr)
int CPhidgetMotorControl_set_OnEncoderPositionUpdate_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int positionChange), void *userPtr)
int CPhidgetMotorControl_getBackEMFSensingState (CPhidgetMotorControlHandle phid, int index, int *bEMFState)
int CPhidgetMotorControl_setBackEMFSensingState (CPhidgetMotorControlHandle phid, int index, int bEMFState)
int CPhidgetMotorControl_getBackEMF (CPhidgetMotorControlHandle phid, int index, double *voltage)
int CPhidgetMotorControl_set_OnBackEMFUpdate_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double voltage), void *userPtr)
int CPhidgetMotorControl_getSupplyVoltage (CPhidgetMotorControlHandle phid, double *supplyVoltage)
int CPhidgetMotorControl_getBraking (CPhidgetMotorControlHandle phid, int index, double *braking)
int CPhidgetMotorControl_setBraking (CPhidgetMotorControlHandle phid, int index, double braking)
int CPhidgetMotorControl_getSensorCount (CPhidgetMotorControlHandle phid, int *count)
int CPhidgetMotorControl_getSensorValue (CPhidgetMotorControlHandle phid, int index, int *sensorValue)
int CPhidgetMotorControl_getSensorRawValue (CPhidgetMotorControlHandle phid, int index, int *sensorRawValue)
int CPhidgetMotorControl_set_OnSensorUpdate_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int sensorValue), void *userPtr)
int CPhidgetMotorControl_getRatiometric (CPhidgetMotorControlHandle phid, int *ratiometric)
int CPhidgetMotorControl_setRatiometric (CPhidgetMotorControlHandle phid, int ratiometric)
int CPhidgetMotorControl_set_OnCurrentUpdate_Handler (CPhidgetMotorControlHandle phid, int(*fptr)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current), void *userPtr)

Detailed Description

These calls are specific to the Phidget Motor Control object. See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.

Typedef Documentation

typedef struct _CPhidgetMotorControl* CPhidgetMotorControlHandle

A Phidget MotorControl handle


Function Documentation

int CPhidgetMotorControl_create ( CPhidgetMotorControlHandle phid  ) 

Creates a Phidget MotorControl handle.

Parameters:
phid A pointer to an unallocated Phidget MotorControl handle.

int CPhidgetMotorControl_getMotorCount ( CPhidgetMotorControlHandle  phid,
int *  count 
)

Gets the number of motors supported by this controller.

Parameters:
phid An attached phidget motor control handle.
count The motor count.

int CPhidgetMotorControl_getVelocity ( CPhidgetMotorControlHandle  phid,
int  index,
double *  velocity 
)

Gets the current velocity of a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
velocity The current velocity.

int CPhidgetMotorControl_setVelocity ( CPhidgetMotorControlHandle  phid,
int  index,
double  velocity 
)

Sets the velocity of a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
velocity The velocity.

int CPhidgetMotorControl_set_OnVelocityChange_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double velocity)  fptr,
void *  userPtr 
)

Sets a velocity change event handler. This is called when the velocity changes.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_getAcceleration ( CPhidgetMotorControlHandle  phid,
int  index,
double *  acceleration 
)

Gets the last set acceleration of a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
acceleration The acceleration.

int CPhidgetMotorControl_setAcceleration ( CPhidgetMotorControlHandle  phid,
int  index,
double  acceleration 
)

Sets the last set acceleration of a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
acceleration The acceleration.

int CPhidgetMotorControl_getAccelerationMax ( CPhidgetMotorControlHandle  phid,
int  index,
double *  max 
)

Gets the maximum acceleration supported by a motor

Parameters:
phid An attached phidget motor control handle
index The motor index.
max The maximum acceleration.

int CPhidgetMotorControl_getAccelerationMin ( CPhidgetMotorControlHandle  phid,
int  index,
double *  min 
)

Gets the minimum acceleration supported by a motor.

Parameters:
phid An attached phidget motor control handle
index The motor index.
min The minimum acceleration

int CPhidgetMotorControl_getCurrent ( CPhidgetMotorControlHandle  phid,
int  index,
double *  current 
)

Gets the current current draw for a motor.

Parameters:
phid An attached phidget motor control handle
index The motor index.
current The current.

int CPhidgetMotorControl_set_OnCurrentChange_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current)  fptr,
void *  userPtr 
)

Sets a current change event handler. This is called when the current draw changes.

Parameters:
phid An attached phidget motor control handle
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_getInputCount ( CPhidgetMotorControlHandle  phid,
int *  count 
)

Gets the number of digital inputs supported by this board.

Parameters:
phid An attached phidget motor control handle.
count The ditial input count.

int CPhidgetMotorControl_getInputState ( CPhidgetMotorControlHandle  phid,
int  index,
int *  inputState 
)

Gets the state of a digital input.

Parameters:
phid An attached phidget motor control handle.
index The input index.
inputState The input state. Possible values are PTRUE and PFALSE.

int CPhidgetMotorControl_set_OnInputChange_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int inputState)  fptr,
void *  userPtr 
)

Set a digital input change handler. This is called when a digital input changes.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_getEncoderCount ( CPhidgetMotorControlHandle  phid,
int *  count 
)

Gets the number of encoder inputs supported by this board.

Parameters:
phid An attached phidget motor control handle.
count The encoder input count.

int CPhidgetMotorControl_getEncoderPosition ( CPhidgetMotorControlHandle  phid,
int  index,
int *  position 
)

Gets the position of an encoder. This position starts at 0 every time the phidget is opened.

Parameters:
phid An attached phidget motor control handle.
index The encoder index.
position The encoder position.

int CPhidgetMotorControl_setEncoderPosition ( CPhidgetMotorControlHandle  phid,
int  index,
int  position 
)

Sets the encoder position. This can be used to set the position to a known value, and should only be called when the encoder is not moving.

Parameters:
phid An attached phidget motor control handle.
index The encoder index.
position The encoder position.

int CPhidgetMotorControl_set_OnEncoderPositionChange_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int time, int positionChange)  fptr,
void *  userPtr 
)

Set an encoder position change handler. This is called when the encoder position changes.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_set_OnEncoderPositionUpdate_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int positionChange)  fptr,
void *  userPtr 
)

Set an encoder position update handler. This is called at a constant rate; every 8ms, whether the encoder position has changed or not.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_getBackEMFSensingState ( CPhidgetMotorControlHandle  phid,
int  index,
int *  bEMFState 
)

Gets the Back EMF sensing state for a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
bEMFState The back EMF sensing state.

int CPhidgetMotorControl_setBackEMFSensingState ( CPhidgetMotorControlHandle  phid,
int  index,
int  bEMFState 
)

Sets the Back EMF sensing state for a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
bEMFState The back EMF sensing state.

int CPhidgetMotorControl_getBackEMF ( CPhidgetMotorControlHandle  phid,
int  index,
double *  voltage 
)

Gets the Back EMF voltage for a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
voltage The back EMF voltage, in volts.

int CPhidgetMotorControl_set_OnBackEMFUpdate_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double voltage)  fptr,
void *  userPtr 
)

Set a back EMF update handler. This is called at a constant rate; every 16ms, when back EMF sensing is enabled for that motor.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_getSupplyVoltage ( CPhidgetMotorControlHandle  phid,
double *  supplyVoltage 
)

Gets the Supply voltage for the motors. This could be higher then the actual supply voltage.

Parameters:
phid An attached phidget motor control handle.
supplyVoltage The supply voltage, in volts.

int CPhidgetMotorControl_getBraking ( CPhidgetMotorControlHandle  phid,
int  index,
double *  braking 
)

Gets the Braking value for a motor.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
braking The braking value, in percent.

int CPhidgetMotorControl_setBraking ( CPhidgetMotorControlHandle  phid,
int  index,
double  braking 
)

Sets the Braking value for a motor. This is applied when velocity is 0. Default is 0%.

Parameters:
phid An attached phidget motor control handle.
index The motor index.
braking The braking value, in percent.

int CPhidgetMotorControl_getSensorCount ( CPhidgetMotorControlHandle  phid,
int *  count 
)

Gets the number of sensor inputs supported by this board.

Parameters:
phid An attached phidget motor control handle.
count The sensor input count.

int CPhidgetMotorControl_getSensorValue ( CPhidgetMotorControlHandle  phid,
int  index,
int *  sensorValue 
)

Gets the value of a sensor.

Parameters:
phid An attached phidget motor control handle.
index The sensor index.
sensorValue The sensor value, range: 0-1000.

int CPhidgetMotorControl_getSensorRawValue ( CPhidgetMotorControlHandle  phid,
int  index,
int *  sensorRawValue 
)

Gets the raw value of a sensor (12-bit).

Parameters:
phid An attached phidget motor control handle.
index The sensor index.
sensorRawValue The sensor value, range: 0-4096.

int CPhidgetMotorControl_set_OnSensorUpdate_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, int sensorValue)  fptr,
void *  userPtr 
)

Set a sensor update handler. This is called at a constant rate; every 8ms.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetMotorControl_getRatiometric ( CPhidgetMotorControlHandle  phid,
int *  ratiometric 
)

Gets the ratiometric state.

Parameters:
phid An attached phidget motor control handle.
ratiometric The ratiometric state.

int CPhidgetMotorControl_setRatiometric ( CPhidgetMotorControlHandle  phid,
int  ratiometric 
)

Sets the ratiometric state. This control the voltage reference used for sampling the analog sensors.

Parameters:
phid An attached phidget motor control handle.
ratiometric The ratiometric state.

int CPhidgetMotorControl_set_OnCurrentUpdate_Handler ( CPhidgetMotorControlHandle  phid,
int(*)(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current)  fptr,
void *  userPtr 
)

Set a current update handler. This is called at a constant rate; every 8ms.

Parameters:
phid An attached phidget motor control handle.
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.


Generated on Wed Jan 5 12:08:42 2022 for Phidget21 by  doxygen 1.5.9