04-16-2012 05:42 PM
Hello everybody,
first of all i have DAQmx 6212, and i need to run a small water pump (9V-16V) which needs to be driven by a PWM signal; also i have a motor (5V-13V) for a water valve that needs to be driven by a analog signal and it has a built in a force feedback potentiometer, i connected on the extremeties of this potentiometer +5V from the DAQmx and used the output voltage from the third extremety as a diagnose value for knowing the position of the motor.
my VI shows:
1. is a normal Counter output to create my PWMout signal.
2. is an analog input i use it as a PWMin to the LabVIEW to diagnose what is happenning in my water pump through the duty cycle and the frequency.
3. is an analog input from the third extremety of the potentiometer.
4. is an analog output which i have used as a power supply for the motor valve and i have used an AC/DC amplifier to aplify the signal from the DAQmx and drive the motor, between (3. and 4.) i have made a feedback with some calculations i had a P-controller to know the actual position of the motor valve.
My Problem:
when putting 1. and 2. in the same VI alone, i am getting a clean PWM in/out with no problems mentioned;
also when putting 3. and 4. in the same VI alone i can control the motor valve without any problems;
but when i put all these 4 together as found in the attached VI, i have a problem that the motor valve is running continously without stopping even if i change the valve position between 0 and 100 %, i should mention that i am seeing a normal PWM out/in signal on my oscilloscope, one other thing that if i delete one of (1. or 2.) and run the VI the motor valve is working fine without any problems.
so this my problem, if you can think of any solution please let me know.
thanks in advance for your help.
Regards,
Alosh
Solved! Go to Solution.
04-16-2012 06:27 PM
I don't think this explains the problem, but you are missing a wire connecting the "Continuous Samples" constant to the Counter Timing.
Am I correctly understanding that the problem is that you are constantly writing some non-zero value to the analog output?
Do any of the DAQ functions generate an error? Have you probed the error wires? Also, put an indicator or probe on the value that you are writing to the analog output and confirm that when you change the front panel control, you're getting the expected value.
Why are you reading multiple samples when you only want one? Instead of taking continuous samples, consider just reading a single sample on each loop cycle.
04-17-2012 10:45 AM
Dear nathand thanks for your reply,
i have ran the vi again and i am have error no 50103 from the (AI, number 3. ) but it is not displaying the error message, the VI keeps running without any error notification.
adding to that, i have tested the VI again today by placing (1. and 2.for the PWM inout) together in one VI and (3. and 4.for the motor valve) in another VI and ran them one after the other, i had another problem. if i turn the motor valve vi, the motor will run smoothly but in the pwm vi i will have a problem in which the AI did not read any value. also doing this vice versa by running the pwm vi first it will work perfect but the motor vi will have problem in reading the measured voltage in AI during this the motor will keep on running without stopping.
so i think now the problem is in AI (2. and 3.) readings they are interfering on each other but i am not discovering where is my problem...
Q: does the AI's seems well build or i can do it in an another way so to get over the interfering?
Regards,
Alosh
04-17-2012 12:54 PM
Combine both AI reads into a single task. There's only a single sample clock for the board, so trying to configure two different continuous AI tasks may cause an error (even though, in this case, the sampling frequency is the same).
04-17-2012 01:48 PM
hallo again,
i did not get what you mean exactly.
can you please give me an example what do you mean or modify my VI to do what are you saying?
Regards
04-17-2012 02:08 PM
Here's your VI, modified slightly so that both analog input channels are part of the same task. This if for illustration purposes only, I have not tested it. You may still need to do some debugging.
While modifying your VI I noticed another potential problem with your original setup. You configured both AI tasks for the same frequency, but you read 10000 samples from one of them and only 100 samples from the other (and then discard most of it). Data from the DAQ is buffered, and if you do not read as fast as you acquire, the buffer will eventually fill. If you're reading 10,000 samples from one channel, and the other channel is acquiring at the same rate, then when you read from the second channel you'll get old stale data or a buffer full error.
04-17-2012 02:25 PM
OK, thanks for the reply i will try to test your idea tomorrow.
04-23-2012 08:54 AM
i just wanted to tell you everything went fine and it is working now after some tuning.
thank you very much for your help.