Hello everyone,
We have received lots of questions from our customers regarding how interrupts are being handled.
Interrupts handling is much more simpler from what you might thought in the AIRcable, even simpler from a PC interrupt schema.
Basically as in any other processor you have an interrupt stack, where each new even get's registered. The biggest difference between this stack schema and the PC schema is that interrupts are only pushed at bottom or at top of the stack, depending the interrupt priority.
Only 4 interrupts are pushed to the top: @ALARM, @PIN_CODE, @MESSAGE and @FTP. You might ask your self why @INQUIRY is not high priority, as we insist so much in making it short as possible, simple because if @INQUIRY would be high priority it would interrupt it self.
So how does the interrupt handler work? Simple each time a new interrupt is pushed into the stack it checks if it goes in the top of the current serviced interrupt, if it does then it goes to service that new interrupt, if it doesn't it will execute the code until it reaches RETURN. Once it reaches RETURN it will go and see if the stack has more stuff to service.
As you might know every processor allows you to disable interrupts, this is achieved by adding ; at the end of each line.
I think this will clarify all your questions regarding interrupts, if you have more questions for us please leave your comments and we will be glad to help you.
Thanks,
Manuel
Tuesday, October 2, 2007
Subscribe to:
Post Comments (Atom)
3 comments:
The interrupt stack is only checked after a RETURN command? I don't think this can be right. If it were, then once I started an interrupt routine, it would run to the end (the RETURN line) before any other interrupts could be serviced.
This seems not right to me. Why would we have the ";" operation then?
It seems like the point of the ";" is do 2 things:
1) to make sure that the next line of code that is run is the next line in that same routine
2) to run that lin (1/200)th seconds later not (1/10)th seconds later.
It seems to me that if the Interrupt stack is only checked after a RETURN, then function 1 above is always the case. The only function of the ";" is then to run it much sooner than normal.
If I understand correctly what you are saying is that interrupts don't really have a priority so much as they have a place in line determined by when they happen.
4 interrupts cut to the front of the line, all other are put at the back of the line.
I assume that how things work is that
1) whenever the BASIC interpreter finishes a BASIC line without an ";", the BASIC interpreter looks at the interrupt stack.
2) If the current interrupt service routine (ISR) is still at the front of the line, it will run the next line of BASIC code of the current ISR, if not, it will save the environment and switch to the ISR that is at the front of the line.
3)When an ISR reaches a RETURN statement it is removed from the interrupt stack and the first line of the next ISR (if any) is processed in the next time slot (1/10)th seconds later
4)When an ISR contains a line that ends in a ";" it does not check the interrupt stack to see if it is time to switch, but simply processes the next line of the current IRS as fast as it can (approx. 1/200 seconds per line)
Joe,
Your finally comment really summarizes the hole idea about interrupts handling.
Sorry if I confused you with my comments.
Manuel
PS: I don't know why blogger didn't alerted me of your messages :S
Post a Comment