Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

I need tips on programming a 6602 counter/timer

Thanks for the fast response, Doug.  In response to your first question:  I define a single task using two CO Pulse Ticks vi's.  Both CO Pulse ticks vi's use the following:

source of ticks = 80 MHz timebase, low ticks = 8000000 (provides 10 Hz repetition), high ticks = 1000, idle state = low. 

One CO Pulse ticks vi uses counter 0 and an initial delay of 0 cycles.  The other CO Pulse ticks vi uses counter 1 and an initial delay of 320 cycles (which at 80 MHz should give me an initial delay of 4 microseconds).  I then use the DAQmx timing (implicit) vi {set to continuous} and the DAQmx start task vi to start the task.  Therefore, both CO Pulse ticks vi's are in a common task and start simultaneaously.  Here is the problem:

1) When I start the task and monitor the counter output on an oscilloscope, the 320 cylcle delay does not always equal 4 microseconds.  The 10 Hz reproducibility is fine.  If counter 1 output is 3.5 microseconds delayed from the first (as shown on the o-scope) then it is always 3.5 microseconds after the first.  However, when I stop the task and restart, the 320 cycle delay is no longer 3.5 microseconds (as measured on the oscilloscope) but something in the range of 2-6 microseconds. 

This problem is killing me.  Any help will be most appreciative.

-Darrin

 

Message 11 of 14
(1,470 Views)
Darrin,
I set up a couple counters and reproduced what you are seeing.  I saw a consistent 2.9 - 3.1 microsecond delay from the time the 1st counter starts to the time the 2nd counter starts.  What I believe is happening is that the count registers for both counters are not loaded until the task is actually started, so internally something like "load Counter 1 count registers, start Counter 1, load Counter 2 count registers, start Counter 2" is happening, which is why there is some delay between the two.

However, you can easily get around this by creating two separate counter tasks and having one counter trigger off the other.  When a task is set up to wait for a trigger, everything about the task is committed so that the instant it receives the trigger it starts.  This will give very accurate results.  I created a simple example that shows this.  I tested it and seems to give a pretty precise delay of 4 microseconds.  I hope this helps!

Doug M

Message Edited by Doug M on 08-15-2005 05:27 PM

Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 12 of 14
(1,463 Views)

Doug, would it be possible to save your example in the Labview 7.0 format?  I don't, as of yet, have the upgrade.

-Darrin

 

0 Kudos
Message 13 of 14
(1,447 Views)
No problem.

--Doug
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 14 of 14
(1,438 Views)