SHENZHEN I/O

SHENZHEN I/O

评价数不足
4 PHASE ROTARY ENCODER POSTION TRACKER
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
8.704 KB
2017 年 4 月 12 日 下午 4:08
2017 年 4 月 14 日 上午 7:05
2 项改动说明 ( 查看 )

订阅以下载
4 PHASE ROTARY ENCODER POSTION TRACKER

描述
Nice little real-world problem to solve. Can you successfully track position from a couple of square waves?
7 条留言
Xenofix 2020 年 7 月 15 日 上午 9:34 
cirdec 2020 年 7 月 15 日 上午 2:37 
No, it's just gen p0 0 1 to get the edges correct to do it in 5 lines of code/
cirdec 2020 年 7 月 15 日 上午 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://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=2166755298
Skyfather  [作者] 2019 年 11 月 26 日 上午 2:54 
Really?!?! Can we have a screenshot?
Xenofix 2019 年 11 月 25 日 下午 1:49 
Really nice puzzle. I've found a solution with only 5 lines of code!
Skyfather  [作者] 2017 年 4 月 13 日 下午 7: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.