Hi,
Im new to Arduino Leonardo,
Im doing a program regarding a card reader,I have added a timer interrupts in order to execute these interrupts within my desired time intervals when the card batch in,so when i include these avr/interrupt.h,it managed to verify and successfully uploaded ,but my Timer Interrupts doesn't read in that program,why im saying this is because when i removed my Timer Interrupts , my program still run successfully,it means that my Timer interrupts is just being there with no function,so i decided to check into arduino ide by looking into arduino/hardware/tools/avr/avr/include/avr , to check whether interrupt files are there,yes its there,but why my interrupts its not functioning. Pleaseeee Help me..
Please supply your code in its own window as seen in other posts. This can be done by placing
[code] and [/code]
around the code. This makes it easier for others to read.
void ISR_INT0()
{
Serial.print("0");
What is wrong with this picture?
(This is just a partial answer)
Do NOT use Serial.print() in an ISR because it needs interrupts to work, but interrupts are OFF. As well as which it is a slow function and your ISR should be as fast as possible.
Have you written a very simple program to enable you to learn about programming interrupts ?
The answer should not be NO
Why do you need interrupts to mange your timing? What would be wrong with using millis() as illustrated in several things at a time.
Always post a complete program that people can compile on their own Arduino.
...R
That code simply attempts to count the number of zeros and ones recieved, which is insufficient anyway. Post all your code and a wiring diagram of how you have connected things up.
On your keyboard is a full stop or period. At the end of each sentence you press it. Then you press the space bar and then before you start to type the next word you hold the shift key down. This makes words a hell of a lot easier to read.
Robin & Awol:
The reason of putting the serial.print under ISR is to display to bit,(just to experiment on the bit counting) but as what you have told,ill just double slash it before the serial.print or avoid it totally.
Sorry for the mistakes in the programming,since a beginner i need to learn alot.
The reason of adding the timer interrupt is because when i batch the card,its displaying 27 bit most of the time instead of 26 bit).I taught timer interrupt will be suitable to add into the programming so that i can get the exact 26 bit read.(using the prescaler calculations) as shown in these example:
Any ideas on that???
Grumpy_mike:
I will attached my programming soon when i have finished corrected some minor errors and the typo
Thanks alot guys for your help and comments
pravinah:
The reason of adding the timer interrupt is because when i batch the card,its displaying 27 bit most of the time instead of 26 bit).I taught timer interrupt will be suitable to add into the programming so that i can get the exact 26 bit read.(using the prescaler calculations) as shown in these example:
I can't make any sense of that.
You are making the common error of assuming I know the same stuff about your project that you know.
You must write descriptions and explanations on the basis that we know nothing about your project.
...R
http://www.instructables.com/id/Arduino-Timer-Interrupts/?ALLSTEPS
Any ideas on that???
You do not need timer interrupts for your project, just forget it.
From what I can tell from the code you are triggering the interrupts off the two interrupt pins ( these should be pins 2 & 3 not 0 & 1 as some beginners mistaken use. )