SHENZHEN I/O

SHENZHEN I/O

Nedostatek hodnocení
4 PHASE ROTARY ENCODER POSTION TRACKER
   
Ocenit
Přidat do oblíbených
Oblíbeno
Odebrat z oblíbených
Velikost souboru
Přidáno
Aktualizováno
8.704 KB
12. dub. 2017 v 16.08
14. dub. 2017 v 7.05
Poznámky ke změnám (2) – zobrazit

Klikněte na „Odebírat“ pro stažení položky
4 PHASE ROTARY ENCODER POSTION TRACKER

Popis
Nice little real-world problem to solve. Can you successfully track position from a couple of square waves?
Počet komentářů: 6
Xenofix 15. čvc. 2020 v 9.34 
cirdec 15. čvc. 2020 v 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. čvc. 2020 v 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  [autor] 26. lis. 2019 v 2.54 
Really?!?! Can we have a screenshot?
Xenofix 25. lis. 2019 v 13.49 
Really nice puzzle. I've found a solution with only 5 lines of code!
Skyfather  [autor] 13. dub. 2017 v 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.