LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DAQ to output linearly rising voltage then keep constant?

 Hi, 

 

I want to output voltage first linearly increase to certain level and then keep constant, can anyone tell me how to achieve this? right now the best I can do is to output a step increasing voltage buy using a loop, the voltage changes each iterate, but the problem is the iterate time for the loop is 1s, which is too large so that the output votlage is not linear enough. 

. I attached the vi. here. 

0 Kudos
Message 1 of 8
(3,762 Views)

You need to use a faster loop rate and smaller steps.

 

Look at the ramp function which can create an array for you to make up the smaller steps.

0 Kudos
Message 2 of 8
(3,749 Views)

Thanks for your reply. I think you are correct, however, the problem is the loop has two DAQ assistants, one for outputing voltage one for accquring voltage, which limit the loop rate. I test the loop iterate one time take 1s. Is there any way I can reduce this time?

 

 

0 Kudos
Message 3 of 8
(3,747 Views)

Why do they have to be in the same loop?  They are totally independent of each other right now, so put them in separate loops.

Message 4 of 8
(3,741 Views)

daq.png

 

You've told it to take 100 samples at 100 Hz; this controls the loop timing.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 5 of 8
(3,738 Views)

Hi, I did as you said, putting them in two different loops, the loop rate increases a lot, now it only take 3ms to iterate once. However, I have one further question. I want to put them in the same loop because eventually I want to add a PID controller in this loop, the input of the PID controller is voltage from DAQ assistant analog input channel, after comparing with the reference voltage, the controller outputs a voltage through DAQ assistant analog output. I wonder is there any way that I can still achieve this PID control even putting the assistants in different loops?

 

 

0 Kudos
Message 6 of 8
(3,737 Views)

I see, that's the culprit. So I think I can set a large "sample rate" and smaller "sample to read", but this may cause a problem which is the buffer is full after certain time and the vi. just stops to work. 

 

Like I just set the sample rate to 1000Hz, while sample to read is 1, after less than 10s, the vi stops and an error pop up saying"The application is not able to keep up with the hardware acquisition.

Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem."

 

is there any way to solve this?

 

Thanks.

 

 

0 Kudos
Message 7 of 8
(3,733 Views)

You need to determine what loop rate you want to run it at.  1 sample at 1000 Hz it can't keep up.  1000 samples at 1000 Hz and the loop runs too slow making the steps very coarse.  What if you ran 10 samples at 1000 Hz (100 iterations per second)?

 

You can still keep things in separate loops.  There are other mechanisms for transferring data between loops so you can do things like feedback and PID control loops.

0 Kudos
Message 8 of 8
(3,711 Views)