Searching \ for '[PIC]: ISR seems to thrash my registers, 18C242 us' 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/devices.htm?key=pic
Search entire site for: 'ISR seems to thrash my registers, 18C242 us'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: ISR seems to thrash my registers, 18C242 us'
2001\05\09@113522 by John Sondericker

flavicon
face
Hi,

  I am having a terrible time trying to get my code to work correctly.
It seems that my ISR, which I have implemented in C18 code using the
#pragma statements is thrashing my registers, causing the foreground
portions of my code to go haywire. I have looked at the .lst file for my
ISR and it really doesn't seem like it is saving off FSR0 correctly. I,
unfortunately am not familiar enough with this CPU or this compiler/asm
to really see what is happening clearly. Here is a small code snippet or
my ISR:

                                        #pragma code Vector=0x8
                                         void atVector(void) {

                                         _asm
000008   ef9a     GOTO      0x134              goto    intHandler
00000a   f000

                                         _endasm
00000c   0012     RETURN    0x0            }
                                         #pragma code

                                         #pragma interrupt intHandler


000134   52e6     MOVF      0xe6,0x1,0x0   void intHandler(void) {
000136   cfe9     MOVFF     0xfe9,0xfe6

000138   ffe6

00013a   cfea     MOVFF     0xfea,0xfe6

00013c   ffe6



00013e   aa9e     BTFSS     0x9e,0x5,0x0       if (PIR1&0b00100000) {
000140   d002     BRA       0x146

000142   ecfa     CALL      0x7f4,0x0              receiveDMX();
000144   f003

                                             }
000146   50e5     MOVF      0xe5,0x0,0x0   }
000148   cfe5     MOVFF     0xfe5,0xfea

00014a   ffea

00014c   cfe5     MOVFF     0xfe5,0xfe9

00014e   ffe9

000150   0011     RETFIE    0x1



Now, starting at location 134 I see a MOVF 0xe6,1,0 which as far as I
can tell does nothing. Where is my W register getting saved off? What
about my STATUS reg? Later, when leaving on line 146 I can see register
0xe5 being restored as my W register, but when was it saved in that
location?

I have searched around for a few days now and I'm stumped. I have also
tried alternate #pragma statements such as:

#pragma interrupt intHandler save=section(".tmpdata"),PROD,W,STATUS

Nothing seems to work. Microchip tech support couldn't provide anything
useful. They did say that W & STATUS are supposed to be saved by the
compiler automatically.


Help, I'm at my wits end.

- John

--
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 2001 , 2002 only
- Today
- New search...