> And it works for all cases where the hardware does not need to be reset
> to some "interrupt-handled" state. e.g. some interrupts need to be
> cleared somehow (mostly by reading one or more bytes from pre-defined
> IO registers). If that is _not_ done within the ISR, the interrupt will
> re-fire immediatly after the reti instruction.
> 
> Other interrupt sources such as timer interrupts do not need to
> acknowledged and they work absolutly fine with forth words.
> 
Understood.


> moving the reti instruction to some other place is crazy, but it could
> work and could solve the interrupt handling problem.

Actually, it seemssto work great. I just put the finish on an IR remote control 
transceiver using Amforth. It uses interrupt serial (your code, so not Forth 
interrupts), an  input capture interrupt, and output compare interrupt, and 
timer overflow interrupt (not all on the same timer) for different timing 
functions. I can read IR remotes and then rebroadcast what they send or do 
some analysis and send either previously read commands or "synthesized" 
commands. The interrupt handlers run with interrupts disabled and all end with 
+int using the patch from my previous e-mail.

I'd encourage others to try it. It actually helps with the above problem too, 
I think, although I have not tested that. My reasoning is that interrupts will 
stay disabled until you Forth code can reset the interrupt state. It does mean 
that interrupts stay off for  comparatively "long time" -- but remember that 
interrupt source flags will get set regardless of if interrupts are on or not. 
So if you get another interrupt, it will simply fire when the int+ executes. 
Theh only real danger is missing the same interrupt or multiple occurances of 
other interrupts. So keep the isr short and fast.  In my system, it limits how 
short an IR pulse I can emit (the pulse length, not the modulation) I can emit 
(but that length is still shorter than anything I've ever found with a real 
remote -- a small number of microseconds).

Anyway, something to try if you are working with interrupts.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Amforth-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to