I am using a cDAQ-9174 chassis with a 9474 and 9411 modules. I don't believe it matters but they are the old NI cRIO-XXXX modules that came with a test setup that was distributed to early adopters. I am using DAQmx tasks in an application (C libraries) to read a quadrature encoder (angular position) and to drive a motor directly with PWM current (pulse output). To satisfy various other requirements, my setup of the tasks is as follows:
[DAQmx] MajorVersion = 9
MinorVersion = 2
[DAQmxChannel GenV 9411 Rotary Encoder Input/AngularPosition]
CI.AngEncoder.PulsesPerRev = 500
CI.AngEncoder.InitialAngle = 0
CI.Encoder.ZIndexVal = 0
CI.Encoder.ZIndexPhase = A High B Low
CI.Encoder.ZIndexEnable = 0
ChanType = Counter Input
CI.MeasType = Position:Angular Encoder
CI.AngEncoder.Units = Ticks
PhysicalChanName = cDAQ1Mod2/ctr2
CI.Encoder.DecodingType = X4
[DAQmxChannel GenV 9474 PWM Output/PulseOutput]
CO.Pulse.IdleState = Low
ChanType = Counter Output
CO.OutputType = Pulse:Time
CO.Pulse.HighTime = 5.0000000000000004E-006
CO.Pulse.LowTime = 5.0000000000000002E-005
CO.Pulse.Time.InitialDelay = 0
CO.Pulse.Time.Units = Seconds
PhysicalChanName = cDAQ1Mod1/ctr3
[DAQmxTask GenV 9411 Rotary Encoder Input]
Channels = GenV 9411 Rotary Encoder Input/AngularPosition
SampQuant.SampMode = Continuous Samples
SampClk.ActiveEdge = Rising
SampQuant.SampPerChan = 100000
SampClk.Rate = 100000
SampTimingType = Sample Clock
SampClk.src=/cDAQ1/100kHzTimebase
[DAQmxTask GenV 9474 PWM Output]
Channels = GenV 9474 PWM Output/PulseOutput
SampQuant.SampMode = Continuous Samples
SampQuant.SampPerChan = 100000
SampTimingType = Implicit
RegenMode = Allow Regeneration
[DAQmxCDAQChassis cDAQ1
] ProductType = cDAQ-9174
DevSerialNum = 0x18B3EC0
[DAQmxCDAQModule cDAQ1Mod1]
ProductType = NI 9474
DevSerialNum = 0xDEDF40
CompactDAQ.ChassisDevName = cDAQ1
CompactDAQ.SlotNum = 1
[DAQmxCDAQModule cDAQ1Mod2]
ProductType = NI 9411
DevSerialNum = 0xDEDB24
CompactDAQ.ChassisDevName = cDAQ1
CompactDAQ.SlotNum = 2
Each task works fine on its own (i.e., without the other). The problem is that if I start the encoder task first and then the PWM task, the latter causes an error:
Error -89137 occurred at DAQ Assistant
Possible Reason(s):
Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
Source Device: cDAQ1
Source Terminal:
80MHzTimebase
Destination Device: cDAQ1
Destination
Terminal: Ctr3Source
Required Resources in Use bySource
Device: cDAQ1
Source Terminal: 100kHzTimebase
Destination
Device: cDAQ1
Destination Terminal: Ctr2SampleClock
Task Name: _unnamedTask<61>
I don't know why that is but if I start the PWM task first and then the encoder task, it also works. I should also mention that initally I was using counter 0 for the encoder, which caused a redirection of 100kHzTimebase to Ctr0SampleClock, which, according to the 9411 device routes, is not supported; yet it worked (by itself). I wonder if what is actually happening under the hood is not quite what is being shown.
What exactly is the conflict and what can I do to avoid it? The reasons for needing to use the specific modes and parameters chosen (e.g., the "continuous samples" with the 100kHzTimebase clock) are rooted in various performance and optimization requirements that have been established in a previous version of our software, so I'd prefer not taking a completely different route, if some small changes would lead us to correcting the problem.
I appreciate your assistance.
Kamen