R: R: hc12,can i return from interrupt and jump elsewhere?
- From: "blisca" <bliscachiocciolinatiscali.it>
- Date: Sun, 30 Sep 2007 10:18:39 +0200
Tim Wescott <tim@xxxxxxxxxxxxxxxx> wrote in message
ZK6dnYnENpd3u2LbnZ2dnUVZ_hzinZ2d@xxxxxxxxxxxxxxx
On Sat, 29 Sep 2007 23:05:38 +0200, blisca wrote:interrupt
"blisca" vrote
a function myfunc() is runnin,and an external events calls an
avoidservice routine,is it possible,once the interrupt did its job,to
to
instead?Itcontinue with my func()
from the point where it was interruptd,and going back to main()
is not important if i have to run another couple of line in
myfunc().Important is that i can go out from it soon;
Can anyone suggest me the most elegant way?
Once more forgive my English.
youIf 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
iswant 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
effectfairly straightforward.
It seems an odd requirement. To the original poster, what is the
betteryou 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
microcontroller,that iapproaches.
Robert
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
http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0162468636bJwncall uC
http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0162468636bJwn
and a PDIUSBD12,a parallel to USB chip
has to
It is raccomended that anytime an USB device receives a bus reset it
stayaccomplish 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
fromin an idle loop waiting for another request.
Well ,being honest it should be better if any request could wake the uC
hasidle loop by an interrupt,then once the specific request is decoded it
ifto be accomplished,but in case of another interrupt(and it could happen)
learnthis comes from a bus reset(and once more the uC has to discover it by
decoding)the current function has to be stopped.
I did the question in that way with the aim to keep it simpler,and to
approachthings step by step,and i'm aware that it should not be the best
Saturdayto the problem
Hoping that what i wrote about USB is correct and not
misleading(please,correct me in this likely case) i wish you a nice
Many thanks again to you all for your hints and for being interested.night.
Diego
I think you're confusing USB functions with microprocessor functions.
Unless _all_ you're doing is shuttling USB traffic around you don't want
to flush the whole micro's state -- you just want to flush the USB state.
Why do you talk about the entire micro's state?I dont want to do a total
reset,just like after a power on,i just want to return to the initial idle
loop
I figure that important data may be saved in global variabiles,having no
need to keep tracks of the "message queue",as windows does.
I say this keeping in mind that i'm a newbie compared to most of the people
in this newsgroup.
I'd look at how to do this gracefully. This is the sort of thing that
cries out for a state machine, one implemented in a big switch statement
and with a USB bus shutdown unconditionally forcing the machine's state to
a 'reset' state no matter what it was before.
--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com
.
- Follow-Ups:
- Re: R: R: hc12,can i return from interrupt and jump elsewhere?
- From: Robert Adsett
- Re: R: R: hc12,can i return from interrupt and jump elsewhere?
- 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
- Re: R: hc12,can i return from interrupt and jump elsewhere?
- From: Tim Wescott
- hc12,can i return from interrupt and jump elsewhere?
- Prev by Date: Re: R: hc12,can i return from interrupt and jump elsewhere?
- Next by Date: Re: Trace32 Breakpoints
- Previous by thread: Re: R: hc12,can i return from interrupt and jump elsewhere?
- Next by thread: Re: R: R: hc12,can i return from interrupt and jump elsewhere?
- Index(es):
Relevant Pages
|