Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Externally gating a continuous pulse train

Solved!
Go to solution

Hi-

 

How do I externally gate a continuous pulse train on my USB-6343?

Specifically, I want to use a digital input signal as the gate for the pulse train.

 

I'm using LV 2010.

 

Best

Dar Bahatt

0 Kudos
Message 1 of 8
(6,385 Views)

Hi Dar,

 

You should configure a Pause Trigger.  From the X Series User Manual:

 

You also can use the Gate input of the counter as a Pause Trigger (if it is not
used as a Start Trigger). The counter pauses pulse generation when the
Pause Trigger is active.

 

 

A LabVIEW example showing how to configure a Pause Trigger can be found here.

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 8
(6,375 Views)

Hi John-

 

Thank you, this is exactly what I was looking for!

 

I noticed though that the counter output does not always end at the level (high or low) specified in the VI

when the pulse train is paused. Any insight on that?

 

 

Best,

Dar Bahatt

0 Kudos
Message 3 of 8
(6,354 Views)

Hi Dar,

 

That's correct--the gate is used to determine whether or not to increment the counter based off of the counter source.  The output will toggle every N ticks of the source.  Taking the source away, the counter output will remain at whatever state it was previously.

 

It sounds like you want to do more than just gate the counter. If you want to ensure that the output will always finish generating the pulse it is currently on even if the pause trigger has been asserted, I suggest the following if you have another counter available (there are 4 total on X Series DAQ devices):

  1. Configure the counter output as you have so far (with the Pause Trigger).
  2. Configure a 2nd counter for a retriggerable, single pulse generation, with the high time chosen to give you your desired duty cycle.
  3. The trigger source of the 2nd counter would be the internal output of the first one.

So, each pulse of the first counter will trigger a single pulse output of the 2nd counter.  If the first counter is paused when it is still high, the 2nd counter will finish the current pulse that it is generating and will not trigger again until the next rising edge on the first counter.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 8
(6,348 Views)

Hi John-

 

 Thank you!

 

 One last set of questions:

 

 1) Is it possible to set number of ticks N to 1 so we guarantee completion of pulse?

 2) Is it possible to use a trigger pulse (low, high, low) instead of a trigger level (high, or low) as a pause signal?

 3) I plan on using the continuous pulse train as the clock of a second counter, programmed for linear position measurements.

     Can you point me to an example of counter clock signal settings?

 

Best,

Dar

 

0 Kudos
Message 5 of 8
(6,338 Views)

Hi Dar,

 

1)  No, the number of ticks must be at least 2.  However, you can use an internal timebase as your source so you could still guarantee completion of the pulse.

 

2)  Do you want the edge of the signal to stop the counter output task? The Pause trigger (which is used as the gate of the counter) is based off of digital level, not off of the edge.

 

3)  You just need to use the DAQmx Timing subVI to configure the counter clock signal.  Implicit is used for counter output tasks since the counter essentially clocks itself by generating consecutive pulses at the desired settings.

 

 

Could you please describe in detail the exact behavior you are looking for?  I'm sure it is possible but I'm not sure what exactly you are asking for since the description has changed a bit between posts.  Be sure to include things like how many channels you need, and what else is running on the system.  The original question of how to gate the counter is not truly descriptive of what I think it is that you are looking for.

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 8
(6,333 Views)

Hi John-

 

I am driving a stepper motor with the continuous pulse train. The pulse train has to terminate once I hit the home switch.

I am not sure yet if the home switch will generate a pulse or just a change in level, and that is why I am investigating both

options.

 

The other task is to use the continuous pulse train as the clock of a second counter that measures linear position, for determining

the characteristics of the linear motion (lost steps, etc...)

 

Dar

 

0 Kudos
Message 7 of 8
(6,330 Views)
Solution
Accepted by topic author Dar_Bahatt

Hi Dar,

 

Let me revise my earlier advice given the new information.  You'll still want to use 2 counters for the pulse train:

 

1.  Use one counter for continuous output with a pause trigger configured.

2.  Use the other counter to generate a very long pulse, triggered on the rising edge of your home switch.  You would use this as the pause trigger instead of the home switch directly.

 

You can poll the output state of the 2nd counter so you'll know in software when the home switch has been registered.  At this point you stop both counter tasks in software (stop the continuous one first).  You can write a logic 0 to the PFI lines after the counter tasks have been stopped to set the state back to 0 before the next run--since you're driving a stepper motor I don't think the width of the last pulse should matter very much as long as the counter is re-initialized.

 

 

Best Regards,

John Passiak
0 Kudos
Message 8 of 8
(6,322 Views)