KhaledOsmani
Full Member level 6
Khaled;
what you are proposing is called "polling".
Using Brian's example, this is similar to a person that is making several chores around the home:
1) you are preparing food in the kitchen,
2) you go outside and water the trees,
3) go to check the baby in its room to see if it is sleeping, and
4) then you go to the room where the phone is located to see if it is ringing......always in that order.
Every task takes some fixed time, and because you are doing them sequentially, they each have to wait the turn.
Now imagine............. that you have just walked into the kitchen and the phone rings. You ignore it and continue working in the kitchen. Then you still ignore it and go water the trees outside, then you go and watch the baby. Then and only then, you go out and check if the phone is ringing.
You know what is going to happen, right? You may be able to answer the phone, but most likely you will miss the call.
That my friend, is the purpose of interrupt routines in controllers. You will have to use one sooner or later. I strongly advise you that, as part of your learning process, learn how to use them.
Very convincing!!
How logical and straightforward!!
Ok, so no escape from using interrupt, especially for such task.
The problem is that I`m using the BASIC compiler [I haven't written any assembly code since the day I was introduced to this software]; how ever, there is an ASM function that can introduce an assembly code within the compiler.
I will see what I can do...
Thanks for such clearance!!