LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter precision

1. I have two counters, A and B. A controls a conditioning waveform, and
B controls a test waveform. There needs to be _at least_ N cycles of A before
B can fire. Whether B fires after the N cycles of A have gone through, the
user can select. If the user desires, he/she can continue firing A for as
long as they want. However, once the user decides to fire B, and the necessary
cycles of A have finished, then A must stop at the next falling edge, and
B fires.

2. The way I've wired it together is to have the OUT of A wired to a T junction,
and one branch wired to its actuator and another wired to the SOURCE of another
counter(let's say C), which counts the cycles of A(on the falling edge).
When C counts the necessary cycles of A, and
the user decides to fire B,
A is stopped, and B is started. I read the count on C in a while loop.

3. This works ok for relatively low frequencies of A(~ <20 Hz). However,
when A gets above this, the while loop isn't as effective, and more cycles
of A than are desired get through. If you wanted 5 cycles, often times 7
to 10 will get through before A is stopped and B is started.

4. I've attempted to minimize as much overhead as possible by initializing
all the counters before hand, and simply using the .vi, to have
control passing through as few sub-vis as possible.

5. If someone can point out the errors I'm making in effeciency, that'd be
great.

6. To throw a monkey-wrench into the whole thing, there's also a call to
a DLL that runs in parallel to all this(it's a single processor machine).

p.s.: Much thanks to those who helped me out with previous questions.
0 Kudos
Message 1 of 2
(2,294 Views)
[This followup was posted to comp.lang.labview and a copy was sent to the
cited author.]

In article <38d8e472@newsgroups.ni.com>, jejokoola80@aol.com says...
>
> 1. I have two counters, A and B. A controls a conditioning waveform, and
> B controls a test waveform. There needs to be _at least_ N cycles of A before
> B can fire. Whether B fires after the N cycles of A have gone through, the
> user can select. If the user desires, he/she can continue firing A for as
> long as they want. However, once the user decides to fire B, and the necessary
> cycles of A have finished, then A must stop at the next falling edge, and
> B fires.
>
> 2. The way I've wired it together is to have the OUT of A wired to a T junction,
> and one branch wired to its actua
tor and another wired to the SOURCE of another
> counter(let's say C), which counts the cycles of A(on the falling edge).
> When C counts the necessary cycles of A, and the user decides to fire B,
> A is stopped, and B is started. I read the count on C in a while loop.

How about:
1. Set C to count down and toggle C OUT on reaching zero.
2. Make the user interface control a DIO line
3. Connect C OUT and the DIO line as the inputs of an AND gate (powered
from the 5V and DGND lines).
4. Take the output of the gate to the GATE of B.

This should be OK if the user chooses to start B as soon as C reaches
zero. AFAIK you are stuck if you want to have B fire instantly on user
input if user delays until C has reached zero. I can't think of a way
around that except with a hardware switch, but given human reaction times
I would be surprised if the lack of "instant" reaction is a problem in
this case.

I hope this is of help
Bernard Treves Brown
Whaley Bridge
UK.
0 Kudos
Message 2 of 2
(2,294 Views)