Re: R: hc12,can i return from interrupt and jump elsewhere?
- From: Robert Adsett <sub2@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 29 Sep 2007 18:38:58 -0400
In article <46febcb4$0$37205$4fafbaef@xxxxxxxxxxxxxxxxxxx>, says...
<attributes stripped by previous poster>
If all you want is to restart your code, i.e. re-enter main from the
start, then you can use a watchdog reset. Just stop toggleing your
watchdog when you get your event. The watchdog will trigger, and
restart your micro. If you want to resume a sepcific function on
reception of an interrupt event, then this is less trivial. Unless you
want to write your own RTOS, the simplest is to use either one of the
many open source ones, or a commercial one.
http://www.freertos.org/ seem to have a port for your micro.
And if he is simple seeking to abort an operation setting a flag in the
interrupt routine and checking it in the routine you are interrupting is
fairly straightforward.
It seems an odd requirement. To the original poster, what is the effect
you are trying to achieve? Tell us what you are trying to do rather
than how you are proposing to do it. We might be able to suggest better
approaches.
Ok,thanks again.
I kept my question generic just because i thought that what i'm doing
specifically is less interesting.
.I'm trying to implement an USB protocol using a 9s12 microcontroller,that i
call uC
http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0162468636bJwn
and a PDIUSBD12,a parallel to USB chip
http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0162468636bJwn
It is raccomended that anytime an USB device receives a bus reset it has to
accomplish it,signalling by an interrupt to the uC,even at the price of
letting loose what is remaining of the current function.then it should stay
in an idle loop waiting for another request.
OK, that makes sense but don't take interrupt too literally in this
case. The key is that you want to stop the current function when a bus
reset occurs. How you accomplish that is a design decision.
One way is I suggested and set a flag in the interrupt and watch it in
your routine. Actually this sounds like a good place for a statechart
implementation.
A second approach would be to use an RTOS and 'kill' the thread
performing the function.
The biggest problem I see with the second approach and your originally
proposed solution is that you could leave the hardware in an unknown
state.
Hoping that what i wrote about USB is correct and not
misleading(please,correct me in this likely case) i wish you a nice Saturday
night.
I have no idea if you have the USB requirement correct, but there will
be others here who do.
Robert
--
Posted via a free Usenet account from http://www.teranews.com
.
- References:
- hc12,can i return from interrupt and jump elsewhere?
- From: blisca
- Re: hc12,can i return from interrupt and jump elsewhere?
- From: Tim Wescott
- R: hc12,can i return from interrupt and jump elsewhere?
- From: blisca
- hc12,can i return from interrupt and jump elsewhere?
- Prev by Date: Re: PCB production: China or Taiwan?
- Next by Date: Re: System Building Help
- Previous by thread: R: hc12,can i return from interrupt and jump elsewhere?
- Next by thread: Re: R: hc12,can i return from interrupt and jump elsewhere?
- Index(es):
Relevant Pages
|