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 ...

// 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

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

# include .....

Hi!!! This is my second blog. Well these days I am very much busy messing around with my Geeky part. So this is to tell you guys that I am gonna be as brief as possible. If you wanna be a little psychedelic and stuff I have waiting for ya.
So now you know how much I am in a desperate need of getting cloned, any ways. Believe it or not some things gotta have a boring beginning , even though you wanna be a smart ass.
Here goes my boring beginning.....
Well I am a computer science student and I have just entered B.Tech Fourth year (hopefully) and my name is Ankit Gupta. Thats it I can't say more. 10 ,9, 8, 7, 6, 5 ,4, 3 ,2 ,1 ignition........

This blog is gonna be all about advance C concepts , graphics and some yummy game development in C language. Oh!! I forgot micro controllers and very soon linux concepts are also gonna be there. Ha ha !! :)