Analog

API Documentation: [cpp] [python] [.NET] [LabVIEW]

BrainStem modules may have the ability to read an analog voltage (ADC) and convert this into a discrete digitized value or output a voltage value based on a desired discrete value (DAC). Analog voltage capabilities will be dictated by the module hardware being used. Module specifics that include the quantity of analog entities and details for their capacities will be described in that module’s datasheet.


Initiate Bulk Capture

The system can capture any number of samples up the size of the RAM_STORE slot 0 (8191). The capture is then triggered with

stem.analog[index].initiateBulkCapture() [cpp] [python] [NET] [LabVIEW]

Results of the capture are stored in the RAM_STORE slot 0. Results are always stored in ADC counts as two little-endian byte pairs with the second byte the most significant. Computing a sample value from the Store read out is:

Get/Set Bulk Capture Sample Rate and Number of Samples

The MTM-EtherStem’s ADC’s are also capable of being captured in bulk based on a user defined sample rate. For additional information on sample rate settings. Configuring and triggering the bulk capture is accomplished by setting the number of samples and the sample rate, then triggering the capture.

To set the number of samples and the sample rate

stem.analog[index].setBulkCaptureSampleRate() [cpp] [python] [NET] [LabVIEW]

stem.analog[index].getBulkCaptureSampleRate() [cpp] [python] [NET] [LabVIEW]

stem.analog[index].setBulkCaptureNumberOfSamples() [cpp] [python] [NET] [LabVIEW]

stem.analog[index].getBulkCaptureNumberOfSamples() [cpp] [python] [NET] [LabVIEW]

Get Bulk Capture State

stem.analog[index].getBulkCaptureState() [cpp] [python] [NET] [LabVIEW]

Get Voltage/Value

A BrainStem’s A2D reading will always return a 16 bit value. If the module hardware does not have full 16 bit wide analog to digital conversion capabilities, the measurement will get propagated up to 16 bits wide.

For example, if a 12-bit A2D engine exists in the target module’s hardware, the reading will get promoted in the firmware layer by shifting up 4 bits to fill out the 16 bit value (0x0FFF =: 0x0FFF << 4 = 0xFFF0) in the module’s firmware. This approach allows more portable API code to be generated independent of the target hardware.

setValue and setVoltage is only applicapble for Analog[3]:

stem.analog[index].setValue() [cpp] [python] [NET] [LabVIEW]

stem.analog[index].getValue() [cpp] [python] [NET] [LabVIEW]

stem.analog[index].setVoltage(microvolts) [cpp] [python] [NET] [LabVIEW]

stem.analog[index].getVoltage() [cpp] [python] [NET] [LabVIEW]