LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I send a TTL Pulse in a given rhythm?

I am new to LabView and using version 8.1.1.
I am trying to send a series of TTL pulses in a particular rhythm, (a train of 3 pulses at 50Hz repeated every 200ms). Is it possible to do this with accuracy?
Each pulse need to be accurate to the millisecond.

Thank you in advance.
0 Kudos
Message 1 of 11
(4,525 Views)
What hardware do you have?
If you are using windows you can not have any accuracy or reliability.
One solution is Labview real time
0 Kudos
Message 2 of 11
(4,508 Views)
If you send a sequence of values to a digital line clocked at 10 ms and set it to repeat continuously, you should get what you want. You must have a hardware clocked digital output device with a 20 element buffer to do this. One digital pattern which will do this is 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.

Lynn
0 Kudos
Message 3 of 11
(4,494 Views)

Hello Lanny22,

 

Lynn is correct.  If you have hardware timed (correlated) digital lines then you can do this by using the values he suggested.  If you're using a National Instruments multifunction DAQ device with LabVIEW then I would recommend looking at this example program.  Open LabVIEW and go to Help» Find Examples.  Then navigate to Hardware Input and Output» DAQmx» Digital Generation» Cont Write Dig Port-Ext Clk.vi.  This is the example program I would use to generate this pulse train.

 

Cheers,

Brooks
0 Kudos
Message 4 of 11
(4,482 Views)
Thank you all for the comments.
 
I am using Windows XP, with the data aquisition card NI PCI-6221. Will I need a better DAQ card to get this to work?
 
Thanks again, I will go and play around with it some more now.
0 Kudos
Message 5 of 11
(4,415 Views)

Hello Lanny22,

 

The PCI-6221 has 8 clocked lines that you can run at up to 1 MHz.  This means that you can update the digital output with any patter you want at a rate of up to 1 MHz--you should be just fine with this board unless you need more than 8 lines.

 

Cheers,

Brooks
0 Kudos
Message 6 of 11
(4,397 Views)

An alternate way to do this is to use your board's 2 counters in tandem.

1. Configure Ctr0 for continuous pulse generation at 50 Hz and 0.5 duty cycle (or whatever duty cycle you need).  Configure it to be Pause-Triggered by the digital level of "Ctr1InternalOutput", and set to to Pause When Low.   (These settings require you to use the DAQmx Trigger property node).   Note for future reference - your 50 Hz pulse train has a 20 msec period.

2. Configure Ctr1 for continuous pulse generation with high time=60 msec, low time = 140 msec.  The total period is thus 200 msec as needed.  The 60 msec high time is chosen to be equal to 3 full periods of Ctr0's 50 Hz pulse train.

3. Start the Ctr0 task first.  Because Ctr1's output (likely) defaults to the low state, Ctr0 is paused and no output pulse train signal is being generated.

4. Now start the Ctr1 task.  During the 60 msec of high time, the Ctr0 task will operate normally and produce 3 pulses at 50 Hz.  Then there is 140 msec of low time which prevents Ctr0 from generating pulses.  Then you get 60 msec more of high time and 3 more pulses.  Etc.   Note that the 3-pulse bursts start at 200 msec intervals.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 7 of 11
(4,385 Views)
Brooks,

I have been trying to configure the VI you suggested but am still having some problems.
 
So far I have been able to get the VI to run under some circumstances without errors, however I am unable to obtain a physical signal from the designated port (i.e. when viewed on an Oscilloscope - please note that I have tried different lines and used digital patterns to make all of the lines go high - and the ports are able to put out digital signals when tested with the Measurement Explorer). 
 
The other main issue of which I am unsure is what clock to use. Some channels give error messages when nominated as the clock source, and some run without problems. However, I am not clear which ones should be used and why.
 
I have attached two screen shots (of the front panel and block diagram) to demonstrate how I have altered the VI.
Any tips would be greatly appreciated.

Thanks again,

Lanny
0 Kudos
Message 8 of 11
(4,371 Views)
Here are the attachments I forgot last time. Sorry.
Download All
0 Kudos
Message 9 of 11
(4,358 Views)

1. Re: clocking.  I'm pretty sure you can't use any of the internal clocks directly to generate a sample clock.  You need to share a timing signal from another timed task or use an external signal.   You can borrow from another task without wiring if you designate something like "Dev1/AISampleClock" or "Dev1/Ctr0InternalOutput" for correlating with an AI task or a Counter pulse train task respectively.  Alternately, you can specify something like "Dev1/PFI0" to wire an exteral signal into the PFI0 terminal.   I would have expected your selection of "Dev1/10MHzRefClock" to produce an error dialog -- didn't it?

2. The likely reason you don't see anything on your scope is that you clear your task *immediately* after starting it.  The call to start the task will *NOT* wait for the task to complete.  So even if you had specified a valid sample clock signal, you'd have ended your task too soon to see any output changes.  Try inserting a "DAQmx Wait Until Done" function after DAQmx Start.  (Note that you should only "wait until done" when you have a reasonably short finite sampling task.)

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 10 of 11
(4,344 Views)