[sdiy] Need goog working rotary encoder in C code..

John Speth johnspeth at yahoo.com
Sat Aug 7 09:05:44 CEST 2021


On 8/6/2021 12:35 PM, Jean-Pierre Desrochers wrote:
>
> Here is what I’m trying so far..
>
(snipped code)

That's a good try. It shows you basically understand the interface and 
operational requirements of the devices you are using. However, your 
firmware system design skills are not advanced enough to get the system 
working. How could you fix that? A lot of experimentation, research, 
thoughtful examination of code and methods, etc.

You can start fixing it by asking yourself why you'd ever want to 
intentionally delay in an ISR. (Answer: You never want to.) Your delays 
are implemented in your uses of "while" and "__delay_ms" in the ISR. 
It's no wonder you're missing edges.

JJS

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20210807/5bcaf5a4/attachment.htm>


More information about the Synth-diy mailing list