Actuator API

The Actuator API encompasses the needed software to drive both the Digital-to-Analog Converter (DAC) and the physical device which it drives. The advantage this approach provides is that most programming to be done with a user's system can be done in nature engineering units rather than abstract volts or hex numbers. However, there are instances where a lower level treatment of these devices are required. In these cases, this API provides the ability to directly access the DAC's.

Example Use


In the following example, an 8 channel card is initialized. Each DAC is driving a servo amp. Finally, the channel #0 amp is commanded to 1.5 Amps.
/* initialize actuators */
int numDacChannels, i;
numDacChannels = 8;
setNumDacs (8);
for (i = 0; i < numDacChannels; i++)
{
/* 12-bit, 10V max, bipolar, offset device */
initDac (i, 1, 0, 12, 10.0);
/* servo amp with a 0.0-5.0V input and +/-2.0Amps output */
initAct (i, 0.0, -2.0, 5.0, 2.0);
}
/* command the servoamp on channel #0 to 1.5Amps */
setActuator (0, 1.5);

Method Index

 o getDacNumBits()
 o initAct()
 o initDac()
 o isDacBipolar()
 o isDacTwosComplement()
 o setActuator()
 o setActuatorMaximum()
 o setActuatorMinimum()
 o setDac()
 o setDacBipolar()
 o setDacHex()
 o setDacNumBits()
 o setDacReference()
 o setDacTwosComplement()
 o setNumDacs()
 o updateAll()
 o updateDac()
 o updateTotal()

Methods

 o getDacNumBits
unsigned int getDacNumBits (unsigned int channel);
Get the number of bits of resolution for a channel.
Parameters
channel - channel number of the associated DAC.
Returns
Resolution of the DAC channel in bits.
 o getNumDacs
unsigned int getNumDacs ()
Get the number of channels of DAC's.
Returns
Number of the DAC channels.
 o initAct
void initAct (unsigned int channel, float dacMin, float actMin, 
	      float dacMax, float actMax)
Initializes an actuator attached to a given DAC channel. The initialization includes setting both the maximum and minimum points which, with the basic DAC configuration, are used to establish the relationship between the physical units and the hex value used to command the DAC (see setActuator).
Parameters
channel - channel number of the DAC to set.
dacMin - minimum voltage for the DAC to command.
actMin - minimum physical value which corresponds to the minimum DAC voltage.
dacMax - maximum voltage for the DAC to command.
actMax - maximum physical value which corresponds to the maximum DAC voltage.
 o initDac
void initDac (unsigned int channel, int isBipolar, 
	      int isTwosComplement, unsigned int numBits,
	      float referenceVal)
Initializes a DAC channel with the device attributes.
Parameters
channel - channel number of the DAC to set.
isBipolar - set to 1 if bipolar or 0 if DAC is an unipolar type device.
isFullGain - set to 1 if full gain or 0 if DAC is to be configured to half gain.
isTwosComplement - set to 1 if two's complement is used or 0 if offset representation is used for DAC numbers.
numBits - number of bits resolution.
referenceVal - reference voltage of the DAC. Note, different devices have different rules for relating their reference to their range. This API uses the convention that the maximum voltage is one bit less than the reference voltage.
 o isDacBipolar
unsigned int isDacBipolar (unsigned int channel);
Returns the polarity setting of the DAC.
Returns
0 - unipolar, 1 - bipolar.
 o isDacFullGain
unsigned int isDacFullGain (unsigned int channel);
Returns the gain setting of the DAC.
Returns
0 - half gain, 1 - full gain.
 o isDacTwosComplement
unsigned int isDacTwosComplement (unsigned int channel);
Returns the number format setting of the DAC.
Returns
0 - offset format, 1 - two's complement format.
 o setActuator
void setActuator (unsigned int channel, float value);
Sets the actuator, connected to a DAC channel, to a physical value. If the requested value exceeds the limits established, the limit is used instead.
Parameters
channel - channel number of the associated DAC to set
value - command to be set in the previously established physical units.
 o setActuatorMaximum
void setActuatorMaximum (unsigned int channel, float dacValue,
			 float actuatorValue);
Sets the maximum physical level and the associated DAC voltage command for a given channel.
Parameters
*channel - channel number of the DAC to set
dacValue - maximum voltage for the DAC to command (see setActuator)
actuatorValue - maximum physical value which corresponds to the maximum DAC voltage.
 o setActuatorMinimum
void setActuatorMinimum (unsigned int channel, float dacValue,
			 float actuatorValue);
Sets the minimum physical level and the associated DAC voltage command for a given channel.
Parameters
channel - channel number of the DAC to set
dacValue - minimum voltage for the DAC to command (see setActuator)
actuatorValue - minimum physical value which corresponds to the minimum DAC voltage.
 o setDac
void setDac (unsigned int channel, float value);
 o setDacBipolar
void setDacBipolar (unsigned int channel, int isBipolar);
 o setDacBipolar
void setDacBipolar (unsigned int channel, int isBipolar);
 o setDacFullGain
void setDacFullGain (unsigned int channel, int isBipolar);
 o setDacHex
void setDacHex (unsigned int channel, unsigned int value);
 o setDacNumBits
void setDacNumBits (unsigned int channel, unsigned int numBits);
 o setDacReference
void setDacReference (unsigned int noChannels, float value);
 o setDacTwosComplement
void setDacTwosComplement (unsigned int channel, 
                           int isTwosComplement);
 o setNumDacs
      void setNumDacs (unsigned int noChannels);
Set the number of channels of DAC's.
Returns
0 - successful.
-1 - unsuccessful, memory was not allocated.
 o updateAll
void updateAll();

Updates all parameters and configurations for all DAC/actuators currently declared.
 o updateDac
void updateDac (unsigned int channel);

Updates the DAC-specific parameters and configurations for DAC currently declared.
Parameters
channel - channel number of the DAC to update.
 o updateTotal
unsigned int updateTotal (unsigned int channel);
Updates all parameters and configurations for DAC/actuator currently declared.
Parameters
channel - channel number of the DAC to update.
extern unsigned int ActLimitError; extern unsigned int DacLimitError; extern unsigned int safeDacHex;
Last modified: Thu Jul 22 07:02:34 Eastern Daylight Time 1999