Pages: [1]   Go Down
Author Topic: Sensor RPM without Interrupts  (Read 993 times)
0 Members and 1 Guest are viewing this topic.
Colombia
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Entrepeneur
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi... I'm working a week ago with Arduino, and I am implementing a speed sensor for 4 bicycles to send the signal to Adobe Flash and connect to a game .... The Atmega328 has only 2 External Interrupts and I need 4, so I'm trying to implement Polling ... the maximum frequency for receiving data from a single cycle is 50Hz (20ms) ... the question is: Polling is feasible to work with these speeds, or I will get the Arduino Mega has 6 external interrupts? hehe ... Thank you very much if anyone can help me with this...
Logged

Diego M Toro

Maryland, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Be aware the atmega328 has the ability to set its other pins as interrupts, called the "PCINT" interrupt system I think... I've read somewhere that somebody wrote a library to use these, but I don't have the link off hand.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pin change interrupts indeed

you need to read this - http://arduino.cc/playground/Main/PinChangeInt -
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,

I didn't write the pinchangeint library or contribute in anyway but here is a write up on the library -

http://rcarduino.blogspot.com/2012/03/need-more-interrupts-to-read-more.html

And an example of using it to read multiple signals which you could adapt to your application

http://rcarduino.blogspot.com/2012/04/how-to-read-multiple-rc-channels-draft.html

Duane B
rcarduino.blogspot.com


rcarduino.blogspot.com
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 504
Posts: 19105
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For fastest response for pin change interrupts (especially if you only need another two) choose pins on different "groups". (eg. PINB and PINC).

Then you can configure an interrupt handler for each one with minimal testing needed as to exactly which pin caused the interrupt.

More info here:

http://www.gammon.com.au/interrupts
Logged


Colombia
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Entrepeneur
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Thanks everybody... I have been reading the links you sent me and I'm trying to make a 'fusion' of all the info ... this weekend I will work hard and tell them how I was ... (write in English is still difficult for me, and I translate some things on google, but I hope you mean, lol)
Logged

Diego M Toro

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


We understand it perfectly (otherwise we will just ask)
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: