You understand this correctly: you must allocate W_TEMP at the same offset in both banks for this to work. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ----- Original Message ----- From: "Drew Vassallo" To: Sent: Sunday, June 24, 2001 7:10 PM Subject: [PIC]: Context saving in ISRs > Ok, so I'm switching from the 16C71 to the 16C715. No big deal. The major > hangup is that I can't ignore Bank switching anymore, since the bank 0 RAM > isn't mapped in bank 1. Again, no biggie. BUT... > > Is it my imagination, or is this poor information from Microchip: > > (from the 16C71x datasheet, including C71 and C715) > > EXAMPLE 8-1: SAVING STATUS AND W REGISTERS IN RAM > > MOVWF W_TEMP ;Copy W to TEMP register, could be bank one or zero > SWAPF STATUS,W ;Swap status to be saved into W > MOVWF STATUS_TEMP ;Save status to bank zero STATUS_TEMP register > : > :(ISR) > : > SWAPF STATUS_TEMP,W ;Swap STATUS_TEMP register into W > ;(sets bank to original state) > MOVWF STATUS ;Move W into STATUS register > SWAPF W_TEMP,F ;Swap W_TEMP > SWAPF W_TEMP,W ;Swap W_TEMP into W > > > I believe this is where my program is taking a dump. The first line, "could > be in bank 1 or zero" is totally wrong. The W_TEMP variable *MUST* by in > *BOTH* banks 0 and 1, to allow for either case when an interrupt is > serviced. > > Am I going crazy, or is this not true? The datasheet says NOTHING MORE > about how to perform context saving. Note that when the variables are > restored, the original Bank is selected prior to restoring W, which is fine, > *IF* you have W_TEMP available in both banks. > > Please slap me into reality if I'm wrong here. > > --Andrew > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body