At 20.30 08-03-1997 +0000, you wrote: >> >> Thank you for your inputs. Do you, or anybody else, have an explanation for >> the missing PSP interrupt flag, PSPIF in PIR1? > >You said you'd read the errata sheets, so I didn't include this, but >I saw a similar problem, and the cause of the problem was that use of >the RETURN instruction clears the PSPIF bit. Note that this was in >May of last year when I was messing with this, and Rev A silicon was >supposed to have fixed this problem, but I have not verified this >personally. > >My solution was to avoid use of the RETURN function. Since I >couldn't control how the compiler used it, I simply forced a return >with a "RETLW 00h" just before the end of a function. > ( .... ) > >The problem with this, of course, is that it makes it difficult to >return values from functions, except by using global variables. In >my application this was not a big deal, but your mileage may vary ... > >The weird thing for me was that the program worked perfectly when >running from the emulator (Advanced Transdata RICE16), but didn't >work stand-alone, in a real PIC. > >But as soon as I replaced all my RETURNs with RETLWs, the PSP >magically started working ... > >Randy Rasa >rrasa@sky.net >http://www.sky.net/~rrasa > > In fact I have read the errata sheets but I'm not sure which version silicon I'm using and I don't know if there are any ways to tell, either. I've tried to avoid the use of RETURN instructions, too, but in view of your findings I'll study my code and my whole setup more careful first thing in the morning. Returning values is no problem as I'm using Forth and assembler. I return values on the stack anyway. Maybe I should get me a couple of new devices (newly made) hoping they fixed the problems in the silicon. I'll definitely look into those RETURN instructions and let you know if I get it up and running. If not, I'll probably have some more questions. Regards Michael