Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Interrupts
Author | Message | ||||
Herry Senior Member Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Can anyone point me at a good source of information re MMBasic interrupts? Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
They are not that complicated. "Getting Started with the Micromite.pdf" covers interrupts on page 42 - you can download it from the bottom of this page: http://geoffg.net/micromite.html Geoff Geoff Graham - http://geoffg.net |
||||
Herry Senior Member Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Thanks. So an interrupt is always associated with a pin? I can't use it as a result of a conditional test in a program? Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5914 |
The same SUBs can be called by interrupts or your own program flow. Interrupts occur when a PIN changes state or when a TIMER triggers one. If you are doing conditional tests, you can call the interrupt sub directly. Jim VK7JH MMedit  MMBasic Help |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9066 |
USUALLY, a simple interrupt is pin driven, yes. On any MM using a touch-screen, the touch of the screen triggers an interrupt, so the code can discover what control you touched. Serial-port buffers can also trigger an interrupt when they have x number of bytes, which is very useful for processing incoming data on a serial-port, or you can just use the LOC command to find out if there is any data there to be processed. It depends on what you need to do. What you have to grasp, is that an interrupt is a SMALL bit of code stored in a sub, which is called at ANY time something triggers that interrupt call. The interrupt sub can be called in between ANY two lines of code, ANYWHERE within the main code, and does NOT run sequentially like the rest of your code. This is why it is important to have interrupts as small as possible, so they return to the main code as soon as possible, without causing delays by hanging around inside the interrupt. At the end of each instruction, the MMBASIC interpreter checks for an interrupt. If one is active, it will immediately loop to that interrupt, execute that code, then return to the next line of code in the main program from where it left. They are funny things to get your head around, but once you understand how they work, they are EXTREMELY useful. Basically, all the advanced touch-screen controls on the Explore-64, Explore-100 and matherps Micromite eXtreme would not be possible without interrupts to indicate to MMBASIC that the touch screen had been touched at any given - and random - point in time. Smoke makes things work. When the smoke gets out, it stops! |
||||
Print this page |