Re: Atmel Avr, n-coder`s ticks counting

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

Quoted text here. Click to load it

As far as I know, when the counters are in "counting" mode, they will
only count up. In PWM mode they do count in both directions but only in
response to reaching an upper or lower count limit.

[snip...snip...]
Quoted text here. Click to load it

Only recommendation is to ensure that you have taken precautions
regarding the case where the encoder stops right over an edge and fires
off constant interrupts. Possibly a hysteresis setup (which may be
already built into the encoder) or, instead of firing an interrupt on an
encoder event, run a tight timing loop and read the A-B conditions as
inputs to a state machine.

--
Rich Webb   Norfolk, VA

Re: Atmel Avr, n-coder`s ticks counting
Hi Trix,
in order to decode a quadrature encoder, you can put the A channel
on the interrupt line, when you you get an interrupt on asy the negative
edge
you can read the B input to see what the direction of the encoder was.
Schematically:
St  012345
A   011001
B   110011
When you go from state 2 to 3, A causes the interrupt, and B is 0,
that's one direction.
When on the other end you go the other way, say from state 1 to 0,
A causes the interrupt, and B is 1.

Cheers, Rik Assen.
rik AT embeddedsystemconsult DOT nl
(change AT to @ and DOT to .)




Site Timeline