LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx simultaneous counter input and ouput using NI-9401 module

Solved!
Go to solution

Hello,

 

I am currently trying to read two encoders simultaneously (I have achieved this successfully).

 

Now, I would like to send a digital output signal with a specified frequency (roughly 20-100 Hz) and duty cycle from the same module simultaneously.

 

I am using the NI-9401 Digital input module to do this, with the inputs on the 0,1,2,3 PFI Channels and the output on the 5th PFI channel. I have tested the output independently in MAX and it performs as desired.

 

I am currently using the internal clock to control the input acquisition rate, so I have used all the counters on the CRio with this output counter. 

 

I am not currently able to get the counter output task to start, I have attached my VI.

 

Control of the timing between the input and output is not critical to my application.

 

(Using LabVIEW 24 (64bit) CRio 9055 with a NI-9401 Digital input module)

Note: I also have an NI-9403 module that I am using in this VI, the counter output seems to be the easiest way to implement this - but I can readily use this module to send the output signal

0 Kudos
Message 1 of 4
(198 Views)
Solution
Accepted by topic author R.jon8s

Any error?  What one and where do you first see it?

 

By appearance, you're configured to generate just one pulse whose timing parameters aren't defined by you.  Thus you'll get the default of 1 Hz, 0.5 duty cycle.  In the loop you're trying to write different timing parameters to the task, but that will probably produce an error because the task is still in the midst of generating the 1 second pulse.

 

The first thing you should do is define your freq & duty cycle in your call to DAQmx Create Virtual Channel.  Another thing you need to do is add a call to DAQmx Timing to specify "Implicit" timing and Continuous sampling.  See if that clears some things up.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 2 of 4
(146 Views)

Hi Kevin,

 

Thanks for your response.

 

I was struggling to articulate my issue as I had tried to implement the CO in a fair few ways, with varying issues so struggled to explain the exact issue.

 

I have attempted to produce a more simple VI initially to test, which I have attached. I have implemented the implicit timing and specified the frequency and duty cycle, but I can't seem to work out whether I need to specify this in the DAQmx write function.

 

This VI gives an error after the DAQmx start task VI. Error code 89121

 

I would essentially like to replicate the pulse train generation behaviour from NI-MAX, like in the screenshot.

Download All
0 Kudos
Message 3 of 4
(134 Views)
Solution
Accepted by topic author R.jon8s

I have since found that I had not been sufficiently careful when specifying the CO.pulse terminal and was missing a backslash!

 

This has resolved the issue in the simple VI.

 

I have subsequently updated my main VI to incorporate Kevin's suggestion, I have attached this in case it helps anyone else

0 Kudos
Message 4 of 4
(114 Views)