LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from two counter - encoder inputs simultaneously

Hi everyone, I am designing a PID controller for a mass-spring damper system and would like to measure the position of two carts using two encoders simultaneously with LabView. I currently have just one encoder reading the position. Here is my block diagram:

 

pidonecart.jpg

 

I have looked at tutorials where it tells me to use a sample clock before the task start but it doesn't seem to have helped.

 

I would appreciate any advice. Thank you very much!

0 Kudos
Message 1 of 4
(2,839 Views)

Hi so1id, you should check that Stop Task.vi It seems to be behind the while loop.

 

And maybe explain better what is the problem that you're having

0 Kudos
Message 2 of 4
(2,809 Views)

Thanks for the reply! My problem is that I am not making a correct task to get the position values from the second encoder while the first one is running. The output to the graph is not shown correctly which leads me to believe that I could not just copy and paste the same code from the first encoder.

 

Is there a specific way of creating a task for the second encoder that someone can help me out with? I want to simply output the position values from the first and second encoders to two separate graphs simultaneously while I run the PID controller.

 

Thanks!

0 Kudos
Message 3 of 4
(2,797 Views)
In addition to fixing the two stop tasks that seem to be floating over the loop, you need to dramatically cleanup the block diagram. Try clicking the diagram cleanup button on the diagram toolbar.

Why are you reading the counter as a float?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,786 Views)