- 打卡等级:初来乍到
- 打卡总天数:4
- 最近打卡:2025-05-01 06:58:22
金牌会员
- 积分
- 1335
|
发表于 2023-5-17 16:53:43
|
显示全部楼层
本帖最后由 jmg 于 2023-5-17 17:02 编辑
but my encoder triggers at about 3kHz,
Do you need to count every edge, or are you ok with one count every 4 edges ?
If one count every 4 edges is ok, you can edge interrupt on one Quad line, and check the other line for direction information.
If you need to count every edge, it looks like INT0 and INT1 can react to both edges, so using two interrupts enabled for both edges (_/= and =\_ ) interrupts can use a table or state engine to react on every edge.
So can the counter be triggered to rise when it is used as an external trigger as the counting source?
You need UP/DOWN for a quad encoder, and the STC8 timers are all UP only, so a software counter is needed, the hardware counters cannot be used. |
|