Society of Robots - Robot Forum

Software => Software => Topic started by: OperationIvy on March 07, 2009, 06:02:55 PM

Title: Wheel encoders w/ Axon - interrupts?
Post by: OperationIvy on March 07, 2009, 06:02:55 PM
We have a set of wheel encoders that operates by sending a logic edge every 1/32nd of a rotation. How do we detect this edge and increment our odometry count on the Axon? I don't want to get into interrupts in C because I think it's over my head. Is there some sort of IC that will count edges and give some kind of output that we can use? I thought I used a chip that did something like this in a class I took but I can't remember what it was called. If anyone has some insight on how to make a wheel encoder work without interrupts (or if anyone has some help on interrupts!) we would really appreciate it.

Thanks!
Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: superchiku on March 08, 2009, 04:11:48 AM
when encoder reading ===1...incremen a counter....whenthat counter reaches 32...tht means one full revolution has occure reset couner to 0 and calculate distance moved...thats it..
Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: Admin on March 09, 2009, 12:16:55 AM
What is your RPM? Quadrature encoders?

Have you had a look at the encoder source code that comes with AVRlib?
Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: paulstreats on March 09, 2009, 10:54:29 AM
There are IC's available available for wheel encoders like the LS7366 It counts steps and you communicate to it with a 4 pin spi microwire system.

These things are a good way to free up your microcontroller (without them there are too many interrupts and functions called by the interrupts going on to actually do anything useful)
Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: Resilient on May 23, 2009, 09:12:56 PM
There is encoder code in AVRlib? Where?

What is your RPM? Quadrature encoders?

Have you had a look at the encoder source code that comes with AVRlib?
Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: Admin on May 23, 2009, 09:44:55 PM
There is encoder code in AVRlib? Where?
http://www.google.com/search?hl=en&q=avrlib+encoder (http://www.google.com/search?hl=en&q=avrlib+encoder)
Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: Resilient on May 23, 2009, 10:13:42 PM
http://lmgtfy.com/?q=avrlib+encoder (http://lmgtfy.com/?q=avrlib+encoder)  <--- ::)

In that code, interrupts are not disabled before the encoder count is read. Wont this create an error if the count is read at the same time an interrupt is triggered? Is there a way to simply delay the processing of that interrupt till after the encoder count is read?

Disabling the interrupt, reading the value, then enabling it, it would simply ignore any interrupt and your count would be off if you got unlucky, right?

 :-\

Title: Re: Wheel encoders w/ Axon - interrupts?
Post by: Admin on May 23, 2009, 10:22:55 PM
In that code, interrupts are not disabled before the encoder count is read. Wont this create an error if the count is read at the same time an interrupt is triggered? Is there a way to simply delay the processing of that interrupt till after the encoder count is read?

Disabling the interrupt, reading the value, then enabling it, it would simply ignore any interrupt and your count would be off if you got unlucky, right?
In either situation the interrupt would be missed, whether enabled or not. It works on this assumption:

time to read signal after interrupt << time it takes for the next interrupt to trigger

That assumption will always be true on a typical microcontroller . . . unless your robot is going at light speeds . . .