Truncated match.
PICList
Thread
'PIC 16c71'
1995\07\21@180913
by
Eric Smith
|
> I'm am having problems with the rtcc interupt on the '71.
Could you describe the problem in more detail?
General hints:
1. Make sure you turn on the GIE bit and the T0IE bit in the INTCON register
when your code is prepared to deal with interrupts.
2. Clear the T0IF bit before turning on the enable bits (as in hint 1), or
you may get an immediate unexpected interrupt because the timer may have
already overflowed previously.
3. Make sure your interrupt handler saves and restores W and STATUS properly.
It is tricky to restore without changing STATUS; the SWAPF instruction
must be used. The 16C7x data sheet has suggested code in section 14.6.
Also, you may need to save other registers such as FSR or PCLATH if your
interrupt handler changes them.
4. The interrupt handler must clear the T0IF bit in the INTCON register
before it returns in order to clear the interrupt condition. Otherwise
the interrupt handler will get called continuously.
5. The interrupt handler must use the RETFIE instruction to return, or the
GIE bit will stay clear and you won't get any more interrupts after the
first one.
6. If your code ever needs to turn off the GIE bit (global interrupt enable),
make sure you read Microchip application note 576. There can be a problem
if an interrupt happens during the execution of the instruction that turns
off GIE.
It is generally easier to turn off only the specific interrupt
enable bit(s) that you care about, such at T0IE.
7. Make sure interrupts are disabled before you execute any instruction that
directly writes to the PCL register, such as an ADDWF PCL (typically used
in a table look-up). According to application note 556, 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.
Cheers,
Eric
http://www.telebit.com/~eric/pic/
'pic 16c71'
1997\09\03@001549
by
Zack Cilliers
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- Today
- New search...