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

7 visualizaciones (últimos 30 días)
Rick
Rick el 13 de Mzo. de 2014
Respondida: MoeIsKing el 14 de Nov. de 2018
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);

Respuestas (3)

Rick
Rick el 13 de Mzo. de 2014
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 el 3 de Jul. de 2014
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 el 14 de Nov. de 2018
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?

Community Treasure Hunt

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

Start Hunting!

Translated by