Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Check of VI - Writing sine movement on the fly

Hello Guys,

 

I started two weeks ago with labview and I am still unsure if my program would work or not. Therefore, I would appreciate if anybody of you could have a quick look on it and give me some suggestions and comments. See attached file.

 

Here the main aims of the program:

 

1. Drive actuator with a sine motion whereas the amplitude frequency and offset should be able to be manipulated on the fly .

2. Take a measurement to define the first actual actuator position and check it with the desired offset position of the wave. Drive to offset position and start the wave movement as soon as offset position is reached. The offset should be later although changed on the fly. 

 

Some details:

My voltage range is from 0.53 to 9.47. the 0 position of the sine wave is at 4.5 volt.

 

My problems or what I do not understand are:

 

Would the code work... especially the part where it measures the offset position and write the motion command.

I am not sure about the 'Is task done?' part. I only don't want to produce to much data which is not used.

Which sample sizes should I use to get a smooth sine wave out of the actuator. I am not sure about the loop timing.

Furthermore is there an easier way to program that?

 

Sorry for all these 'beginner' questions... however your help would be really appreciated!!!! Smiley Happy

 

Cheers

 

0 Kudos
Message 1 of 2
(2,764 Views)

I'll take a shot at answering you questions:

 

Would the code work - Looking over it, I see an issue with the while loop around the "is task done" function. It has no break condition other than an error out or the second stop button. So, essentially your program will get stuck there until you press the stop2 button. I'm guessing that's not your desired behavior. The next issue I see is your analog input task. I think if you look at the example "Cont Acq&Graph Voltage-Int Clk.vi" from the example finder it will better illustrate what you're doing wrong. You can find it under Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage If you want to continuously check the input you'll need it to be in the while loop as well, and you'll need to set up the timing. 

 

Is task done? - It looks like you want get rid of the while loop and use a "DAQmx Wait Until Done.vi." It will allow the analog generation to finish before the next iteration of the while loop. 

 

Sample Size: Take a look at this Knowledge Base: http://digital.ni.com/public.nsf/allkb/3e3d74e26b8a5b83862575ca0053e4b5?OpenDocument 

 

Hopefully that'll get you started for now

 

 

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 2 of 2
(2,748 Views)