LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure and motor control on the same time

Hello Guys!

 

I make a friction measure program. It gives the value of the degree the inclane when it is arrives to the first optical sensor. In the second step of the program the first optical sensors high value start the measure of the time and the second optical sensor high value give the elapsed time between this 2 high signal. After that on the 2 next step I'm reading the details. I measure the kinetic and the static friction as well. I have a problem that I want to up the inclnae with a motor between limit switches and with a next motor i want to pull back the thing that i am slip on the inclane. I write a "basic program" the basic program contains the basic measure and the other one which is contain a " motor control" but when i control the motor in a desparete step the program doesnt measure the degree and the elapsed time and dont fill the arrays. Can someone tell me how can I control the motor in the same time and measure my parameters?

0 Kudos
Message 1 of 14
(2,760 Views)

Hello Guys!

 

I make a friction measure program. It gives the value of the degree the inclane when it is arrives to the first optical sensor. In the second step of the program the first optical sensors high value start the measure of the time and the second optical sensor high value give the elapsed time between this 2 high signal. After that on the 2 next step I'm reading the details. I measure the kinetic and the static friction as well. I have a problem that I want to up the inclnae with a motor between limit switches and with a next motor i want to pull back the thing that i am slip on the inclane. I write a "basic program" the basic program contains the basic measure and the other one which is contain a " motor control" but when i control the motor in a desparete step the program doesnt measure the degree and the elapsed time and dont fill the arrays. Can someone tell me how can I control the motor in the same time and measure my parameters?

0 Kudos
Message 2 of 14
(2,765 Views)

Please resave your VI's.  I can't open them in LabVIEW and I believe it is because you have non-English characters in the filenames.

0 Kudos
Message 3 of 14
(2,724 Views)

1- remove the stack sequence that you put

2- reduce the screen size so we can see all the code in one page or scroll only on one direction.

3- use error bus to synchronize your task.

4- do a proper error management.

Benoit

0 Kudos
Message 4 of 14
(2,714 Views)

Hi Greg,

 

never use non-English chars in filenames, it's just annoying for other people (using default English Windows installations)!

@RavensFan: just rename the files…

 

To add to other comments:

- Don't use DAQmx tasks in parallel: why do you need to read "USB6001 D1" in several loops?

- Use proper programming schemes like state machines or producer-consumer!

- Use less local variables! (Example: why are there 3 locals of "Le" in the first frame of that big sequence? None is needed!

- Don't read single points from DAQmx in loops without any timing: this will just burn CPU power!

- Why are there empty frames in the sequence? Why is there a sequence at all?

- Why do you write data to a file, just to read that file and use those data?

- Why do you use some much duplicated code in the last frame?

- Why do you AND with TRUE? Rube-Goldberg!

- Why do you create an array with just one element, just to index that one element? Rube-Goldberg! (We had discussed that already!)

- When you attach code you should also attach all subVIs. ZIP your project folder!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 14
(2,704 Views)

Hello guys!

 

I would like to control a motor between two limit switches with a simple state machine. But it would not want to work for me. Can someone help with some advice? I am make it in LabVIEW 2016.

0 Kudos
Message 6 of 14
(2,733 Views)

Hi Greg,

 

there should be no while loops inside the state cases!

check.png

Why do you need all those local variables?

 

Add a wait function to your loop to prevent CPU burning!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 14
(2,732 Views)

Thank you very much for your help!!!

0 Kudos
Message 8 of 14
(2,716 Views)

I have a further problem. I have a measurement part of my VI and the motor control and the measure doesnt work at the same time. So I can not measure and control the motor at the same time because I just can measure my parameters but the motor control does not change when it is arrives to the limit switch. How can I solve this problem?

0 Kudos
Message 9 of 14
(2,705 Views)

Hi Greg,

 

I have a further problem.

Yes: you didn't follow my request not to use non-English chars in your filenames.

You still don't supply subVIs! And you don't use auto-cleanup…

 

I have a measurement part of my VI and the motor control and the measure doesnt work at the same time.

Again you placed while loops in your state machine.Place your state machine in its own while loop in parallel to your other code parts

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 14
(2,701 Views)