-
Notifications
You must be signed in to change notification settings - Fork 0
DAQs
You can see example DAQ channel parameters (the only thing you should need to touch) in config/component_params and an overview of how channel names map to protocol files in Config Files.
In additional to adding and removing channels, the config file can also be used to change which channels are displayed when the DAQ is previewing. Set the Preview column to 1 to have it show, or 0 to have it ignored. If the channel is activated, data will be saved regardless of this value.
The naming protocol for these config files is computer-serial-number_daq-device-ID.csv
DAQ Channel Param files take the following fields and possible values.
- portNum (string or int) - the channel identifier. e.g. '1', pf0', 'port0/line7', 'port0/line20:21'
- ioType (string: 'input' / 'output' / 'bidirectional') - the channel type.
- signalType (string):
- input: 'Voltage'/ 'Current'/ 'Thermocouple'/ 'Accelerometer'/ 'RTD'/ 'Bridge'/ 'Microphone'/ 'IEPE'/ 'Digital'/ 'EdgeCount'/ 'Frequency'/ 'PulseWidth'/ 'Position'/ 'Audio'
- output: 'Voltage'/ 'Current'/ 'Digital'/ 'PulseGeneration'/ 'Audio'/ 'Sine'/ 'Square'/ 'Triangle'/ 'RampUp'/ 'RampDown'/ 'DC'/ 'Arbitrary'
- bidirectional
- TerminalConfig: (voltage channels only)
- Range: (voltage channels only)
- Device: Connected device, should map to device
ProtocolIDas explained in Config Files. - Label: Function of the specific channel. Used for saving & differentiating between channels connected to the same device.
IMPORTANT NOTE: due to the way MATLAB handles fields in some relevant data structures, Device and Lable values should never start with a number and should not contain any non-alphanumeric characters except '_'
You can find valid channel configurations through the device's documentation, or if you have the device's in-MATLAB ID you can run the following commands in the terminal:
daqs = daqlist;
info = daqs(strcmpi(daqs.DeviceID, deviceID),:).DeviceInfo;
Note that the port names on the device's documentation do not always exactly line up with the names listed on the physical hardware. You can go to the card's datasheet (e.g. NI PCIe-6323) to see the mapping. Note that the card will be mapped to a physical device. You can also use the NI MAX program to query more precise information about your DAQ.
The Whitmire lab scales the data output from their QST devices, so channels with QST as the associated device will have their data scaled. This can be changed in code by editing the DAQComponent.PlotData function, or can be circumvented by choosing different names for these devices.
Some NI DAQs don't support pre-loading digital data. The USB-6001, for example, does not. Some DAQs also only support pre-loading and clocked sampling on specific ports (e.g. the PCIe-6323 only supports clocked sampling on port0). When clocked sampling is unavailable, StimControl will attempt to run all I/O through a software timer. It's allegedly possible to set up an external clock for analog outputs, but that's not a focus for the current use case at the lab, so has not been implemented.
Note that software-triggering is astronomically slower and less precise than hardware-triggering. If your DAQ sessions are ending early, it's likely the DAQ's target rate is too high for MATLAB's timers to keep up, and the timeout is being hit. The rate should be set to as low as possible to still output the data you would like to acquire.
Queued DAQ outputs are saved with a time axis related to the DAQ's internal clock. Software-triggered DAQ outputs are timed using tic and toc within MATLAB, so timestamps will be less precise and, due to latency considerations, will not match up exactly with the theoretical time axis.
Information for DAQ parameters can be found here
- Vendor (string: "ni" / "adi" / "mcc" / "directsound" / "digilent") - the device vendor
- Rate
Information about DAQ channel configuration can be found here.
Calling DAQComponent.deviceInfo will give you access to additional information about the device, including valid channel parameters, which as far as I can tell aren't available directly through the session handle.
- Currently, DAQ-enforced PWM is not supported. I know it's possible using counter channels, but it's a lower priority than getting this thing working
Try restarting your computer. I've only run into this issue once and couldn't recreate it, but that worked for me.