Error when adding a analogue channel from a cDAQ module
Closed this issue · 13 comments
I'm having trouble adding analogue channels of a NI module. I have one device (Dev1) and one chassis (Dev2) with a module (Dev2Mod1)., connected. Output from getproperties:
julia> getproperties()["DevNames"][1]
3-element Array{SubString{String},1}:
"Dev1"
"Dev2"
"Dev2Mod1"
Here are the outputs from analog_input_channels for each element:
julia> analog_input_channels("Dev1")
8-element Array{String,1}:
"Dev1/ai0"
"Dev1/ai1"
"Dev1/ai2"
"Dev1/ai3"
"Dev1/ai4"
"Dev1/ai5"
"Dev1/ai6"
"Dev1/ai7"
julia> analog_input_channels("Dev2")
1-element Array{String,1}:
""
julia> analog_input_channels("Dev2Mod1")
4-element Array{String,1}:
"Dev2Mod1/ai0"
"Dev2Mod1/ai1"
"Dev2Mod1/ai2"
"Dev2Mod1/ai3"
Trying to add channel 1 from Dev1 is successful:
julia> t = analog_input("Dev1/ai0")
NIDAQ.AITask(Ptr{Void} @0x000000000370a8a0)
But trying to add channel 1 for Dev2Mod1 is unsuccessful.
julia> t2 = analog_input("Dev2Mod1/ai0")
ERROR: NIDAQmx: Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.
Stacktrace:
[1] #catch_error#1(::Base.#error, ::Function, ::Int32, ::String) at C:\Users\lars\.julia\v0.6\NIDAQ\src\NIDAQ.jl:96
[2] catch_error(::Int32) at C:\Users\lars\.julia\v0.6\NIDAQ\src\NIDAQ.jl:89
[3] #analog_input#3(::String, ::Void, ::Function, ::NIDAQ.AITask, ::String) at C:\Users\lars\.julia\v0.6\NIDAQ\src\analog.jl:25
[4] (::NIDAQ.#kw##analog_input)(::Array{Any,1}, ::NIDAQ.#analog_input, ::NIDAQ.AITask, ::String) at .\<missing>:0
[5] #analog_input#2 at C:\Users\lars\.julia\v0.6\NIDAQ\src\analog.jl:15 [inlined]
[6] analog_input(::String) at C:\Users\lars\.julia\v0.6\NIDAQ\src\analog.jl:14
I suspect no device/driver issues as there is no issue when using Matlab and its DAQ interface.
How should one add such a channel?
i think NI-DAQmx limits you to only one task of any type at a given time. try this:
t = analog_input("Dev1/ai0")
analog_input(t, "Dev2Mod1/ai0")
Unfortunately that does not help. Both your suggestion, and just creating one task (t = analog_input("Dev2Mod1/ai0")), fails, with the same error.
following the relevant code, i wonder what analog_input_ranges("Dev2Mod1")
returns.
following the relevant code, i wonder what analog_input_ranges("Dev2Mod1") returns.
1x2 Array{Float64,2}:
-5.0 5.0
I tested with another module (here called Dev2Mod2", which have selectable gains. And the task can be created without any error.
julia> analog_input_ranges("Dev2Mod2")
4x2 Array{Float64,2}:
-0.2 0.2
-1.0 1.0
-5.0 5.0
-10.0 10.0
But yet another module which only have one range, also didn't fail.
Dev2Mod1 = 9234 (does not work), single range
Dev2Mod2 = 9205 (works), multiple ranges
Dev2Mod3 = 9215 (works), single range
Could it be a issue with the selectable AC/DC coupling?
the terminal configuration defaults to differential. do these three devices all support that?
No, NI 9234 uses 'PseudoDifferential', but also have four measurement types:
Voltage, Accelerometer, Microphone and IEPE (all are voltages though)
And three coupling options:
AC, DC and IEPE
I've tried "referenced single-ended", "non-referenced single-ended" and "differential" with no discernible difference in error output.
ahah, can you try modifying the code to include pseudo-diff?
Yes, now it works! Thanks :)
glad i could help. could you please submit a PR so we can share the solution with others?
Ok