[sdiy] [SOLVED] Need goog working rotary encoder in C code..
jpdesroc at oricom.ca
Sat Aug 7 23:46:57 CEST 2021
I found my problem (I think).
No interrupts for this job.
The following polling code works very well.
////////// read rotary encoder here /////////////
currentStateCLK = ROTARY_B;
if (currentStateCLK != lastStateCLK && currentStateCLK == 1)
if (ROTARY_A != currentStateCLK)
// currentDir ="CCW";
// Encoder is rotating CW so increment
// Remember last CLK state
lastStateCLK = currentStateCLK;
Now everything works well even with a 1msec interrupt on TIMER1.
Blinking a variable every 200 interrupts.
When the encoder moves it bilnks the choice on an LCD
at a rate of 1/(2x200msec) => 2,5Hz rate.
When the encoder's push button is pressed
change is then accepted and the display stops blinking.
Polling the encoder's A & B pins. No encoder missed counts so far..
THANK YOU FOR YOU ALL !
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Synth-diy