Thursday, July 8, 2010
Interrupt is not your enemy.
Put your self in a situation where you want to write a Helicopter stimulation software. So what can be the possible problems when you actually program it on a micro controller or if you compile a stimulation game on your pc.
Every one knows for a software to be a software there has to be a ever running while loop. It depends upon the complexity of your code and obviously your intelligence how many lines of code are there inside your S/W's soul while(1) loop. Let us consider,that you have written this game for your pc. So what happens when the enemy bots are attacking you and even fraction of a second matters. You gotta shoot em up Rambo and it has to be real quick ,accurate and precise.
You aim, you sit tight press the button. But Snap!! You are on the ground, a bot has just shot you even though you pressed the button but the bullets went off with some delay, due to this you are screwed. Now you have known that your game is not real time ........
what happens here is ...
while(1)
{
// consider your self in this while loop and it has hundreds of line of code
it is going_________________
and going
and when you press the button a fire function is called which is some where
here
fire();
and you press the button here some where here in the loop
but your loop is long so the processor has to process, hundreds of line of code still to follow. Even if its a 12 GHz processor there will be a latency causing you a lot.
}// end while
So what will you do buy The super computer Jaguar for yourself. Believe me you'd be nuts to do so. YOU JUST HAVE TO DO SOME INTERRUPT PROGRAMMING DUDE relax. here is what happens when when you configure interrupts for any real time stimulation.
Any time a hardware interrupt is generated when you press any key. If you have configured
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment