Jump to content
43oh

Interface push button rotary encoder on 1 analog input


Recommended Posts

  It works pretty well except for an occasional reverse tick but that's probably a flaw in my code.

 

The reverse ticks might be due to a "blocking" part of your code when it calls "begin_lcd_write". (Blocking probably isn't the right word.)

But while your main loop is inside this function it could miss an update from the ISR. I'm probably wrong. Just a thought.

 

I've found whenever I used rotary encoders I had to proccess the transitions quickly because there was a fair amount of phantom transitions, I was probably using very cheap rotary encoders too.

Link to post
Share on other sites

begin_lcd_write() just buffers data and initializes the TA0.1 IE.

The LCD data are clocked in the timer interrupt handler so there really isn't any blocking.

 

I think an improvement would be to supersample 8 times, average and then use the change in value as a determination of how far the encoder turned, rather than only comparing discrete levels.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...