Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI-6221 Continuous Pulsetrain Generation

Solved!
Go to solution

Hi,

 

I have a PXI-6221 that I'm trying to use to generate pulsetrains but running into issues.

 

Objective: generate 3 different continuous pulsetrains from PXI-6221 and output two 3 separate PFIs.

 

Problem: when I run the LabView example "Counter - Continuous Output.vi", I can see the pulsetrain generated. However, sometimes I see what looks like old tasks still running. Specifically, this is what I do and see:

  1. Set counter to ctr0 on PXI-6221
  2. Set output terminal to PFI0
  3. Set freq and duty cycle to 10 Hz and 0.5
  4. Run program, see correct pulsetrain on PFI0
  5. Stop program, set output terminal to PFI2
  6. Run program, see the correct pulsetrain on PFI2, but the pulsetrain is also being generated on PFI0. I expect PFI0 to be low at all times. 

Troubleshooting:

  1. If I stop the program and change the counter selection, and then re-run, I see the pulsetrain generating only on a single channel again (expected behavior).
  2. As soon as I try to stop the program, switch the channel but NOT the counter, re-start, I get back to the same error state as previously encountered.

Questions: 

  1. Am I neglecting to clear out a cache or something here? Do I need to do something special to clear out / restart the counters that I'm not already doing. 
  2. Tangentially related - will I be able to generate three different pulsetrains with only two counters available on the PXI-6221? I was thinking of using the same counter to create three different, synchronized pulses (different duty cycles and frequencies, but aligned w/ each other), but the examples I've seen only have a 1:1 relation between counter to output terminal. 

 

Thank you much in advance.

 

I've attached the code I'm testing, but note that this is a LabView example and I have not modified it.

0 Kudos
Message 1 of 3
(1,477 Views)
Solution
Accepted by topic author eileen.j.kim

I was able to solve this by adding a device reset block after the last clear task block.

0 Kudos
Message 2 of 3
(1,442 Views)

FYI: the problem you solved with device reset is known as "lazy uncommit".   Once you set up the output for PFI0, then later reconfigured to route to PFI2, the old route to PFI0 took on "lazy uncommit" status.  Which basically means that the route isn't immediately removed, but is somehow marked as being *eligible* to be overridden.

 

When the PFI also has DIO functionality, one could configure it to be used in a digital task as a way to get past "lazy uncommit" rather than do a device reset.  A full device reset wouldn't be a good solution if you had, say, a continuous analog task also running at the time.

 

You can learn more by searching around here now that you know that "lazy uncommit" is the term to key on.

 

As to your 2nd question, No, you can't produce 3 distinct counter outputs with a device having only 2 counters.  And it doesn't really make sense to describe 3 pulse trains with different frequencies and duty cycles as being *aligned*.  Unless you only mean to start and/or stop them at the same time.

 

You might conceivably define a "correlated DIO" task for those 3 outputs and then create a counter pulse train task to act as the sample clock.  But it'll be significantly non-trivial to feed the task with the exact right DO data to produce your 3 pulse trains at different frequencies and duty cycles.

 

An X-series device would make this much easier again b/c they have 4 counters available.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 3 of 3
(1,423 Views)