Interrupt Structure of ATmega328

[quote author=Coding Badly link=msg=3377479 date=1502806180]
Excellent! I am glad to know that your next action will be correcting your mistakes so you can reach to a very high level of perfection![/quote]

Mistakes can only be corrected if someone generously points to it! Where shall we get such a generous man? Everybody is perfect here except me! A perfect man always sees everything in a perfect way. So, there will be none, at least as a part of argument, to notice my mistakes; there will be no chance for me even to become a good man; never mind about perfection!!

This is Education and Teaching Section. I have to deal with tens of pupils who are individually using Arduino UNO Kits for their course works. The pupils desire that I prepare and post the class lectures in the Education and Teaching Section of the Forum so that they can read it online and down load it.

You are trying to teach beginning Arduino students about external interrupts. I think that re-enabling interrupts within the isr so as to use delay() is not a good approach. I think you would be far better to hammer home the message to keep the isr short and fast and don't call functions which rely on interrupts being enabled.

Why not set a flag and execute the function in loop() with blink without delay. Teaching the use of flag setting in an ISR is a valuable lesson.

You may believe differently, but when you see all the broken ISR's posted on this forum, and posters asking for help it leads me to be skeptical of your approach.

cattledog:
[...] Why not set a flag and execute the function in loop() with blink without delay. Teaching the use of flag setting in an ISR is a valuable lesson.

You may believe differently, but when you see all the broken ISR's posted on this forum, and posters asking for help it leads me to be skeptical of your approach.

Thanks for the valuable comment. I have noted it down.

Yes! Blink without delay would be an excellent approach to keep the ISR short.

//----------------------------------------------------------------------------------------------------------
Let me share with the readers my experiences of teaching interrupt (or any other) concepts with the senior level graduate students of Electrical Engineering:

(1) As a faculty, one has to prepare a working experiment that gives a visible result, and the experiment should be reproduceable. The faculty makes the experiment in accordance with his level of understanding of the subject matter and the practical experience.

(2) The faculty must prepare the step-by-step procedures of the experiment so that each and every student can reproduce the result just by following the steps.

(3) The faculty goes into interactive section with the pupils to review the theoretical and the setup aspects of the experiments.

(4) The pupils are again asked to repeat the experiment and justify the necessity of the steps as have been laid down in the experiment.

(5) The students are now allowed to search in the web or among themselves to look for alternative or better ways of doing the experiment.

(6 In 3x50 minutes class, the faculty and the students (a few of good quality) have time to play around with the experiment. The advantage is that the students have their own (purchased) Arduino UNO Learning Kits.

(7) My understanding is: These are Electrical Engineering level students. They don't have wide exposure to programming arena like the CSE students. Very often, we need to go to assembly level to make them understand what is going on at the register/memory level of the MCU.

//-----------------------------------------------------------------------------------------------------------

GolamMostafa:
And the pupils are happy to correct the code themselves, after downloading it?
Ans: Ask the pupils.

I don't KNOW any of YOUR students.

Do you pre-warn them that it won't compile, and then won't work, even when the syntactic errors are fixed?
Ans: The question should come from the pupils/Evaluation Committee.

No, the question came from me.

Is this part of the teaching process?
Ans: The question again should come from the Evaluation Committe.

Again, you're not following - the question came from me (also sp. "committee")

Doesn't your faculty have its own website?
Ans: No need! The faculty and the pupils have paid hundreds of dollars for the Arduino Learning Kits. It is their rights and not the privileges to enjoy all the available resources of the Forum subject to the compliance of the rules of the Forum.

Over years, I've spent many tens of thousands of pounds at Shell and Esso, but they don't allow me to flog my goods at their outlets. Why is that? Aren't they required to grant me some sort of squatters' rights at their filling stations?

I wish to expose a visible and simple result in the ISR to demonstrate that the MCU has, in fact, gone to the ISR by suspending the Main Line Program.

You've written an ISR - what more obvious illustration is there that you're in an ISR?

AWOL:
Over years, I've spent many tens of thousands of pounds at Shell and Esso, but they don't allow me to flog my goods at their outlets. Why is that? Aren't they required to grant me some sort of squatters' rights at their filling stations?

OK! You have given your decision finally!

GolamMostafa:
OK! You have given your decision finally!

No, I posted a simplistic parable.

GolamMostafa:
Have you compiled the program? Have you seen any errors?

Yes I did and it worked. When I was reading for the first time, I didn't see that interrupts() function was used. Silly me. Thanks a lot.

Today at 06:26 pm to 06:28 pm

2 minutes!

Speed of Light = 1, 86, 000 miles/sec

Speed of human mind!

Limit of elasticity???

AWOL:
I don't KNOW any of YOUR students.

I'm one of his students and yes. We find these very helpful.

urmil123:
I'm one of his students and yes. We find these very helpful.

I'd kinda guessed that from your IP address.

I'll repeat - I don't KNOW any of YOUR students.

GolamMostafa:
Today at 06:26 pm to 06:28 pm

2 minutes!

Speed of Light = 1, 86, 000 miles/sec

Speed of human mind!

Limit of elasticity???

As a student, do you understand this post? Do you find it useful?

AWOL:
No, I posted a simplistic parable.

How could a gasoline filling station be compared with a Forum where hundreds of veterans are spending their times to promote education voluntarily?

I've picked up some of my best car maintenance tips on garage forecourts.
Saved me a ton of money.
(I spent the first eleven years of my life living next door to a garage and filling station)

AWOL:
As a student, do you understand this post? Do you find it useful?

You should be able to understand. This is the time gap between your two posts that carry 'decision making ingredients.'

I literally only understand about 30% of what you post.

Whew! I'm glad it is not just me.

GolamMostafa:
I have attached the original file and also has typed it in the code box. It is a good practice that we use the attached file rather than the typed file which might have typographical errors.

An even better practice would be to ctrl-A, ctrl-C and ctrl-V from the IDE into the post.

kenwood120s:
An even better practice would be to ctrl-A, ctrl-C and ctrl-V from the IDE into the post.

If you are writing British English, I have no objection in the formatting of the sentence quoted above.

If you are writing American English, I demand that you (please) put a comma (,) after the second item of the sentence quoted above.

Thanks,

BTW: You have seen the turmoil that went over me just for the V in the void. My Void was not in the IDE; it was on a piece of paper, and that was considered as a part of program. I did not get support from any body from any corner. The game went on in 3:1, and it ultimately ended in 1:1.

Not sure what a piece of paper has to do with it. You obviously had "void" in the IDE, and all I was saying was that instead of re-typing the code into the thread and making the "Void" error, you could just have copy/pasted from the IDE and saved yourself a heap of cr@p.

GolamMostafa:
The game went on in 3:1, and it ultimately ended in 1:1.

I haven't the foggiest idea what that means.