Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Some questions about generating pulses with/without counters.

Hi all,
I'm new to LV, and I met with some problems when I wanted to generate several pulses. I wanna use 3 channels to output 3 different pulses, and the accuracy should be microsecond(us) magnitude. The DAQ board I'm using is PCIe-6251 board, on which there are two 32-bit 80MHz counter/timers.  So can I generate 3 different pulses using these 2 counters? And do I have to use counters to generate a microsecond magnitude pulse?
 
Another question is, I made a prgramme to do the analog input. And it runs at about 20K Hz. The source of the AI clock was set as onboard clock. Although the specification told me that the AI is 16 bits, 1.25MS/s, I didnt see difference when I set the frequecy from 20k to 1M Hz(which is 20K always). Is it the only way using an external reference clock?
 
I'm using LV 8.5, under Windows XP OS. Thank you.
 
Best wishes
Bo


Message Edited by foolooo on 05-13-2008 05:07 AM
------------------------
My blog Let's LabVIEW.
0 Kudos
Message 1 of 9
(4,919 Views)
Hi Bo,

For some reason your original post was not picked up, but I have posted back here as the application is definitely relevant to this forum area. with regards to your questions, generating singlas with a desired frequency is a very common counter application. the timebase that you use will define the accuracy of the signal that you generate, but you can generate a signal with whatever frequence you desire within the paramters of the device itself. The clock is simply the timebase that the counter uses to know when it should generate a pulse. If you need a signal with microsecond accuracy, I interpret it that you need to generate a signal with a mHz frequency, is that correct?

As for generating mutliple signals with the counters. You can only generate one signal at a time on a counter because the counter circuitry has one counter out terminal. you can modify the frequency on the fly so in theory by alternating quick enough,  you could generate a signal with multiple frequency components. but it doesn't sound like this is what you want and I wouldn't reccomend it anyway, programming this could cause you problems. As to whether you have to use counters to generate a micro second pulse, the answer is unfortunately yes. If you were to use DIO instead, the signal would be square wave and only have a milli second accuracy (as this is all software allows on a windows based system).

As to your last question, the accuracy specification refers to the resolution of the device. by 16bits, it means that the device can convert an analog voltage into a 2^16 number of discrete digital bins. The maximum sampling rate is really defined by the bus platform you are using as it essentially dictates how quickly data can be taken from the card into.
The max speed which you can sample at is 333MHZ which is the max speed that the PCI bus can transfer date. The speed at which the ADC and multiplexer works is, at the moment, not the limiting factor on the acquisition speed. Again, I think you are just slightly confusing yourself over the acquisition rates and the clock that it uses to synchronise acquisition.

I hope this clears things up for you.
Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 2 of 9
(4,891 Views)

Hi Rob L,

Thank you so much for your reply. I think I need try some other way to generate 3 types of pulses. Could you give some advices on that?

And for the second question, actually I was doing digital output and analog input in the same loop, so i'm not sure which limited the speed, and I'll try that. But assume that the software makes the digital output can only run at 1ms, then i cannot acquire the data faster than 1kHz, is it correct? And I'll try to test the speed of the D/O in that case.

Thank you again for your patience. Robot Happy

P.S. I don't know where I can rate your reply, although I wanna rate 10 for that.Robot Sad

Best wishes

Bo

------------------------
My blog Let's LabVIEW.
0 Kudos
Message 3 of 9
(4,889 Views)
Hi Bo,

Thanks for the kind words, you can rate messages at the bottom right of the message screen.

To generate 3 different pulse you really need 3 counters, unless you emit a pulse using sotware timing and this simply won't be good enough for you application. In order to emit mulitple pulse trains continuously on a counter, you have to be able to allocate the resource correctly. the way DAQmx works means that if one counter task is using the counter, no other tasks are able to access the resource. What you could possibly do (which was what I was referring to in the last post) is modify the frequency on the fly between each cycle of the generation. however, this means that you effectively stop one frequency while emitting another one which i think sounds like it is unsuitable for you application. therefore, you're only realy possibility is to use another card with counters onboard.

With regards to the AI and DI. If you have these both in the same loop (i.e. you have the two read functions in the same loop), this will not affect the acquisition rates of the AI, but the rate at which you take data off the buffer. With the DAQmx Read VI you can specify the amount of data to read off the buffer at any one time. If you do not take off the data quick enough, the DAQmx driver will report an overflow error because it is acquiring so fast that it overwrites old data on the memory buffer. In your case, you will want to set a large buffer grab (i.e. set the number of samples terminal quite high) so you can grab large chunks of data for each iteration of your loop. By default, LabVIEW grabs all available data points. So essentially this means you can run your AI as fast as you wish, software simply constrains how quickly you grab the data being passed up into memory.

I hope this helps!

Have a great weekend


Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 4 of 9
(4,874 Views)
Hi Rob L,
 
Sorry that I didnt fint where I can rate yet. And the following is my screen of your reply, could you show me ?
I was doing HT single poingt AI and DO in every loop, and I think it runs slowly because the software interrupts for every loop (about 0.22ms as calculated). So I intend to do the AI and DO independently off the software. I tried the example "Write Dig Chan-Ext Clk.vi", which needs the external clock. And When I used the DAQ assistant, it also require the external clock. I thought the onboard clock is fast enough for 1MHz, but it seems not working.
My question is, Is there any way I can do the AI and DO continuously at 1MHz (without external clock, if possible)? The DO wave is like:
 
------------------------
My blog Let's LabVIEW.
Download All
0 Kudos
Message 5 of 9
(4,865 Views)
For some unknown reason,  I cannot edit the last post. Please see the attachment for the pics. And thank you for your help.:)
 
 
Best wishes
Bo
------------------------
My blog Let's LabVIEW.
0 Kudos
Message 6 of 9
(4,861 Views)
Hi Bo,

Sorry about the confusion with the message rating, i'm not too sure why it's not showing up? Maybe it's the browser you are using????

I've had a look at the digital pulses you are trying to generate and this should be fine. Modify the external clock to a clock signal which can be utulised (i.e. the onboard AO sample clock) as the DO sample clock has to be defined either by an external source, or by one of the other internal signals (such as the AI or AO sample clocks). This is because the Digital circuitry on the M Series ASIC does not have direct access to the onboard 80Mhz oscillator. The Clock is divided down and referenced by different areas including the Counter circuitry, AI\AO circuitry, and the RTSI interface. Therefore, to use it as a sample clock, you can utilise the AO or AI sample clock's as your source. There is a great tutorial which details this much more concisely and gives a couple of good examples; check out

http://zone.ni.com/devzone/cda/tut/p/id/3615

This will therefore enable you to perform your DO at the rates you require without the need for  an external timebase.

I hope this helps
Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
Message 7 of 9
(4,844 Views)
Hi Rob L,
Thank you for your kind help.  And it works. I'm doing the AI/DO synchronization now, and may bother you later. Appreciate your help.
(IE didn't solve the rating problem, and I'll try some other computer later.)
 
Best wishes
Bo
------------------------
My blog Let's LabVIEW.
0 Kudos
Message 8 of 9
(4,839 Views)
Hi Bo,

Glad you have it working. In order to rate a message you have to have over 50 p[osts. My apologies, I didn't relaise you had less than this.

Thanks anyway and good luck!
Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 9 of 9
(4,833 Views)