Threaded View
-
07-07-2023 #3
Not sure that it's quite that easy! If you look at the data patterns there is no simple link between either data line and direction. And if you only interrupt on one data line, you will miss half the transitions.
How about writing your interrupt code to read both data inputs and work out whether to increment or decrement an internal counter based on comparing current with previous state. Then set up "interrupt on change of state" on both input lines linked to same interrupt routine. The principle of quadrature inputs means that only one data line changes at a time so you should be able to handle one interrupt before the next arrives. How fast can a user turn the encoder knob?
I need to do something similar for a device that currently uses a pot delivering an analogue input to an ADC input on an Arduino but my main processing loop is so fast (compared with rate at which data changes could happen) that I am planning to just use polling of the data lines. I need to do this because the pot is a bit noisy and my soldering iron temperature keeps jumping about...
Thread Information
Users Browsing this Thread
There are currently 7 users browsing this thread. (0 members and 7 guests)
Similar Threads
-
Spindle pulses on shutting down.
By John11668 in forum General ElectronicsReplies: 6Last Post: 22-08-2020, 11:45 AM -
Basic 540 CNC. Motors skipping pulses?
By Skydeals in forum General ElectronicsReplies: 3Last Post: 18-10-2014, 06:56 PM -
Do you make stuff with knobs on?
By D.C. in forum General ElectronicsReplies: 1Last Post: 20-02-2013, 11:04 PM -
servo control vs stepper control
By Peter. in forum Motor Drivers & ControllersReplies: 24Last Post: 17-09-2012, 08:36 AM -
G-Code into stepper driver pulses?
By HankMcSpank in forum Computer SoftwareReplies: 5Last Post: 09-01-2010, 12:55 PM
Bookmarks