LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variable duty cycle and frequency pulse train on AT-MIO-16XE-10

Hello All,

I inherited an old AT-MIO-16XE-10 card and I am also working with a newer PCI-6052E card. On both, I would like to be able to pre-program a variable duty cycle and/or frequency pulse train, then push start and watch the beauty unfold. The pre-progam aspect of this would say to change duty cycle and/or frequency over time in a linear, quadratic, square root, logarithmic, etc. fashion. The frequency may be 0.5 MHz to 5 MHz, the duty cycle 0 % to 100 %. The duration of the pulse train may be as short as 10 ms or as long as 1 s. Thus, the suggestions made in this forum to change things through controls on the front panel will not work (my fingers are not fast enough). In fact, I am afraid that even if I program these changes in some sort of loop, the loop will not be fast enough to keep up with the MHz frequency and ms duration. Any thoughts on this? Should this be attempted via counters or via DIO? Is there a way to change duty cycle and/or frequency fast enough?

Thanks,

Matt Koch
0 Kudos
Message 1 of 7
(3,400 Views)

Hello Matt,

This operation should definitely use the counters of your Multifunction DAQ devices.  They are capable of generating pulse trains that you can update the frequency and duty cycle of while the operation is running.  Here is an example written in Traditional NI-DAQ which needs to be used with your AT-MIO-16XE-10.  The PCI-6052E can use the NI-DAQmx example

In LabVIEW, you should be able to achieve loop rates on the order of a few milliseconds, depending on your computer.  I would expect that you would be able to change the properties fast enough for your purposes, if the minimum pulse train time will be 10ms before you need to change it again.

Please let us know if you have additional questions.

Regards,
Laura

0 Kudos
Message 2 of 7
(3,389 Views)
Hi there Laura,

and thank you so much for responding! I apologize for the late reply. There is so much to do, I do not know where to start. However, following your advice, I did put together a nice Counter VI (somewhat condensed, without the bells and whistles from what you sent, but very compact). It seems to work OK, as I can tell by running my Counter VI and at the same time monitoring on Measurement & Automation Explorer (MAE) 4.0 the AI (0) to which I connected the Counter (0).

And this is where a new problem lies. The MAE seems to run at a very slow rate, so I cannot go very high up on the counter pulse train frequency, i.e. I cannot test whether my Counter VI will really take me to the 1 MHz or at least the 100 kHz range. So I thougt I'd just write a VI with fast AI using intermediate traditional DAQ and run that together with the Counter VI.

Well, much to my surprise, even when running this Fast AI VI alone, I get the following error message:

"Error -10455 occurred at AI Control
Possible reason(s): NI-DAQ LV:  No DMA channel is available for use."

I am running all this on Windows 2000 and LabVIEW-7.0, and when I go into the Windows Device Manager, I see the AT-MIO-16XE-10 show up twice. The first incidence seems to be properly installed, the second one has the yellow exclamation mark of a not completely installed device. Reinstalling the driver for this (nidaq.inf) does not help either. And perhaps the exclamation mark suggests the missing DMA?

So, I don't know if I can use fast AI to verify my counter now? Am I missing something in terms of board configuration? Is there another way by which I could verify the counter? Perhaps a second counter which would read the first counter's output? Anything?

Thanks,

Matt Koch
0 Kudos
Message 3 of 7
(3,372 Views)
Oops!

sorry for my panic attack in that previous post. I rummaged through some other DAQ posts in the NI Developer Zone and found a couple that had the same DMA problem. There, the cause was an IRQ conflict or such. So I went back into Windoze 2000 Device Manager and MANUALLY assigned a configuration for the first AT-MIO-16XE-10 incidence, the one that seemingly worked OK already. Low and behold, as I did that, it suddenly asked me for IRQ and DMA where before it only told me what IO it had used. So I kept the IO and entered IRQ 5, DMA 5 and DMA 6, and the thing flies now. The second AT-MIO-16XE-10 incidence, the one with the yellow exclamation mark, I simply left alone.

I have even been able to observe a 20 kHz pulse train sent from Counter 0 to Analog Input 0, though the voltage levels seem to be off. Well, perhaps that's just a matter of some fine tuning. At least the coarse hurdles seem out of the way now.

Regards,

Matt Koch
0 Kudos
Message 4 of 7
(3,368 Views)

Hi Matt,

Thanks for keeping us posted about your progress.  It sounds like you've got most things figured out.  For the voltage level being off, you might check into that you have correctly connected your signals depending on what analog input configuration you are using (differential, RSE, or NRSE).  If you need some help with that, you might check out Field Wiring and Noise Considerations for Analog Signals.

Remember that the maximum analog input rate for your AT-MIO-16XE-10 is only 100 KS/s so you will not be able reliably to see the pulse train at frequencies much higher than 10 or 20 KHz.  Another way to verify the frequency of the pulse train is to use the counter on your other device to do a frequency measurement.  If the AT-MIO-16XE-10 is generating the pulse train, you can use example programs for measuring frequency with your other device to verify the frequency.

Regards,
Laura 

0 Kudos
Message 5 of 7
(3,351 Views)
Hi Laura,

I think you were right on. I am getting too old for this line of work! In MAE, I specified differential input with 0 to 10 V range on Channel 0 (between ACH0 and ACH8), but I connected ACH0 to AIGnd. Still, though, after correcting the connection, my Digital Volt Meter (DVM) reads over 5.6 V at 100 % duty cycle, while my Fast AI VI only shows about 4.8 V at the top flat of the pulse and nicely 0 V at the bottom flat of the pulse. By the way, I have GPCtr0_Out (2) connected to ACH0 (68) and DGnd (4) connected to ACH8 (34). I also used the E-Series Calibration VI with the self-calibration and user EPROM options just before running these measurements.

And of course you were right about the maximum sample frequency of the AT-MIO-16XE-10. I learned that the other day. For some reason I thought it could do at least 250 kHz, but I guess 100 kHz was the price to pay for 16 bit resolution in those olden days of AT cards. Thanks for all your help. I think I got it under control now.

Oh yes, one more question, though. If I were to attempt frequency measurement, could I do it with one and the same AT-MIO-16XE-10 card, i.e. use Counter 0 to generate the pulse train and Counter 1 to measure the pulse train, or would I need two different cards (devices, as you call them), possibly even in two different computers?

Regards,

Matt
0 Kudos
Message 6 of 7
(3,348 Views)

Hi Matt,

It's strange that your DMM reads 5.6 V for the counter output.  The counters use TTL specifications, so I wouldn't expect the output to be that high.  You may want to use a known voltage source with both the analog input of this card and the DMM to see where the discrepancy lies.

I took a look at the frequency examples that could be used with your AT-MIO-16XE-10 and they use two counters to perform the measurement so you can't do the pulse generation and measure frequency at the same time on this card.  You can use your PCI-6052E in the same computer to measure frequency, if the computer has slots for both.  You can use both cards at the same time.  Or you could use the Measure Period.vi example in the Example Finder to measure period with the AT-MIO-16XE-10 while generating a pulse train on the other counter. 

Regards,
Laura

0 Kudos
Message 7 of 7
(3,331 Views)