Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6602 response time

Solved!
Go to solution

Dear forum users,

 

I am using a NI PCI-6602 Counter/Timer to send TTL signals to another device in our lab. I have to send the signal every ~ 1 - 5 ms, but this time is not fixed (it depends on some other processes I am doing in my LabVIEW program), so I cannot use a continuous waveform.

 

Therefore, I have written a short test program to get familiar with the PCI-6602 (see attachment).

 

If I send one pulse, it seems that I can do this only about all 14 ms (at least this is the time difference calculated with tick counts which is not very precise; but counting the pulses with a counter gives almost the same time). So it seems that the PCI-6602 has a too long response time for my application!

 

Can somebody tell me if he makes the same observation? Or am I using the wrong vi/treating the PCI-6602 in the wrong way? If yes, what do I have to do to make my little test program and finally my main program faster?

 

I would appreciate every help and comment!

0 Kudos
Message 1 of 10
(7,224 Views)

partial81,

 

There are a few things I'd like to point out with your VI.  First, as a general programming rule you should be connecting the error wires and handling errors in your VI.  In addition to error handling, these wires also are useful as they can eliminate heavy use of the sequence structure. Second, if you need to generate a single pulse, I don't think that you need to configure timing for your counter task.  By by default counter tasks without timing should produce a single pulse.  Third, if you are using Wait time to prevent DAQmx from stopping too soon there is equivalent functionality build into the DAQmx API with the DAQmx Wait Until Done.vi.  Lastly, in your case it probably makes sense to use DAQmx Control Task to commit your task before you begin your while loop (for reasons mentioned in my response here).  I've attached a revised example of your VI which hopefully will behave more to your liking (I do not have a 6602 at my disposal at the moment, so I cannot test the performance of my modified VI).

 

Hope that helps,

Dan

0 Kudos
Message 2 of 10
(7,190 Views)

Dear Dan,

 

Thanks a lot for reading my mail and your detailed reply here!

 

I can understand perfectly all four items you mentioned and I will follow them in future (normally I am always connecting the error wires…).

 

I have tested your revised VI, but unfortunately I have to tell you that it does not work better: The time for one iteration of the while loop is still about 14 ms.

 

Now I am helpless, I really hoped that the correct use of the DAQmx Control Task.vi would help in my case.

The odd and annoying thing is, that I have an old PC with the old PC-TIO-10 Counter/Timer module, where a similar VI just takes 1 – 2 ms for execution. I would have expected a newer PC and the PCI-6602 to be faster…

Well, I still hope that you or somebody else can find a way so that your/mine VI executes faster.

 

Anyway, thanks again!

0 Kudos
Message 3 of 10
(7,186 Views)

partial81,

 

I ran the VI on an M Series device and an X Series device.  M Series showed a loop time of 2 ms, and X Series was 1 ms.  I'm not sure why the 6602 is behaving differently, and I don't have on to test with at the moment.  I think we should probably try to figure out which operation is taking the most time.  Run the attached VI, and let's see if any one operation is taking longer than we'd expect.

 

Dan

0 Kudos
Message 4 of 10
(7,181 Views)

partial81,

 

I did find a PCI-6602.  Running my example VI, the 6602 consistently took 2 or 3 ms per loop iteration (with pretty much all of that time being spent in Wait Until Done).

 

Dan

0 Kudos
Message 5 of 10
(7,178 Views)

Dear Dan,

 

Thanks a lot for your replies and efforts. It is great to hear that you have found a PCI-6602 and could test the vi too. But it is really frustrating to read that it works fast enough with your PC but not with my one.

 

With your ExampleResponseTime_withTimes.vi it takes about 13 ms for the start time and about 3 ms for the WaitForDoneTime (see attached screenshot). Interestingly your PC takes most time in the WaitForDoneTime (with 2 – 3 ms a similar time to my PC), but my PC takes additionally 13 ms for the start time.

 

I have to admit that the PC I am using is not the newest (just an industrial PC with Intel Pentium 4 3 GHz, 3.62 GB RAM, Windows 7 32 bit, LabVIEW 2011 and NIDAQ940f5) but this is much better than the old PC with the old PC-TIO-10. But as said, on the old PC a similar vi for pulse generation takes only about 1 - 2 ms. So, I am not sure if my computer configuration causes the long start time and I have no idea how I could test this.

 

At the moment I am asking myself if there is a way to run the PCI-6602 with the traditional DAQ, perhaps then it will work as fast as the PC-TIO-10 on the old computer (where it was also used with the traditional DAQ). But I am not sure if this is a good approach and I do not know if this is possible.

What do you think? Or do you have some other ideas? I hope so ;-)!

0 Kudos
Message 6 of 10
(7,169 Views)
Solution
Accepted by topic author partial81

partial81,

 

I have one other idea for you to try.  Since starting the 6602 is the operation which takes the longest I've written an example which uses a start trigger to generate the pulse, and sets up the counter to be retriggered.  Essentially every time you issue a start trigger, the counter will generate a pulse.  I then use a digital line on the 6602 to generate this start trigger (I use PFI0 and Port0/line0 which is actually the same line in hardware).  For retriggered generation, Wait Until Done is not useful, so I have replaced this with a 1 ms wait.

 

Can you try this and see if it performs better for you?

Dan

Message 7 of 10
(7,161 Views)
WOW! You are a genius! That works perfectly! Just 2 ms for each iteration! Very nice solution, really!! Tomorrow I am going to try to adapt your VI to my main VI, and then I will see if it works there too. Since it works so nicely, I think I can be optimistic! Thanks again!
0 Kudos
Message 8 of 10
(7,155 Views)

Dear Dan,

 

I was able to adapt your VI to my main VI and it works there perfectly too (even with 0ms wait)!

Thanks again for this smart and fast solution! All I have to do now is to understand how your program works 😉

 

Have a Merry Christmas and a Happy New Year!

0 Kudos
Message 9 of 10
(7,141 Views)

partial81,

 

Great!! I'm glad to hear that you got everything working!  If you need clarification on anything in my example VI, please let me know.

 

Merry Christmas and Happy New Year to you too!

Dan

 

 

0 Kudos
Message 10 of 10
(7,135 Views)