LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quadrature Decoding

Solved!
Go to solution

@GerdW wrote:

Hi Ambrose,

 

did you read the Wikipedia article I linked above? Did you understand the part explaining AB/Quadrature encoders with rotary encoders as example?

 

You need to get the current state of A and B and compare them with their previous state. The tables show you the possible combinations and their meaning (forward/backward movement).

Comparing boolean signals is easy - as shown above. Comparing numeric values is also easy using simple comparision functions!


Here is my vi. I tested already. but the counter din get correct way. If in A lead B mode every rising edge of channel A the counter will count up and if B lead A mode every falling edge of the channel A counter will count down. I testing so many time i still cant get it. 

0 Kudos
Message 11 of 29
(3,032 Views)

Right now I'm limited to LV2014. Can you attach a downconverted version of your VI?

 

If in A lead B mode every rising edge of channel A the counter will count up and if B lead A mode every falling edge of the channel A counter will count down.

You need to attack the problem from the other side (as shown on Wikipedia): you check the current state of A and B and compare with their previous states to decide between "A leads B" or "B leads A" (count up/down)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 29
(3,030 Views)

@GerdW wrote:

Right now I'm limited to LV2014. Can you attach a downconverted version of your VI?

 

If in A lead B mode every rising edge of channel A the counter will count up and if B lead A mode every falling edge of the channel A counter will count down.

You need to attack the problem from the other side (as shown on Wikipedia): you check the current state of A and B and compare with their previous states to decide between "A leads B" or "B leads A" (count up/down)!


Here the vi i downconverted to Labview 2014. Thank you so much.

0 Kudos
Message 13 of 29
(3,026 Views)
Solution
Accepted by Ambrose1464

Hi Ambrose,

see this:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 29
(3,016 Views)

@GerdW wrote:

Hi Ambrose,

see this:

check.png


I still confusing what you mean PI=3 and CI=2 then count down??? the control a and b is it same as my vi after first case structure output a and b? 

0 Kudos
Message 15 of 29
(3,009 Views)

@GerdW wrote:

Hi Ambrose,

see this:

check.png


Hi GerdW, Thank you so much for your helping a lot. Finally I understand what you say PI=3 and CI=2. I get the result I want d. I'm appreciated it.

0 Kudos
Message 16 of 29
(3,018 Views)

How i going to compare the A lead B and B lead A ? If A lead B will go to rising edge case then counter count up and B lead A will go to falling edge case then counter count down. Here is my vi below. Once I build thealgorithm the counter will count up and down together. 

0 Kudos
Message 17 of 29
(3,007 Views)

Hi Ambrose,

 

yesterday you got the result, today you ask again?

And why did you create a new thread on the same topic? Please stick with one thread per problem…

 

You don't need to check for rising/falling edges. All you need to compare is state of AB with their previous state!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 29
(2,994 Views)

According my vi, i directly make it true or false (mode control) statement for comparison, i found that did not compare the signal A and B by itself. That why I ask again. 

0 Kudos
Message 19 of 29
(2,986 Views)

It's again a LV2015 VI. Please upload a downconverted version…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 20 of 29
(2,983 Views)