- Main Page
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# cDriverServotogo Class Reference

cDriverServotogo offers an interface to the Servo2Go boards. More...

`#include <CDriverServotogo.h>`

Inheritance diagram for cDriverServotogo:

List of all members.

## Public Member Functions
| cDriverServotogo ()
| Constructor of cDriverServotogo.
| ~cDriverServotogo ()
| Destructor of cVirtualTool.
virtual int | open ()
| Open connection to Sensoray626 board.
virtual int | close ()
| Close connection to Sensoray626 board.
virtual int | initialize (const bool a_resetEncoders=false)
| Initialize Sensoray626 board.
virtual int | command (int iCommand, void *iData)
## Private Member Functions
void | setDac (int a_num, double a_volts)
int | getEncoder (int a_num, long *a_value)
| Read encoder values. Returns the number of values read.
unsigned short | brdtstOK (unsigned short a_baseAddress)
| Checks if the board is present.
void | stg_Init (unsigned short a_wAdd)
| Initializes the board. This should be called by the constructor.
void | encoderInit ()
| Initializes the encoders.
void | encoderLatch ()
| Latches the encoders.
unsigned short | findBaseAddress ()
| Automatically finds the base address of the board.
void | encReadAll (LONGBYTE *a_lbEnc)
| Latches and reads all the encoders of the board.
void | rawDAC (unsigned short a_nAxis, long a_lCounts)
int | getBaseAddress ()
| Returns the base address for the board.
## Private Attributes
long | m_homeposition [20]
unsigned short | m_wBaseAddress
| Board base address.
unsigned short | m_wIrq
| Interrupt request used by board.
unsigned short | m_wModel
| Board model: defined by BrdtstOK.
unsigned short | m_wNoBoardFlag
| Tells if the board is present. set by stg_init().
unsigned short | m_wAxesInSys
| Number of encoders used. set by stgInit() through encoderInit().
unsigned short | m_wSaveDirs
| Directions for DIO. Set by DIODirections(). don't care now.
unsigned char | m_byIndexPollAxis
| Set by stg_init().
unsigned char | m_byIndexPulsePolarity
| Polarity of signals.

## Detailed Description

cDriverServotogo offers an interface to the Servo2Go boards.

## Constructor & Destructor Documentation

cDriverServotogo::cDriverServotogo | ( |  | ) |

Constructor of cDriverServotogo.

Constructor of cDriverServotogo.

cDriverServotogo::~cDriverServotogo | ( |  | ) |

Destructor of cVirtualTool.

Destructor of cDriverServotogo.

## Member Function Documentation

int cDriverServotogo::open | ( |  | ) | `[virtual]`

Open connection to Sensoray626 board.

Open board.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericDevice.

int cDriverServotogo::close | ( |  | ) | `[virtual]`

Close connection to Sensoray626 board.

Sets all DACs to zero

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericDevice.

int cDriverServotogo::initialize | ( | const bool | a_resetEncoders = `false` | ) | `[virtual]`

Initialize Sensoray626 board.

Initializes board. In this implementation there's really nothing to do that hasn't been done in the opening phase.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericDevice.

int cDriverServotogo::command | ( | int | iCommand,
|  | void * | iData |
| ) |  |  | `[virtual]`

CHAI_CMD_SET_DAC_0: writes a voltage to DAC 0 a value between +10 and -10 volts, which is a double CHAI_CMD_SET_DAC_1: writes a voltage to DAC 1 a value between +10 and -10 volts, which is a double CHAI_CMD_SET_DAC_2: writes a voltage to DAC 2 a value between +10 and -10 volts, which is a double CHAI_CMD_SET_DAC_3: writes a voltage to DAC 3 a value between +10 and -10 volts, which is a double CHAI_CMD_SET_DAC_4: writes a voltage to DAC 4 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken CHAI_CMD_SET_DAC_5: writes a voltage to DAC 5 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken CHAI_CMD_SET_DAC_6: writes a voltage to DAC 6 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken CHAI_CMD_SET_DAC_7: writes a voltage to DAC 7 a value between +10 and -10 volts, which is a double. If this axis is not supported no action is taken

Reimplemented from cGenericDevice.

void cDriverServotogo::setDac | ( | int | a_num,
|  | double | a_volts |
| ) |  |  | `[private]`

METHODS Set value to dac

int cDriverServotogo::getEncoder | ( | int | a_num,
|  | long * | a_value |
| ) |  |  | `[private]`

Read encoder values. Returns the number of values read.

Read the value of encoder iNum. Returns -1 if the encoder doesn't exist, 1 if read was OK

Parameters:

  | a_num | number of encoder to be read
  | a_value | pointer to value read

unsigned short cDriverServotogo::brdtstOK | ( | unsigned short | a_baseAddress | ) | `[private]`

Checks if the board is present.

Checks if board is present and what is its model number

Parameters:

  | a_baseAddress | The address of the board in I/O space

void cDriverServotogo::stg_Init | ( | unsigned short | a_wAdd | ) | `[private]`

Initializes the board. This should be called by the constructor.

Initializes various aspects of the board

Parameters:

  | a_wAdd | Address of the board in I/O space.

void cDriverServotogo::encoderInit | ( |  | ) | `[private]`

Initializes the encoders.

Initializes the encoder chips of the board

void cDriverServotogo::encoderLatch | ( |  | ) | `[private]`

Latches the encoders.

Latches all encoders

unsigned short cDriverServotogo::findBaseAddress | ( |  | ) | `[private]`

Automatically finds the base address of the board.

Finds the base address for the board

void cDriverServotogo::encReadAll | ( | LONGBYTE * | a_lbEnc | ) | `[private]`

Latches and reads all the encoders of the board.

Latches and reads all encoders at once

Parameters:

  | a_lbEnc | array of the encoder values

void cDriverServotogo::rawDAC | ( | unsigned short | nAxis,
|  | long | lCounts |
| ) |  |  | `[private]`

Writes to DAC nAxis value lCounts

Parameters:

  | nAxis | value of DAC to which to write
  | lCounts | value to be written to the DAC

int cDriverServotogo::getBaseAddress | ( |  | ) | `[private]`

Returns the base address for the board.

Returns board base address.

## Member Data Documentation

long cDriverServotogo::m_homeposition[20]`[private]`

MEMBERS: Initial values of the encoder to reset them

The documentation for this class was generated from the following files:

- chai3d/src/devices/CDriverServotogo.h
- chai3d/src/devices/CDriverServotogo.cpp