DAQs and IO Channels

A dabs.resources.DAQ is a data acquisition board. When it is constructed it creates one dabs.resources.IO resource per physical channel, and those channel resources are what devices are configured with: a galvo does not hold a channel number, it holds a handle to an AO.

hRS  = dabs.resources.ResourceStore();
hDAQ = hRS.filterByName('vDAQ0');
hAO  = hRS.filterByName('/vDAQ0/AO0');

DAQ classes

Class

Hardware

dabs.resources.daqs.vDAQ

vDAQ. vDAQR0 and vDAQR1 are the revision-specific subclasses.

dabs.resources.daqs.NIDAQ

National Instruments DAQmx devices.

dabs.resources.daqs.NIRIO

National Instruments FPGA (RIO) devices.

dabs.resources.daqs.NIFlexRIOAdapterModule

FlexRIO adapter modules.

dabs.simulated.vDAQR1, dabs.simulated.NIFlexRIO

Simulated boards for a system with no hardware attached.

Common members

Member

Description

hAOs, hAIs, hDIOs, hDIs, hDOs, hPFIs, hCLKIs, hCLKOs, hDigitizerAIs, hAIs_Internal

The board’s channel resources, by kind.

hIOs

Dependent. All of the above as one cell array.

hDevice

The underlying vendor object.

simulated

True for a simulated board.

hDAQ.reset()

Reset the board.

hDAQ.getAllUsers()

Every registered user of the board and of its channels. The right call when you need to know what would be disturbed by reconfiguring a board.

dabs.resources.DAQ.scanSystem()

Rescan for vDAQ, NIRIO and NIDAQ hardware.

vDAQ specifics

Member

Description

hFpga

The scanimage.fpga.vDAQ_SI object. This is the low-level FPGA interface.

bitfileName

Bitfile loaded onto the FPGA.

passiveMode

Do not load the bitfile if another MATLAB instance already owns the FPGA.

hardwareRevision, firmwareVersion, productName, serial, fpgaSerial

Board identification.

PCIeCurrentLink, PCIeCurrentWidth, PCIeMaxLink, PCIeMaxWidth

PCIe link status. Useful when diagnosing bandwidth problems.

fpgaInitialized, externalUsers

FPGA state and other processes using the board.

hDAQ.initFPGA() / deinitFPGA()

Load and unload the FPGA.

hDAQ.showTestpanel()

Open the vDAQ test panel.

s = hDAQ.read_vDAQ_info()

Board information as a struct.

See also

vDAQ® API for creating analog and digital tasks on the vDAQ.


IO classes

All IO resources derive from dabs.resources.IO.

Property

Description

hDAQ

The board this channel belongs to.

deviceName

The board’s name.

channelID

Numeric index parsed from the channel name.

channelName

The channel name without the leading device path.

lastKnownValue

Last value written or read. NaN when unknown.

lastKnownValue fires the lastKnownValueChanged event when it changes, which is how widgets track a channel without polling it.

hIO.isOnSameDAQ(other) accepts another IO, a DAQ, a device name or an array of any of these, and reports whether they share a board. Several devices require their channels to be on the same board, and this is how they check.

Per-type API

Class

Members

ios.AO

setValue(val), setOffset(val), queryValue(), maybeQueryValue(), outputRange_V, maxSampleRate_Hz, slewRateLimit_V_per_s, supportsOutputReadback, supportsSlewRateLimit, supportsOffset.

ios.AI (AI_Generic)

samples = readValue(n), hTask = initTask(), termCfg, maxSampleRate_Hz.

ios.AI_Internal, ios.DigitizerAI

Internal analog inputs and the high-speed digitizer inputs.

ios.DO (D)

setValue(val), tristate(), queryValue(), supportsHardwareTiming.

ios.DI (D)

samples = readValue(n), queryValue().

ios.DIO

A bidirectional digital line.

ios.PFI

readValue(n), setValue(val), queryValue(), tristate().

ios.CLKI, ios.CLKO (CLK)

Clock input and output terminals.

hRS = dabs.resources.ResourceStore();

hAO = hRS.filterByName('/vDAQ0/AO0');
hAO.setValue(1.5);            % volts
v = hAO.queryValue();

hDO = hRS.filterByName('/vDAQ0/D0.0');
hDO.setValue(true);
hDO.tristate();

hAI = hRS.filterByName('/vDAQ0/AI0');
samples = hAI.readValue(100);

Warning

Writing directly to a channel that ScanImage has reserved fights with whatever is driving it. Check hIO.reserved and hIO.userInfo first, and prefer doing this while ScanImage is idle.