Pular para o conteúdo principal
Renesas Brasil - Knowledgebase

Why does an interrupt won't occur when I manipulate the PIC1 register?

Latest Updated:03/27/2017


I am using INTP1 interrupts.
During the processing shown below, I manipulate the PIC1 register to set masking and priority levels, but sometimes an interrupt does not occur.

   if (condition){
         pic1 = 0x02;    /* Normal status */
   else {
         pic1 = 0x47;


This is because the interrupt request flag, mask flag, and priority level settings are all assigned to the PIC1 register, and whenever a write operation occurs in the PIC1 register, the PIF1 bit (interrupt request flag) is also overwritten (cleared to zero).
Consequently, any interrupt request that was held pending (i.e., set to "1") is cleared during this write operation and the corresponding interrupt does not occur.

To avoid this, use timing for manipulating the PIC1 register that is not synchronized with interrupt timing (such as immediately after an INTP1 interrupt occurs).

Also, use a bit manipulation instruction that changes only one bit at a time.

Suitable Products
V850 Family