From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder position and case structure

Hi,

 

I am using a motor with encoder on its back. I can run the motor using the visa application and read the current and demand position of the encoder. Now i want to use this position as signal to stop the motor. 

For example in case of any hurdle, the demand position will keep on changing as the motor was running but the encoder postion will not change. So the idea is to use a case structure to comparre the value of encoder over time and when there is no change in encoder position over time (say 10ms) it should stop the motor. But i am not sure how to implement that in labview.

 

Can someone put me in some diretion on how to achieve that. Thanks a lot. 

Message 1 of 6
(4,406 Views)

Basic idea is to use Shift Register which has to hold current position as well as the postion of the encoder before 10ms,

Compare both the postions,If both reamins same just stop the Motor.

 

Just post the code which you hvae tried to help you better from your idea.

 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 6
(4,395 Views)

Hi, 

 

Thanks for the info. I have my code attached. Now the value i am getting is in string format. Do i need to convert them into number? Secondly shift register is used within a while loop so i need to use shift register in the same loop.

 

In the file its the Encoder position which i need to control and connect it to stop profile incase the difference in current and previous encoder postion is +-2. 

0 Kudos
Message 3 of 6
(4,382 Views)

I am getting Missing Sub VI's.....

Try to use state Machine Architecture to avoid confusion and makes the code readable and good practice to follow.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 6
(4,376 Views)

Hi boy,

 

Do i need to convert them into number?

It makes sense to convert to numbers when you want to compare positions - but decide on your own… 😄

 

Secondly shift register is used within a while loop so i need to use shift register in the same loop.

???

There is no shift register in your loop. There are only some feedback nodes…

 

the Encoder position … connect it to stop profile incase the difference in current and previous encoder postion is +-2.

Use a shift register (or feedback node) to store previous encoder position. Then compare current reading with previous and wire the result to your "stop profile" condition…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(4,372 Views)

So after some time i sit again on this problem. With my very basic knowledge of the labview and electronic system i tried to solve the problem. 

In the attached example (alongwith the sub VI'S) i tried to put a shift register in my while loop and try to read the encoder value before and after and try to compare it. So when both the values are equal it shold send a stop signal to the motor.

The problem is encoder position changes so fast that there is no time when there is a difference in value. And thus the motor does not run at all. 

Can somebody help me what i am doing wrong here. Secondly is there any funtion in Labview that checks if the value is changing overtime or not and if not then send the stop signal. 

Thanks for the help in advance

Download All
0 Kudos
Message 6 of 6
(4,305 Views)