Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] Two motor encoder code for avr

Status
Not open for further replies.

ANS HAFEEZ

Advanced Member level 4
Joined
Jul 25, 2013
Messages
101
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Location
LAHORE,PAKISTAN
Activity points
1,911
SALAM TO ALL;
I m using this motor

https://www.pololu.com/product/1446

and want to interface TWO motors encoders with ATMEGA32 and confuse about writting code DO i need INT0 and INT1 pin of atmega32 and which encoder output i have to use OUTPUT A or OUTPUT B of motor encoder
 


I would use interrupts which sense change of level of the signal
 

Do you think TO use both intrupts simultaneously can cause a error in reading the Two encoders???

so long as you keep the interrupt service routines short (e.g. increment a counter and acknowledge the interrupt) I don't see why there should be problems
 

I m getting problem in simulation only INT0 works but if there is no intrupt on pin INT0 then INT1 works
 

I m getting problem in simulation only INT0 works but if there is no intrupt on pin INT0 then INT1 works
I have not used AVRs for some time but it sounds as though you may be getting continuous INT0 interrupts
what are you interrupting on? edge, level ?
perhaps you are not clearling the INT0 interrupt in the interrupt service routine ?

how good is the AVR simulator at handeling interrupts?
I always use real hardware for testing such things
 

The problem is continous intruppts on pin INT0 from motor encoder
i think i should use GIO pin to count the encoders reading
 

I believe it's a coding problem. Both interrupts should be programmed for "Any logical change on INTx generates an interrupt request", or alternatively rising or falling edge only.

You should have an idea about the expectable encoder pulse rate.
 

I believe it's a coding problem. Both interrupts should be programmed for "Any logical change on INTx generates an interrupt request", or alternatively rising or falling edge only.

You should have an idea about the expectable encoder pulse rate.

yup i check the motor encoder output from oscilloscope its about 2.85Khz for each encoder
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top