SHENZHEN I/O

SHENZHEN I/O

Ei tarpeeksi arvosteluja
4 PHASE ROTARY ENCODER POSTION TRACKER
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Tiedostokoko
Julkaistu
Päivitetty
8.704 KB
12.4.2017 klo 16.08
14.4.2017 klo 7.05
2 muutosilmoitusta ( näytä )

Tilaa ladataksesi
4 PHASE ROTARY ENCODER POSTION TRACKER

Kuvaus
Nice little real-world problem to solve. Can you successfully track position from a couple of square waves?
6 kommenttia
Xenofix 15.7.2020 klo 9.34 
cirdec 15.7.2020 klo 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.7.2020 klo 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  [tekijä] 26.11.2019 klo 2.54 
Really?!?! Can we have a screenshot?
Xenofix 25.11.2019 klo 13.49 
Really nice puzzle. I've found a solution with only 5 lines of code!
Skyfather  [tekijä] 13.4.2017 klo 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.