Microchip Application Note 556 Error

In AN 556, Microchip claims that it is necessary to disable interrupts before executing any instruction that directly writes to the PCL register, such as ADDWF PCL (typically used in a table look-up). According to the ap note, an interrupt that happens during the instruction that changes the PCL can return to the wrong place (the desired address + 1).

I asked about this problem in the recent seminar and the Microchip people who were present think that this application note may be incorrect and that the part may handle this situation properly.

Various people have done experiments to try to confirm the existence of this problem, with consistently negative results. Most of the tests have involved timer interrupts. Since the timer operates synchronously to the CPU core, it was possible that the problem as described only happened with asynchronous interrupt sources.

Rich Ottosen has experimented with this using an external interrupt from a signal generator using 60 Hz into a VCO (to try to vary the phase of the external interrupt with respect to the PIC's internal timing). He was unable to reproduce the problem with a PIC16C84 in this setup.

IMHO, someone at Microchip must have encountered some sort of interrupt problem and reached an erroneous conclusion as to the cause.

The only "official" confirmation of this error that I've seen is in two email messages from the Microchip BBS, which Jeff Pipkins forwarded to me.

From Mark Palmer of Microchip to Andrew Warren:

Date: Friday, July 21, 1995  7:27pm                                  
/MP-C
From: Mpalmer                                                   Msg#: 93221
  To: Andyw
  Re: MPC & Interrupts
      (Reply to #93056, Reply to #93000)

(N)ext, (P)revious, follow (T)hread, or (R)ead this message?

Having spoke with the designer (back when I first responed), he says it
isn't so. In that Interrupt section (pg 3 of AN556) "incremented and"
should be deleted (6th line), "table + 1" should be "table" (3rd line
from bottom), and the last sentance should be deleted.


Hope this helps

Mark P

From Stan D'Souze of Microchip to Jeff Pipkins:

Date: Monday, August 14, 1995  9:21pm                       Electronic Mail
From: Sdsouza                                                   Msg#: 96524
  To: Pipkins
  Re: AN556
      (Reply to #96424)

(N)ext, (P)revious, or (R)ead this message? r

Jim,

You are correct, the foot note about the table read not working during
an interrupt is not true. In reality the interrupt will work just fine
and so long as the stack does not overflow, the routine should return
from an interrupt and execute the table read routine.

We will correct the text in the next print of the ECH.

-Stan.

Back to my PIC Projects page
Back to my home page

Last updated October 12, 1995

Copyright 1995 Eric Smith

eric@brouhaha.com