Analog Entity¶
- group AnalogEntity
AnalogClass: 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 hardware dependent.
-
void analog_getValue(unsigned int *id, struct Result *result, const int index)¶
Get the raw ADC output value in bits.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_getVoltage(unsigned int *id, struct Result *result, const int index)¶
Get the scaled micro volt value with reference to ground.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_getRange(unsigned int *id, struct Result *result, const int index)¶
Get the analog input range.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_getEnable(unsigned int *id, struct Result *result, const int index)¶
Get the analog output enable status.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_setValue(unsigned int *id, struct Result *result, const int index, const int value)¶
Set the value of an analog output (DAC) in bits.
Note
Not all modules are provide 16 useful bits; the least significant bits are discarded. E.g. for a 10 bit DAC, 0xFFC0 to 0x0040 is the useful range. Refer to the module’s datasheet to determine analog bit depth and reference voltage.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
value – 16 bit analog set point with 0 corresponding to the negative analog voltage reference and 0xFFFF corresponding to the positive analog voltage reference.
- Returns:
Returns common entity return values
-
void analog_setVoltage(unsigned int *id, struct Result *result, const int index, const int microvolts)¶
Set the voltage level of an analog output (DAC) in microvolts.
Note
Voltage range is dependent on the specific DAC channel range.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
microvolts – 32 bit signed integer (in microvolts) based on the board’s ground and reference voltages.
- Returns:
Returns common entity return values
-
void analog_setRange(unsigned int *id, struct Result *result, const int index, const unsigned char range)¶
Set the analog input range.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
range – 8 bit value corresponding to a discrete range option
- Returns:
Returns common entity return values
-
void analog_setEnable(unsigned int *id, struct Result *result, const int index, const unsigned char enable)¶
Set the analog output enable state.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
enable – set 1 to enable or 0 to disable.
- Returns:
Returns common entity return values
-
void analog_setConfiguration(unsigned int *id, struct Result *result, const int index, const unsigned char configuration)¶
Set the analog configuration.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
configuration – - bitAnalogConfigurationOutput configures the analog entity as an output.
- Return values:
aErrConfiguration – - Entity does not support this configuration.
- Returns:
EntityReturnValues “common entity” return values
-
void analog_getConfiguration(unsigned int *id, struct Result *result, const int index)¶
Get the analog configuration.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_setBulkCaptureSampleRate(unsigned int *id, struct Result *result, const int index, const unsigned int value)¶
Set the sample rate for this analog when bulk capturing.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
value – sample rate in samples per second (Hertz). Minimum rate: 7,000 Hz Maximum rate: 200,000 Hz
- Returns:
Returns common entity return values
-
void analog_getBulkCaptureSampleRate(unsigned int *id, struct Result *result, const int index)¶
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 aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_setBulkCaptureNumberOfSamples(unsigned int *id, struct Result *result, const int index, const unsigned int value)¶
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 aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
value – number of samples. Minimum # of Samples: 0 Maximum # of Samples: (BRAINSTEM_RAM_SLOT_SIZE / 2) = (3FFF / 2) = 1FFF = 8191
- Returns:
Returns common entity return values
-
void analog_getBulkCaptureNumberOfSamples(unsigned int *id, struct Result *result, const int index)¶
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 aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values
-
void analog_initiateBulkCapture(unsigned int *id, struct Result *result, const int index)¶
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 aErrNone on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values. When the bulk capture is complete getBulkCaptureState() will return either bulkCaptureFinished or bulkCaptureError.
-
void analog_getBulkCaptureState(unsigned int *id, struct Result *result, const int index)¶
Get the current bulk capture state for this analog.
- Parameters:
id – The id assigned by the create stem vi.
result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.
index – The index of the entity in question.
- Returns:
Returns common entity return values