Posted: Tue May 17, 2005 11:13 am
first thanks for the reply, what i would like to do is to implement a SWI as a routine, i have some hardware driven interrupt make port D LEDs blink ( by use of timer overflow ) and i would like to let the SWI subroutine stop that, make other LEDs in port A blink., in other words i would like to simulate hardware interrupt by use of the software interrupt.
I just don't know how to do it.
it would be great if you could give me some hand.
Posted: Tue May 17, 2005 12:05 pm
I don't know if you absolutely want to use the SWI, as you have other ways.
Instead of the SWI, you can call a function that will stop the timer of LED D and init those in port A.
If you want to link that LED change to an external event, then you link your "LED switching function" to a keyboard interrupt.
What do you think ?
Posted: Tue May 17, 2005 12:19 pm
but the thing is, using SWI will help me learn how to use it,
i plan in fact to control a GSM modem via the microcontroller, i will use some sensors to to measure pressure and distance, i will sooner or later have to use SWI, that's why i have to learn about how to make this.
Posted: Tue May 17, 2005 12:23 pm
more over SWI can happen at anytime this can emulate some random happenings, whereas stopping the timer is done by me, i have to take in charge happening at any time, SWI have the highest priority after RESET so this is the reason
Posted: Tue May 17, 2005 12:46 pm
Ok, I see why you keep the SWI.
When you use SWI, you have no way not to have a break in debug mode...
If time constraint is not too harsh, when the debugger stops, change the Program Counter to where it should be (start of your ISR) and press GO again. Have a look at the context (SP) to see if you're OK with stack.
Posted: Tue May 17, 2005 1:22 pm
that's what i am doing right now, thanks for your advice. i was thinking about implementing a routine which would just start load the program counter with the ISR start start adress? what doign think about that, i will give it a try and if it works ok i will let you know
Posted: Thu Jun 02, 2005 12:56 pm
Sounds like a good idea, even if not quite sure I understood.
But your MCU will still stop its execution in debug mode and you'll need to press "GO" again.
May be you could write a script you would load as a CodeWarrior command (cmd) file and it would restart when a BREAK is seen...
It starting to be quite a task