This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 session object and save it to the variable s:

s = daq.createSession('ni');

Add an analog input channel with the 'Bridge' measurement type and save it to the variable ch:

ch = addAnalogInputChannel(s,'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.

s.Rate = 10
s = 

Data acquisition session using National Instruments hardware:
   Will run for 1 second (10 scans) at 10 scans/second.
   Number of channels: 1
      index Type  Device   Channel MeasurementType              Range             Name
      ----- ---- --------- ------- ---------------- ----------------------------- ----
      1     ai   cDAQ1Mod7 ai1     Bridge (Unknown) -0.025 to +0.025 VoltsPerVolt

Set 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: HighSpeed

Set 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 = startForeground(s);

Plot the acquired data:

plot(data)

Related Topics