07-22-2010 01:28 PM
Hi,
I need to generate a pulse train for a period of time. However, this period of time is variable, and because of that I can't
use the finite number of samples.
The pulse train must be output based on the state of the digital I/O. When the I/O line goes high, the pulse train must be output,
and when it goes low the pulse train needs to be stopped.
I'm using a USB-6212, but one of the available counters is already being used for pulse width measurement. I tryed to make a
logical AND with the pulse train and the enable line, but because of vi execution time this solution is modifying the pulse train
frequency, which is not acceptable.
Thanks in Advance,
Mariana.
Solved! Go to Solution.
07-22-2010 05:50 PM
Hi Mariana,
You can use a pause trigger to control when the pulse train is output, based on whether an external digital signal is high or low. DAQmx ships with examples demonstrating this. Here is the LabVIEW version: Gen Dig Pulse Train-Continous-Pause Trigger.vi
Brad
07-22-2010 06:06 PM
Hi Brad,
I saw the examples with the pause task vi involved. My problem is that I need two triggers: one that tells me when to output the pulse train and another to
stop it. Those triggers are actually both rising (start trigger) and falling (stop trigger) edges of a digital input.
I tried to modify the example you provided by adding the start edge trigger, but labview did not accepted it.
Regards,
Mariana.
07-22-2010 08:26 PM - edited 07-22-2010 08:27 PM
Hi Mariana,
Your previous message mentioned "the I/O line" (singular) and "the enable line" (singular), not "the I/O lines" (plural). Are both edges on the same I/O line? Or are they on separate I/O lines (e.g. rising on PFI0, falling on PFI1)? Could you clarify your requirements?
If the rising and falling edges both come from the same I/O line, then a pause trigger seems to do what you want: cause the counter to generate pulses while the I/O line is high, and cause the counter to stop while the I/O line is low. However, if you start the task while the I/O line is high, it will immediately start outputting pulses. If you want it to wait until the first rising edge of the I/O line before generating any pulses, you can use an "arm start" trigger (which is right below "pause trigger" in the property node). When the "arm start" trigger arrives, the counter will be armed, and from then on, the task will use the pause trigger to determine when to generate pulses. Using pause and start triggers in the same counter task returns error -200146, "Pause and start triggers cannot both be active in this task," but using pause and "arm start" triggers in the same counter task should be okay.
If you want rising edges from PFI0 to start the counter and falling edges from PFI1 to stop the counter, that's more complicated and will require additional thought (and possibly additional hardware).
Brad
07-23-2010 07:33 AM
Hi Brad,
Both rising and falling edges are from the same line. I'll try your suggestion.
Thanks a lot,
Mariana.
07-23-2010 09:31 AM
Hi Brad,
The vi worked when I inserted the ArmStart property node, thank ou very much!!
My problem now is that sometimes, when paused, the pulse generator pin stays in high state, and I need it to always go to low state when the task is paused. There is no property for that which I could find, do you have any idea??
Regards,
Mariana.