Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

usb 6009 - how to conrol rate at which digital output port is updated

Hello everybody,
 
My queastion concerns digital output port on USB 6009 Multifunction DAQ.
 
I wonder how to contlol rate at which digital output port is updated. I use LabVIEW 7.1 and DAQ-mx Base to cooperate with DAQ card. My goal is to create digital pulses that period is changable.
In my algorithm I create waveform that contains several zeros and ones at prespecified rate. Then I send such 1 dimensional array to the for loop and try to send each value to the USB 6009 digital output port using
DAQmx Base Write(Digital U8 1CHan 1Samp).
Everything works even fine, and output signal has needed shape, but the problems appears when I inecrese rate at wchich I prepare sinal that is then outputed and decrese number of samples in that signal simultaneously, so that the product of number of samples multiplied by rate is constant.
        In that case the output signal lasts longer despite that I I decrese value that is sent to "wait until next ms" funcunction which I use inside "for loop"
0 Kudos
Message 1 of 13
(5,028 Views)
and here You have the second part of my question:
 
It seems as if the DAQmx Base Write(Digital U8 1CHan 1Samp). vi execution isn't controlled correctly If so
 the output signal should lasts for this same period of time, as I wanted it to last. I tried to use Timed Loop instead of foor loop but the problem occurs as well.
 
I'm really worried about the problem that seems to be strange and I would like to meet Your opinion.
 
Any help will be appreciated,
 
with kind of regards
 
Johnnie
 
0 Kudos
Message 2 of 13
(5,022 Views)

Hello Johnnie,

What value are you sending to the Wait until next millisecond multiple function?  If you are specifying a value that is low, below a few milliseconds, your computer's processor may not be allowing the loop to iterate at this speed, interrupting LabVIEW so that other tasks can occur.  What operating system are you using?  You might use the tick count function to determine the time that elapses for each loop iteration and compare it to the time you are specifying with the wait function.  What is the maximum digital output speed you have been able to achieve?

Regards,

Laura

Message 3 of 13
(4,980 Views)

Thanks a lot for reply,

I currently use Windows 2000 XP as a operating system in my computer that has Athlon 2200+ and Asus kv700 as a motherboard so hardware is rather fast.

The problem that I described in my post occurs at both low and high frequences at with I try to control loop execution. At low frequences the output signal becoms longer despite the fact that total number of samples is smaller, than in case I use  frequences a litttle higher and more samples so that the output signal has the same amount of time like in first case when freqency is low and number of samples smaller.

I don't expect to reach frequences higher than 700 - 800 hz

In my question I also wonder whether or not there is another method  I can use to control rate at which digital port is updated and where is a hole in my algorithm. on the other hand I wonder whether for loop always control DAQmx Base Write(Digital U8 1CHan 1Samp).vi function accurately. Maybe the way I sand samples to the loop is wrong but I send samples  to the DAQmx Base Write(Digital U8 1CHan 1Samp) one by one with auto indexing option enabled.

However thanks Laura for cooperation concerning my problem

With kind of regards

Johnnie

0 Kudos
Message 4 of 13
(4,973 Views)
 

Hi Johnnie,

Since you are using Windows, why are you not using NI-DAQmx?  This is the driver recommended for use with Windows.  I recommend that you switch over to NI-DAQmx and use the NI-DAQmx Base to NI-DAQmx Conversion Utility to convert your currently written programs. 

When doing software-timed digital output, the only way to control the output is to use a loop to control the time between one sample and the next.  Your way of sending the samples to the DAQmxWrite VI sounds fine.  Is your Wait function inside this For Loop?  It should be so that it can control the time between samples.

Regards,

Laura

0 Kudos
Message 5 of 13
(4,954 Views)

Dear Laura,

    Unfortunately I have to use NI-DAQmx BASE because the aplication I develop is a custom aplication and the only driver available is this one.

0 Kudos
Message 6 of 13
(4,949 Views)

"Wait until next ms" function is used inside the loop, and it is to conrol loop execution correctly.

Maybe there is some problem in the way I prepare output  signal, but in my point of view everything looks pretty good.

Hm, there must be any solution - there must be some mistake,

Thanks a lot again,

 

Yours sincerely,

Johnnie.

 

0 Kudos
Message 7 of 13
(4,948 Views)

Hi Johnnie,

If you would like us to try to provide additional help, please post this portion of your code.

Are you developing an application that you will use on a different operating system?  I don't understand why you cannot use NI-DAQmx.

Thanks!

Laura

0 Kudos
Message 8 of 13
(4,938 Views)
here there is a wrong code that we talked about:
0 Kudos
Message 9 of 13
(4,918 Views)
Dear Laura,
 
Maybe I've found the reason of my problem.
Besause I send samples to the DAQ in  loop that is controlled by wait until next ms multiple, that has 1ms resolution therefore I have to create pulses that contains samples distanced one from another by duration   respecting   that fact. I think that in some cases I recive longer output signals because I inncrese number of samples that are to send to a DAQ but the period I think is set in loop controlling Write function is different because the time delay which I calculate using formula: Time delay = 1/freq of samples is round to the neerest integer.
The higher frequences I use the bigger error I recive and the bigger diffrences in the output signal in respect to the signal that is seen on the front panel. 
I' m going to check whether I'm right or not on Thuesday, and I will let You know what results there will be.
I'm also looking foreward to hear Your opinion concerning my code and the reasons I regard that cause my problem.
 
Many regards,
Johnnie
control and measurement systems engineer.
0 Kudos
Message 10 of 13
(4,916 Views)