Searching \ for 'goto instruction ??? , IAR C compilerfor [PIC] 18' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=c
Search entire site for: 'goto instruction ??? , IAR C compilerfor [PIC] 18'.

Truncated match.
PICList Thread
'goto instruction ??? , IAR C compilerfor [PIC] 18'
2004\04\13@185610 by MSullivan

flavicon
face
I have an IAR C compiler, and PIC 18F6720

What I am wanting to do is avoid function calls inside of interrupt routine to keep stack size small, but want to keep serial ,  flash , etc. in sepparate .C files.  
can I do the following?   How do I do the linkage of the label address in a .h header file ?  
--------------------------
file main.c

//interrupt routine

goto LABEL1;

RETURN_LABEL1:

goto LABEL2;

RETURN_LABEL2:
----------------------------

file serial.c

LABEL1:

//serial communication interrupt code

goto RETURN_LABEL1 ;


-----------------------------


Mark Sullivan

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\04\13@191232 by Dipperstein, Michael

face picon face
Unless IAR C is very far from standard C, you can't do what you're trying to do.
The goto and label must be in the same function.

If you can deal with the code space, you can write your current functions as
macros and let the compiler generate the code inline.

Are you really sure stack space is something you need to worry about?  Does IAR
C store anything other than return addresses on the hardware stack?  I've had
issues with stack space in the older PICs, but I have yet to write code for the
PIC18s that had a call tree deep enough to overflow the stack.

-Mike


{Original Message removed}

2004\04\13@192102 by steve

flavicon
face
> What I am wanting to do is avoid function calls inside of interrupt
> routine to keep stack size small, but want to keep serial ,  flash ,
> etc. in sepparate .C files.

---------------------------
file main.c

//interrupt routine

{
   #include "serial.c"
   #include "flash.c"
   #include "etc.c"
}

------------------------------
file serial.c

{
  my serial code
}


Steve.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\04\13@193149 by Dipperstein, Michael

face picon face
Pretty clever.  I wish that I thought of that.

You'll probably want to put all the includes at the bottom of the interrupt
routine after a return, but before the '}' so that you don't start by executing
the first included file.

-Mike

{Original Message removed}

2004\04\13@201341 by steve

flavicon
face
> You'll probably want to put all the includes at the bottom of the
> interrupt routine after a return, but before the '}' so that you don't
> start by executing the first included file.

Be careful here. You are inferring a mix of program flow that is both
inside and outside of the "#include". You should either have controlling
statements (if, switch, etc) in main.c _or_ as part of "my serial code",
but not a mixture.

It's one of those techniques like "$+x", that is great in the right place but
is easy to make into a mess.

Steve.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2004 , 2005 only
- Today
- New search...