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.


Set/Get Range

The MTM-DAQ-2 has sixteen (16) analog inputs (ADC) and two (2) analog outputs (DAC) all controlled by the analog entity. Each analog is controllable via software and is independently current-limited for both source and sink currents. The analog inputs are connected to a 16-bit ADC, and return a voltage value in microvolts. The full ranges are in the table below.

Analog

Input

Input

Input

Input

Input

Output

Output

Output

0-13

(+/-) 10.24V

(+/-) 5.12V

(+/-) 2.56V

(+/-) 1.28V

(+/-) 0.64V

14-15

(+/-) 1.28V

(+/-) 0.64V

16-17

(+/-) 10.24V

(+/-) 4.096V

(+/-) 2.048V

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

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

Get/Set Enable [16, 17]

These outputs default to having their outputs disabled, so setEnable(1) must be called before their voltage will be present on their respective pins.

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

stem.analog[index].setEnable(mode) [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[16, 17]:

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]