On 09-Jan-02 alf schuster wrote: > Hi Collegues, > I have to post another problem I found during developement of a 240 > byte ring-buffer with the PIC 16F876: > The Problem: > I have to serve two different interrupt sources: > 1) an UART interrupt, which occurs some 200 to 2000 times a second > receiving bytes > 2) a timer interrupt which occurs every 10ms and reminds me to sent > 24bytes by means of the UART > I would like to know whether I did the contex saving during an interrupt > right, therefore here the code: > I work with banks 0 to bank 2 (three banks of 80 bytes each). After I > filled the first bank bank(0) I switch over to the second and so on... > Did I miss saving some register? The bank indicators(RP0/RP1) are saved > with the STATUS register! Am I right? > Within the programm I use the FSR to point indirectly to the created > buffer either in reception and transmission. > What happens is, that the code I received looks sometimes a bit > scrambled after it is output from the transmission routine, almost as > there would be some interference between interrupts... > Any help is appreciated and thanks in advance. > If someone needs the whole asm-source I'll send it one request.! > Thanks again, Alf schuster > > > org 0x04 > int ; save contex registers > movwf w_temp > swapf STATUS,w > movwf status_temp > movf FSR,w > movwf fsr_temp ; registers saved At this point you do not know which register bank is currently selected. You need to set the bank select bits RP0/RP1 before acessing any registers. Also atleast w_temp and status_temp need to be in the common registers (0x70-7F). fsr_temp can be in a noncommon register if the PR0/PR1 bits are set after "movwf status_temp". Peter. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body