Hi,

Le jeudi 12 novembre 2009, Gordon Henderson a écrit :

> it would make life easier if I can use multiple interrupts - however
> inside an interrupt routine I need to be able to call other functions and
> do some floating point math. I also need the main interrupt to be
> reentrant, so the longish bit of code that is doing the FP calculations
> which takes a handful of millisecs can be interrupted by something else.
> (e.g. button push, ADC conversion end, etc.)

AFAIK, the PIC code generated by sdcc is *not* reentrant, so you'd better take 
care not to call functions recursively, or have an interrupt call a function 
while the main program has already called the same.

What you could do is :

- PIC18 can affect interrupts to 2 different (high/low) priorities, so you 
could 
affect you "longish bit of code" calling functions to a low priority int (or 
try to perform such calculations outside of an interrupt routine), and affect 
realtime, urgent interrupts to the high priority (that can interrupt the low 
priority).

If you use in your main() some functions that the low-pri int calls as well, 
you should disable low-pri int (GIEL) before calling such function from main() 
and reenable GIEL immediately afterwards, so you're sure that your "shared" 
function will not be called by main() and by the isr() at the same time.

> or will I have to re-compile the math
> libraries to be re-entrant

...or you could do that.

HTH.

-- 
Michel Bouissou (OpenPGP ID 0xEB04D09C)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to