LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when combinning PWM signal and Analog signal TOGETHER!

Solved!
Go to solution

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

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

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.

 

 

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

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

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

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).

0 Kudos
Message 4 of 8
(3,730 Views)

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

0 Kudos
Message 5 of 8
(3,722 Views)
Solution
Accepted by topic author alosh

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.

Message 6 of 8
(3,715 Views)

OK, thanks for the reply i will try to test your idea tomorrow.

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

i just wanted to tell you everything went fine and it is working now after some tuning.

 

thank you very much for your help.

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