| Electronics > Beginners |
| Sorry to interrupt ... |
| << < (6/7) > >> |
| jpanhalt:
--- Quote from: NivagSwerdna on June 01, 2018, 09:23:53 am ---... on reflection... I recently disassembled a very old bit of 8039 code... The technique used there was the IRQ would service an outside request, calculate and then and just push an address (after removing the original stack entry) of one of a number of routines to run after the ISR completed. The 8039 would run that routine and then finally enter a hard loop, waiting to be interrupted and scheduled again. The technique was pre-emptive... i.e. a new IRQ would schedule the new work with the old work (if it hadn't already reached the hard idle loop) being superseded. Not an unusual technique --- End quote --- Exactly, and now the 8-bit, enhanced mid-range PIC's can do that too. It has been available with 18F's and others for a long time. |
| wraper:
--- Quote from: PerranOak on May 31, 2018, 04:14:42 pm ---In my project the programme will be in a loop displaying the current result when an interrupt occurs. I then want that interrupt to jump to executing code part the way down the main loop and carry one, not acting as a subroutine at all - more of a "GOTO". --- End quote --- You need to be wary that interrupt can occur in any random point of main loop. And you need to be wary of data corruption which may happen when you make goto from a random point of a program. I would consider it relatively safe only if you completely discard all of the data you had before such interrupt. Not to say that you will have data transfer corruption if MCU was talking with some peripheral devices. You may just hang the bus and will need to reset it. |
| PerranOak:
Wow! Apologies for causing such trouble! I have only programmed in high level languages on PCs before so the stack was a mystery to me. While I was learning PIC stuff the significance of the RETFIE command was not made clear ... I know, ignorance of the law is no excuse. I now understand that I must not be lazy and must code properly even (especially?) on practice projects! :-[ |
| NivagSwerdna:
You didn't cause .any trouble :) Be creative don't necessarily follow any of these recommendations! Have fun |
| Brumby:
--- Quote from: PerranOak on June 01, 2018, 12:40:03 pm ---Wow! Apologies for causing such trouble! --- End quote --- Don't apologise ... you didn't cause any trouble. You simply asked a reasonable question. --- Quote ---I have only programmed in high level languages on PCs before so the stack was a mystery to me. --- End quote --- This is one of the reasons why caution has been strongly represented. You can certainly do whatever you like, but some of the trouble you can get yourself into playing with the stack can be pretty hairy. Understanding and discipline are useful companions. |
| Navigation |
| Message Index |
| Next page |
| Previous page |