Jan-Erik Soderholm wrote: > On 2010-11-28 23:59, David Duffy (AVD) wrote: > =20 >> Olin Lathrop wrote: >> =20 >>> David Duffy (AVD) wrote: >>> >>> =20 >>>> I am using INDF0 for reading the receive buffer. It is the same code >>>> I've used countless times before. >>>> >>>> =20 >>> Are you doing this in the interrupt routine and forgot to save/restore = the >>> FSR? >>> =20 >> I am using INDF0 in the serial receive ISR, as well as in tasks >> triggered by flags in the main loop. >> >> I'm not saving / restoring them in the ISR, as I understand this >> particular chip does that by itself. >> David... >> >> =20 > > They are. But of course you have to re-init them at each > entry to the ISR, they are not preserved between two interrupts. > You didn't say you don't, but just to clearify. > > B.t.w, this is what the PIC16F193X/LF193X datasheet says : > > Upon entering an interrupt, the return PC address is > saved on the stack. Additionally, the following registers > are automatically saved in the shadow registers: > =95 W register > =95 STATUS register (except for TO and PD) > =95 BSR register > =95 FSR registers > =95 PCLATH register > Upon exit from the Interrupt Service Routine, these registers > are automatically restored. Any modifications to > these registers during the ISR will be lost. Depending > on the user=92s application, other registers may also need > to be saved. > > > What I do not understand is why you don't read the receive > buffer (RCREG) directly. Why go through the index registers ? > The reading will always be from the same fixed address (RCREG) > so I do not see the need for any "indexing" here !? > =20 To clarify, I use INDF0 to store the incoming byte into my RAM receive buffer. Also, the use of INDF0 in the ISR & main routines is separate. That is, they operate on the same buffer, but the pointers are separate variables. David... --=20 ___________________________________________ David Duffy Audio Visual Devices P/L Unit 8, 10 Hook St, Capalaba 4157 Australia Ph: +61 7 38235717 Fax: +61 7 38234717 Our Web Site: www.audiovisualdevices.com.au ___________________________________________ --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .