SHENZHEN I/O

SHENZHEN I/O

4 PHASE ROTARY ENCODER POSTION TRACKER
6 kommentarer
Xenofix 15. juli 2020 kl. 9:34 
cirdec 15. juli 2020 kl. 2:37 
No, it's just gen p0 0 1 to get the edges correct to do it in 5 lines of code/
cirdec 15. juli 2020 kl. 2:26 
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  [ophavsmand] 26. nov. 2019 kl. 2:54 
Really?!?! Can we have a screenshot?
Xenofix 25. nov. 2019 kl. 13:49 
Really nice puzzle. I've found a solution with only 5 lines of code!
Skyfather  [ophavsmand] 13. apr. 2017 kl. 19:35 
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.