Acquire Bridge Measurements
This example shows how to acquire and plot data from an NI USB-9219
device. The device ID is cDAQ1Mod7.
Create a DataAcquisition object assigned to the variable
d:
d = daq("ni");Add an analog input channel for Bridge measurement type,
assigned to the variable ch:
ch = addinput(d,"cDAQ1Mod7","ai1","Bridge");
You might see this warning:
Warning: The Rate property was reduced to 2 due to the default ADCTimingMode of this device, which is 'HighResolution'. To increase rate, change ADCTimingMode on this channel to 'HighSpeed'.
To allow a higher acquisition rate, change the channel
ADCTimingMode to 'HighSpeed':
ch.ADCTimingMode = "HighSpeed"You might see this warning:
Warning: This property must be the same for all channels on this device. All channels associated with this device were updated.
Change the acquisition rate to 10 scans per second.
d.Rate = 10;
Set the channel BridgeMode to 'Full', which
uses all four resistors in the device to acquire the voltage values:
ch.BridgeMode = "Full"ch =
Data acquisition analog input channel 'ai1' on device 'cDAQ1Mod7':
BridgeMode: Full
ExcitationSource: Internal
ExcitationVoltage: 2.5
NominalBridgeResistance: 'Unknown'
Range: -0.063 to +0.063 VoltsPerVolt
Name: empty
ID: 'ai1'
Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Bridge'
ADCTimingMode: HighSpeedSet the resistance of the bridge device to 350 ohms:
ch.NominalBridgeResistance = 350
ch =
Data acquisition analog input channel 'ai1' on device 'cDAQ1Mod7':
BridgeMode: Full
ExcitationSource: Internal
ExcitationVoltage: 2.5
NominalBridgeResistance: 350
Range: -0.063 to +0.063 VoltsPerVolt
Name: empty
ID: 'ai1'
Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Bridge'
ADCTimingMode: HighSpeed
Save the acquired data to a variable and start the acquisition:
data = read(d,seconds(1),OutputFormat="Matrix")Plot the acquired data:
plot(data)