SHENZHEN I/O

SHENZHEN I/O

Not enough ratings
4 PHASE ROTARY ENCODER POSTION TRACKER
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
8.704 KB
12 Apr, 2017 @ 4:08pm
14 Apr, 2017 @ 7:05am
2 Change Notes ( view )

Subscribe to download
4 PHASE ROTARY ENCODER POSTION TRACKER

Description
Nice little real-world problem to solve. Can you successfully track position from a couple of square waves?
6 Comments
Xenofix 15 Jul, 2020 @ 9:34am 
cirdec 15 Jul, 2020 @ 2:37am 
No, it's just gen p0 0 1 to get the edges correct to do it in 5 lines of code/
cirdec 15 Jul, 2020 @ 2:26am 
I did it in 6 lines of code. It could be reduced to 5 by PGA edge detecting the set/reset signal from a gen p0 1 0 instead of gen p0 0 0; slp 1 https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2166755298
Skyfather  [author] 26 Nov, 2019 @ 2:54am 
Really?!?! Can we have a screenshot?
Xenofix 25 Nov, 2019 @ 1:49pm 
Really nice puzzle. I've found a solution with only 5 lines of code!
Skyfather  [author] 13 Apr, 2017 @ 7:35pm 
Proposed update for the explanatory text in-game. Comments welcome.

* A and B are Simple inputs connected to an incremental rotary encoder attached to a rotating shaft.
* Position is an XBus output used to transmit position, which has a valid range of -999 to +999.
* The rotary encoder produces square-waves, were 1 complete wave (peak-to-peak) equates to one shaft revolution.
* The A and B signals are 1/4 out-of-phase, i.e. if the shaft rotates clockwise, the A wave will proceed the B wave. For anti-clockwise rotation, the B wave will proceed the A wave. If the shaft is stationary, the states of A and B will remain constant with time.
* One quarter-turn of the shaft equates to a change in position of 1.
* The verification tab may help to visualise the problem. For this test case, the shaft is first rotated clockwise for 5 turns, and then anti-clockwise for 5 turns.