How to set Excitation Voltage in a NI Compact DAQ bridge module

12 次查看(过去 30 天)
I can't set the ExcitationVoltage property without getting an error. I have an NI cDAQ-9178 chassis with a 9237 strain bridge module.
Script:
s = daq.createSession('ni');
%cDAQ1Mod3 is a NI 9237 strain bridge module in a cDAQ-9178 chassis
s.addAnalogInputChannel('cDAQ1Mod3',[0 1 2 3],'Bridge');
%handle to the channels in the object
ch = s.Channels
current_excitationvoltage = get(ch,'ExcitationVoltage')
%returns a 4x1 cell array of the excitation voltage values for the 4
%channels
%DAQmx is looking for a double...create it
new_exc = double(10.0);
%now put it in a 4x1 cell array
new_excitationvoltage = {new_exc new_exc new_exc new_exc}'
%now try to set it in the channels object
set(ch,'ExcitationVoltage',new_excitationvoltage);
Output:
ch =
Number of channels: 4
index Type Device Channel MeasurementType Range Name
----- ---- --------- ------- ---------------- ----------------------------- ----
1 ai cDAQ1Mod3 ai0 Bridge (Unknown) -0.025 to +0.025 VoltsPerVolt
2 ai cDAQ1Mod3 ai1 Bridge (Unknown) -0.025 to +0.025 VoltsPerVolt
3 ai cDAQ1Mod3 ai2 Bridge (Unknown) -0.025 to +0.025 VoltsPerVolt
4 ai cDAQ1Mod3 ai3 Bridge (Unknown) -0.025 to +0.025 VoltsPerVolt
current_excitationvoltage =
[2.5000]
[2.5000]
[2.5000]
[2.5000]
new_excitationvoltage =
[10]
[10]
[10]
[10]
Error using internal.SetGetRenderer/set (line 47)
ExcitationVoltage must be a positive, non-zero scalar double.
Error in cdaq_test_bridge (line 20)
set(ch,'ExcitationVoltage',new_excitationvoltage);

回答(3 个)

Rick
Rick 2014-3-13
Just tried it...unfortunately, that didn't work. Same error. I had put it in a cell array just because that was how the values were returned when I queried the property. In any case, putting it in a normal vector seems to generate the same error.
Any more ideas? Thanks

Marco
Marco 2014-7-3
I don't know if this helps, but I had a similar problem. Since I'm using 2 channels, I just configured one first, then added the second channel and the FIRST thing I changed was the excitation voltage to match the first one, and ... it worked !
See the code below:
devices = daq.getDevices;
DAQ = devices(1);
ID = get(DAQ,'ID')
s = daq.createSession('ni');
s.Rate = 25000;
Chan1 = s.addAnalogInputChannel(ID, 0, 'Bridge');
set(Chan1,'BridgeMode','Full');
set(Chan1,'NominalBridgeResistance',1000);
set(Chan1,'ExcitationVoltage',10.0);
Chan2 = s.addAnalogInputChannel(ID, 1, 'Bridge');
set(Chan2,'ExcitationVoltage',10.0);
set(Chan2,'BridgeMode','Full');
set(Chan2,'NominalBridgeResistance',1000);

MoeIsKing
MoeIsKing 2018-11-14
Does anyone knwo how to set the channel to zero?
Or how do you "scale" the channel later, as you don't know what signal voltage is which force/weight/reference?

类别

Help CenterFile Exchange 中查找有关 Simultaneous and Synchronized Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by