Pumpkin, Inc.

Pumpkin User Forums

SB-27: Salvo: Updated Interrupt Control for PIC18

Service Bulletins -- outlining known problems and how to handle them -- are posted here.

SB-27: Salvo: Updated Interrupt Control for PIC18

Postby Salvo Tech Support » Wed Nov 23, 2005 5:32 am

A Salvo user has brought it to our attention that the existing interrupt control for PIC18 can lead to lost / missed Timer0 and/or INT0 interrupts due to Read-Modify-Write issues when applied to the INTCON register.

Therefore, to avoid any chance of R-M-W artifacts on the INTCON register, Salvo for PICmicro(R) MCUs users should replace a portion of salvoincportpicc.h with:

code:
/* interrupt control depends on OSPIC18_INTERRUPT_MASK. Don't  */
/* use RMW instructions (e.g. INTCON |= mask) because Timer0 */
/* and/or INT0 bits may be lost if set during the RMW cycle. */
#if ( OSPIC18_INTERRUPT_MASK == 0xC0 ) ||
( OSPIC18_INTERRUPT_MASK == 0x80 ) ||
( OSPIC18_INTERRUPT_MASK == 0x40 ) ||
( OSPIC18_INTERRUPT_MASK == 0x00 )

#if !defined(OSDi)
#if (OSPIC18_INTERRUPT_MASK == 0xC0)
#define OSDi() do { GIE = FALSE; PEIE = FALSE;
} while (0)
#elif (OSPIC18_INTERRUPT_MASK == 0x80)
#define OSDi() do { GIE = FALSE;
} while (0)
#elif (OSPIC18_INTERRUPT_MASK == 0x40)
#define OSDi() do { PEIE = FALSE;
} while (0)
#elif (OSPIC18_INTERRUPT_MASK == 0x00)
#define OSDi()
#endif
#endif

#if !defined(OSEi)
#if (OSPIC18_INTERRUPT_MASK == 0xC0)
#define OSEi() do { GIE = TRUE; PEIE = TRUE;
} while (0)
#elif (OSPIC18_INTERRUPT_MASK == 0x80)
#define OSEi() do { GIE = TRUE;
} while (0)
#elif (OSPIC18_INTERRUPT_MASK == 0x40)
#define OSEi() do { PEIE = TRUE;
} while (0)
#elif (OSPIC18_INTERRUPT_MASK == 0x00)
#define OSEi()
#endif
#endif

#else
#error portpicc.h: Invalid OSPIC18_INTERRUPT_MASK value.
#endif


The same change should also be made to salvoincportiar18.h.

------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.

[This message has been edited by Salvo Tech Support (edited November 23, 2005).]

[This message has been edited by aek (edited June 15, 2006).]

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Return to Service Bulletins

Who is online

Users browsing this forum: No registered users and 1 guest

cron