Ruth Hendrix

how to use software interrupts with codeworrior????

Discussion created by Ruth Hendrix Employee on Jan 23, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
Posted: Fri May 13, 2005 1:49 pm    
 
Hi All,
i try to implememnt a software interrupt routine that does some LED light show, the problem that the assembly that i incorporate in my C code namely "SWI" generates a breakpoint in the real time simulator debbuger, it seems to me that this feature canot be used??
can anybody tell me how i can make proper use of it?
best regards
 
Posted: Mon May 16, 2005 3:08 pm   
 
Yo,

As you saw yourself, break points are a particular software interrupt.
You have no way not to have your code stopping when debugging in MON08 if your code is executing a SWI.

What is your SWI ISR Code doing, so we can see how to move it somewhere else Question

Cheers, 

Posted: Tue May 17, 2005 11:13 am  

Hi,

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.
take care

Posted: Tue May 17, 2005 12:05 pm    

No problem,

I'm wondering...
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    

Thanks,
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.
regards

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.

Cheers,

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
take care

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 :smileytongue:

Cheers,

Outcomes