Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

6602 Multiple Counter Output

Hi
I would like to output a counter signal on all eight of my outputs on the PCI6602.  These outputs have to be able to be stopped individually.  How do I do this in labview 8.
Message 1 of 10
(5,598 Views)
Hi Chris,

There is a great shipping example that comes with DAQmx named "Gen Dig Pulse Train-Continuous.vi" which will do what you are looking for on a single counter.  To get to this, go to the NI Example Finder and browse to Hardware Input and Output>>DAQmx>>Generating Digital Pulses.

To expand this to all 8 counters on your 6602 there are 2 options:
  1. The easiest way is to copy the code 7 times, to have a total of 8 seperate counter tasks, with 8 parallel while loops that all poll for a stop condition.  Although not the prettiest, this should be very easy to create starting from the example mentioned above.
  2. A sleeker way to accomplish this is to reuse the same DAQmx code inside of auto-indexed for loops.  Attached is a modified version of the original example that should work for all 8 counters, and give you individual control of all of them.
Hopefully this helps you get up and running!

Have a great day!
Travis W
0 Kudos
Message 2 of 10
(5,585 Views)

Cool,

I am the same person just didn't log in the first time.  How could I count the individual TTL pulses on each of the eight outputs programatically?

Message Edited by Quiksilver on 11-07-2006 10:47 AM

0 Kudos
Message 3 of 10
(5,556 Views)
Hi,

A simple way to do this would be to measure the time since the DAQmx Start Task has been called.  From there, you can use the equation Frequency * Time = # of Ticks.

To get the time since the start task was called, simply call the "Get Date/Time in Seconds.vi" at both the time of the start task, and at the time you wish to know the number of ticks, and then subtract the two.  Below is what this would look like for a single task.



Have a great day!
Travis W

Message Edited by Travis W on 11-08-2006 10:14 AM

0 Kudos
Message 4 of 10
(5,540 Views)

Also Is there any way I can restart an individual counter after i have stopped it without stopping all the counters?

 

0 Kudos
Message 5 of 10
(5,538 Views)
Hi,

Absolutely, just call the "DAQmx Start Task.vi" again after it has been stopped.  To do this, you could modify the code attached above and add another case structure inside the main while loop that is very similar to the existing case structure.  Instead of selectively stopping a task, you would want to selectively start a task, so just replace the "DAQmx Stop Task.vi" with the "DAQmx Start Task.vi", create a new boolean control for this case structure, and you should be good to go.

Have a great day!
Travis W
0 Kudos
Message 6 of 10
(5,518 Views)

Hi it is me again

I think I have the code somewhat complete now However, I am having trouble stopping and restarting my task.  When I start my program it does exactly what it is supposed to do and when I stop it the first time it does to but after that it doesnt.  If I try to restart after I stop an individual pulse train (not  the overall stop) my program outputs but my counter doesnt show how many counts have been output and also after I have stopped the second time the counter will not restart at all.  Attached is my code any suggestions?

0 Kudos
Message 7 of 10
(5,450 Views)
Hi Chris,

Since the"CountPulses" subVI wasn't attached, I wasn't able to check out that portion of the code.  In regards to the beahvior you're seeing, I tried looking at the code to debug it, but found it somewhat difficult to understand.  Most notably, the code uses the indexed for loop structure as shown in the VI I attached previously in this thread, but there is no array feeding into each of these for loops. 

From the look of your front panel, I think I see what you're trying to accomplsih, so I took a crack at rewriting the code, making use of the aforementioned structure.  Let me know if this is what you're looking for.  Also, please take a look at the techniques I've used in this code, and let me know if you have any questions on them.

Have a great day!
Travis W

Message Edited by Travis W on 11-22-2006 11:29 AM

0 Kudos
Message 8 of 10
(5,433 Views)
Hi,

I am using a PCIe NI-6259 DAQ card that has only has two 80Mhz counter/timers and wish to do the following:

-Send a fixed 1HZ signal every second (1PPS) for a duration of 35 micro-seconds     (same frequency and pulse width)
-Send the 1 PPS signal through 9 independent channels.

According to this forum, I could connect one counter and drive the signal through 9 relays to the points I wish to send the signal, and then
control the relays with my digital lines to independently turn on/off a particular trigger signal.

(and will possibly be using the other channel to gate the signal if the signal is finite and not continuous)

Is this configuration I have explained feasible??

JoshPSU
0 Kudos
Message 9 of 10
(5,234 Views)

Sounds like it should be feasible -- here's a couple tips to consider:

Since your counter pulsetrain will be hardware timed, you'll get the most reliable timing synchronization by setting up your DO task with a sampling clock.  I *think* you'll want to make your DO task use the trailing edge of the counter pulsetrain as it's sampling clock.   So the end of each pulse causes the 9 DO bits to set up the relays for the next pulse.  This gives the relays plenty of response time so they'll be ready when the next pulse happens.  Here's what I'd do:

1. Briefly create a static DO task on your 9 bits and write all bits to the "relay off" state.  Clear the task.  (The bits will remain in "relay off" state.)

2. Create a hw-timed DO task (using DAQmx Timing), specify your counter's output as the sampling clock, write your sequence of relay control bit patterns to the task, and start it.  Nothing happens yet because the pulse train hasn't started.

3. Configure & start your counter pulsetrain task with freq = 1 Hz, duty cycle = 0.000035.  If it's a finite generation, remember to generate the 1 extra pulse because nothing passes through the relays on the first pulse.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 10 of 10
(5,226 Views)