Analog Entity

group AnalogEntity

Interface to analog entities on BrainStem modules. Analog entities may be configured as a input or output depending on hardware capabilities. Some modules are capable of providing actual voltage readings, while other simply return the raw analog-to-digital converter (ADC) output value. The resolution of the voltage or number of useful bits is also

void analog_getValue(unsigned int *id, struct Result *result, int analogNum)

Get the raw ADC output value in bits.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current 16 bit analog value or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setValue(unsigned int *id, struct Result *result, int analogNum, int value)

Set the value of an analog output (DAC) in bits.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • value: Set a 16 bit analog set point with 0 corresponding to the negative analog voltage reference and 0xFFFF corresponding to the positive analog voltage reference.

void analog_getVoltage(unsigned int *id, struct Result *result, int analogNum)

Get the scaled micro volt value with reference to ground.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the requested voltage in microvolts or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setVoltage(unsigned int *id, struct Result *result, int analogNum, int microvolts)

Set the voltage level of an analog output (DAC) in microVolts.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • microvolts: The voltage to be set in microvolts.

void analog_getConfiguration(unsigned int *id, struct Result *result, int analogNum)

Get the analog configuration.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current configuration of the analog entity or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setConfiguration(unsigned int *id, struct Result *result, int analogNum, int configuration)

Set the analog configuration.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current configuration of the analog entity or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • configuration: Configuration to be set (input/output).

void analog_getBulkCaptureSampleRate(unsigned int *id, struct Result *result, int analogNum)

Get the current sample rate setting for this analog when bulk capturing.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and samples per second (in Hertz) or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setBulkCaptureSampleRate(unsigned int *id, struct Result *result, int analogNum, int sampleRate)

Set the sample rate for this analog when bulk capturing.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current configuration of the analog entity or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • sampleRate: Samples per second to be set (in Hertz). Minimum rate: 7,000 Hz Maximum rate: 200,000 Hz

void analog_getBulkCaptureNumberOfSamples(unsigned int *id, struct Result *result, int analogNum)

Get the current number of samples setting for this analog when bulk capturing.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the number of samples to be taken or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setBulkCaptureNumberOfSamples(unsigned int *id, struct Result *result, int analogNum, int numSamples)

Set the number of samples to capture for this analog when bulk capturing.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • numSamples: Number of samples to be taken during a bulk capture. Minimum # of Samples: 0 Maximum # of Samples: (BRAINSTEM_RAM_SLOT_SIZE / 2) = (3FFF / 2) = 1FFF = 8191

void analog_initiateBulkCapture(unsigned int *id, struct Result *result, int analogNum)

Initiate a BulkCapture on this analog. Captured measurements are stored in the module’s RAM store (RAM_STORE) slot 0. Data is stored in a contiguous byte array with each sample stored in two consecutive bytes, LSB first.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the number of samples to be taken or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_getBulkCaptureState(unsigned int *id, struct Result *result, int analogNum)

Get the current bulk capture state for this analog.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current bulk capture state for a given analog entity or a non zero Error code.

    • Idle: bulkCaptureIdle = 0

    • Pending: bulkCapturePending = 1

    • Finished: bulkCaptureFinished = 2

    • Error: bulkCaptureError = 3

  • analogNum: Index of the Analog Entity.

void analog_getRange(unsigned int *id, struct Result *result, int analogNum)

Get the analog input range.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and a 8 bit value corresponding to a discrete range option or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setRange(unsigned int *id, struct Result *result, int analogNum, int range)

Set the range of the analog entity.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • range: An 8 bit value corresponding to a discrete range option.

void analog_getEnable(unsigned int *id, struct Result *result, int analogNum)

Get the analog output enable status.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and enable status or a non zero Error code.

  • analogNum: Index of the Analog Entity.

void analog_setEnable(unsigned int *id, struct Result *result, int analogNum, int enable)

Set the range of the analog entity.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • analogNum: Index of the Analog Entity.

  • enable: 1 = Enable, 0 = Disable