AnsweredAssumed Answered

ADUC 7061 - problem in interrupt handling

Question asked by Rajesh on Jan 7, 2015
Latest reply on Jan 7, 2015 by MMA

hi

          i'am using keil uvision 3 IDE ,in evaluation mode , i'am just trying a external interrupt 0 with a ADUC 7061 mnikit .

A key (push button) has connected to the External interrupt pin 0 ,

 

 

The code has written has follows..

 

 

if an interrupt has occured the  tempCount was incremented by one the uart prints the tempCount value after the // port0.2 pin push button was pressed.

 

when i'am pressing the interrupt key faster , the main while loop was not working.

 

sometimes after the hanging again pressed the interrupt key it became normal print in uart..

sometimes it also not even not working.

 

hardware description.

 

1. IRQ 0 was used as interrupt.

2. inputs were internal pullups were enabled

 

 

void IRQ_Handler(void) __irq

{

       unsigned long IRQSTATUS = 0;

       unsigned char ucCOMIID0 = 0;

       unsigned char ucComstatus = 0;

 

 

       IRQSTATUS = IRQSTA;   // Read off IRQSTA register

       if ((IRQSTATUS & BIT11) ) //UART interrupt source

       {

            ucCOMIID0 = COMIID0;   // Read the UART IRQ ID register

       if ((ucCOMIID0 & 0x2) == 0x2)  // Transmit buffer empty

       {

            ucTxBufferEmpty = 1;

       }

       if ((ucCOMIID0 & 0x4) == 0x4)  // Receive buffer Full 

       {

            uartRxSt.rxBuffer[uartRxSt.count]=COMRX;

       if(uartRxSt.count < UART_BUF_LEN_MAX)

       {

              uartRxSt.count++;

       }

 

       }

 

 

  }

  if ((IRQSTATUS & BIT13) ) //External Interrupt0 source

  {

  IRQCLRE = BIT13;   // Clear External Interrupt 0

  ExternalInterrutptStatus.Int0 =1;

  tempCount++;

  }

  if ((IRQSTATUS & BIT18)) //External Interrupt2 source

  {

  ExternalInterrutptStatus.Int2 =1;

  IRQCLRE = BIT18;   // Clear External Interrupt 2

  }

}

 

/*

main routine

*/

 

void main()

{

 

 

externalInterruptConfigure();

 

 

while(1)
{
if(!(GP0DAT & 0x00000004 )) // port0.2 pin
{
  sprintf ( (char*)szTemp, "%d\r",tempCount );// Send the Received charachter to the UART
  printString((const unsigned char *)szTemp);
//printLenOfBytes((const unsigned char *)szTemp ,10);
}
}

}

 

 

 

 

Uart output for the interrupt counter...

 

Waiting for byte from PC<CR>

 

 

 

16<CR>

16<CR>

32<CR>

33<CR>

33<CR>

33<CR>

34<CR>

34<CR>

49<CR>

49<CR>

49<CR>

49<CR>

49<CR>

75<C>

75<CR>R>

75<CR>

75<CR>

75<CR>

75<CR

115<CR>

115<CR>

264<CR>

292<CR>

292<CR>

292<CR>

294<CR>

24600<CR>

24600<CR>

24600<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24611<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24651<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

24665<CR>

Outcomes