lpc23xx uart kesme

Başlatan armsistem, 30 Kasım 2012, 16:24:35

armsistem

Arkadaşlar merhaba , lpc2365 uart0 veri geldiğinde kesme oluşmasını istiyorum . Kod aşağıda fakat kesme oluşmuyor harici başka ayar yapmam gerekiyor mu ?

/************************************************************************************
   Code created using the ARMwizard, visit http://alexan.edaboard.eu 
************************************************************************************/

#include <LPC23xx.h>

#define I2C0CONCLR I20CONCLR
#define I2C1CONCLR I21CONCLR
#define I2C2CONCLR I22CONCLR
#define INTCLEAR MAC_INTCLEAR
#define USBDevIntClr DEV_INT_CLR
#define USBEpIntClr EP_INT_CLR
#define USBDMARClr DMA_REQ_CLR
#define USBEoTIntClr EOT_INT_CLR
#define USBNDDRIntClr NDD_REQ_INT_CLR
#define USBSysErrIntClr SYS_ERR_INT_CLR
#define OTGIntClr OTG_INT_CLR
#define ILR RTC_ILR
#define IO0DIR IODIR0
#define IO1DIR IODIR1
#define MCIClear MCI_CLEAR
#define DMACIntClear GPDMA_INT_TCCLR
#define DMACIntErrClr GPDMA_INT_ERR_CLR

/******************************************************************************
                  UART0 interrupt service function
******************************************************************************/
__irq void UART0_IRQHandler(void) {
/* write code here */


VICVectAddr = 0;     /* Acknowledge Interrupt */
}

/******************************************************************************
                  UART1 interrupt service function
******************************************************************************/
__irq void UART1_IRQHandler(void) {
/* write code here */


VICVectAddr = 0;     /* Acknowledge Interrupt */
}

int main(void)
{
/*
    P0.0:  PORT0.0 (General purpose I/O)  Input, pull-up resistor enabled
    P0.1:  PORT0.1 (General purpose I/O)  Input, pull-up resistor enabled
    P0.2:  TXD0 (Transmitter output for UART0), pull-up resistor enabled
    P0.3:  RXD0 (Receiver input for UART0), pull-up resistor enabled
    P0.4:  PORT0.4 (General purpose I/O)  Input, pull-up resistor enabled
    P0.5:  PORT0.5 (General purpose I/O)  Input, pull-up resistor enabled
    P0.6:  PORT0.6 (General purpose I/O)  Input, pull-up resistor enabled
    P0.7:  PORT0.7 (General purpose I/O)  Input, pull-up resistor enabled
    P0.8:  PORT0.8 (General purpose I/O)  Input, pull-up resistor enabled
    P0.9:  PORT0.9 (General purpose I/O)  Input, pull-up resistor enabled
    P0.10:  PORT0.10 (General purpose I/O)  Input, pull-up resistor enabled
    P0.11:  PORT0.11 (General purpose I/O)  Input, pull-up resistor enabled
    P0.15:  TXD1 (Transmitter output for UART1), pull-up resistor enabled
    P0.16:  RXD1 (Receiver input for UART1), pull-up resistor enabled
    P0.17:  PORT0.17 (General purpose I/O)  Input, pull-up resistor enabled
    P0.18:  PORT0.18 (General purpose I/O)  Input, pull-up resistor enabled
    P0.19:  PORT0.19 (General purpose I/O)  Input, pull-up resistor enabled
    P0.20:  PORT0.20 (General purpose I/O)  Input, pull-up resistor enabled
    P0.21:  PORT0.21 (General purpose I/O)  Input, pull-up resistor enabled
    P0.22:  PORT0.22 (General purpose I/O)  Input, pull-up resistor enabled
    P0.23:  PORT0.23 (General purpose I/O)  Input, pull-up resistor enabled
    P0.24:  PORT0.24 (General purpose I/O)  Input, pull-up resistor enabled
    P0.25:  PORT0.25 (General purpose I/O)  Input, pull-up resistor enabled
    P0.26:  PORT0.26 (General purpose I/O)  Input, pull-up resistor enabled
    P0.27:  PORT0.27 (General purpose I/open-drain O)  Input
    P0.28:  PORT0.28 (General purpose I/open-drain O)  Input
    P0.29:  PORT0.29 (General purpose I/O)  Input
    P0.30:  PORT0.30 (General purpose I/O)  Input
    P1.0:  PORT1.0 (General purpose I/O)  Input, pull-up resistor enabled
    P1.1:  PORT1.1 (General purpose I/O)  Input, pull-up resistor enabled
    P1.4:  PORT1.4 (General purpose I/O)  Input, pull-up resistor enabled
    P1.8:  PORT1.8 (General purpose I/O)  Output, pull-up resistor enabled
    P1.9:  PORT1.9 (General purpose I/O)  Output, pull-up resistor enabled
    P1.10:  PORT1.10 (General purpose I/O)  Output, pull-up resistor enabled
    P1.14:  PORT1.14 (General purpose I/O)  Input, pull-up resistor enabled
    P1.15:  PORT1.15 (General purpose I/O)  Input, pull-up resistor enabled
    P1.16:  PORT1.16 (General purpose I/O)  Input, pull-up resistor enabled
    P1.17:  PORT1.17 (General purpose I/O)  Input, pull-up resistor enabled
    P1.18:  PORT1.18 (General purpose I/O)  Input, pull-up resistor enabled
    P1.19:  PORT1.19 (General purpose I/O)  Input, pull-up resistor enabled
    P1.20:  PORT1.20 (General purpose I/O)  Input, pull-up resistor enabled
    P1.21:  PORT1.21 (General purpose I/O)  Input, pull-up resistor enabled
    P1.22:  PORT1.22 (General purpose I/O)  Input, pull-up resistor enabled
    P1.23:  PORT1.23 (General purpose I/O)  Input, pull-up resistor enabled
    P1.24:  PORT1.24 (General purpose I/O)  Input, pull-up resistor enabled
    P1.25:  PORT1.25 (General purpose I/O)  Input, pull-up resistor enabled
    P1.26:  PORT1.26 (General purpose I/O)  Input, pull-up resistor enabled
    P1.27:  PORT1.27 (General purpose I/O)  Input, pull-up resistor enabled
    P1.28:  PORT1.28 (General purpose I/O)  Input, pull-up resistor enabled
    P1.29:  PORT1.29 (General purpose I/O)  Input, pull-up resistor enabled
    P1.30:  PORT1.30 (General purpose I/O)  Input, pull-up resistor enabled
    P1.31:  PORT1.31 (General purpose I/O)  Input, pull-up resistor enabled
    P2.0:  PORT2.0 (General purpose I/O)  Input, pull-up resistor enabled
    P2.1:  PORT2.1 (General purpose I/O)  Input, pull-up resistor enabled
    P2.2:  PORT2.2 (General purpose I/O)  Input, pull-up resistor enabled
    P2.3:  PORT2.3 (General purpose I/O)  Input, pull-up resistor enabled
    P2.4:  PORT2.4 (General purpose I/O)  Output, pull-up resistor enabled
    P2.5:  PORT2.5 (General purpose I/O)  Input, pull-up resistor enabled
    P2.6:  PORT2.6 (General purpose I/O)  Input, pull-up resistor enabled
    P2.7:  PORT2.7 (General purpose I/O)  Input, pull-up resistor enabled
    P2.8:  PORT2.8 (General purpose I/O)  Input, pull-up resistor enabled
    P2.9:  PORT2.9 (General purpose I/O)  Input, pull-up resistor enabled
    P2.10:  PORT2.10 (General purpose I/O)  Input, pull-up resistor enabled
    P2.11:  PORT2.11 (General purpose I/O)  Input, pull-up resistor enabled
    P2.12:  PORT2.12 (General purpose I/O)  Input, pull-up resistor enabled
    P2.13:  PORT2.13 (General purpose I/O)  Output, pull-up resistor enabled
    P3.25:  PORT3.25 (General purpose I/O)  Input, pull-up resistor enabled
    P3.26:  PORT3.26 (General purpose I/O)  Input, pull-up resistor enabled
    P4.28:  PORT4.28 (General purpose I/O)  Input, pull-up resistor enabled
    P4.29:  PORT4.29 (General purpose I/O)  Input, pull-up resistor enabled
*/


    PINSEL0 = 0x40000050;     /* binary: 01000000_00000000_00000000_01010000 */
    PINMODE0 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    IO0DIR = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINSEL1 = 0x00000001;     /* binary: 00000000_00000000_00000000_00000001 */
    PINMODE1 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINSEL2 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINMODE2 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    IO1DIR = 0x00000700;     /* binary: 00000000_00000000_00000111_00000000 */
    PINSEL3 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINMODE3 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINSEL4 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINMODE4 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    FIO2DIR = 0x00002010;     /* binary: 00000000_00000000_00100000_00010000 */
    PINSEL7 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINMODE7 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    FIO3DIR = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINSEL9 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    PINMODE9 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    FIO4DIR = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */

/******************************************************************************
                           Vector interrupt initialization
******************************************************************************/

   VICVectAddr6 = (unsigned long) UART0_IRQHandler;           /* set interrupt vector 6 */
   VICVectPriority6 = 15 ;           /* default priority is 15 (lowest), can be set between 0-15 */
   VICIntEnable |= (1UL<<6);           /* Enable UART0 Interrupt */

   VICVectAddr7 = (unsigned long) UART1_IRQHandler;           /* set interrupt vector 7 */
   VICVectPriority7 = 15 ;           /* default priority is 15 (lowest), can be set between 0-15 */
   VICIntEnable |= (1UL<<7);           /* Enable UART1 Interrupt */

   while(1)
  {
  
  
   }

}



armsistem

#1
Teşekkürler .

mesaj birleştirme:: 01 Aralık 2012, 13:48:01

Gerbay hocam , interrupt ayarı aşağıda;

  U0IER = 0x03;//


Kesme rutini aşağıda ;Uart0 veri gönderiyorum, lakin kesmeden hiç çıkmıyor,sürekli
       string_gonder_u0("/* Receive Data Available */");karakter_gonder_u0(0x0d);
  ekrana basıyor ,uart0 clear interrup şeklinde bir şey bulamadım ?

__irq void UART0_IRQHandler(void) {
	
 volatile char dummy;
  volatile char IIR;
  struct buf_st *p;

  /*------------------------------------------------
  Repeat while there is at least one interrupt source.
  ------------------------------------------------*/
  while (((IIR = U0IIR) & 0x01) == 0) {
     switch (IIR & 0x0E) {
       case 0x06: /* Receive Line Status */
    string_gonder_u0("/* Receive Line Status */");karakter_gonder_u0(0x0d);
			 dummy = U0LSR;  /* Just clear the interrupt source */
         break;

       case 0x04: /* Receive Data Available */
        string_gonder_u0("/* Receive Data Available */");karakter_gonder_u0(0x0d);
			  break;
			 case 0x0C: /* Character Time-Out */
          string_gonder_u0("/* Character Time-Out */");karakter_gonder_u0(0x0d);   
			 break;

       case 0x02: /* THRE Interrupt */
           string_gonder_u0("/* THRE Interrupt */");karakter_gonder_u0(0x0d);
         break;

       case 0x00: /* Modem Interrupt */
       string_gonder_u0("/* Modem Interrupt */");karakter_gonder_u0(0x0d);
         break;

       default:
        string_gonder_u0("olmadi");karakter_gonder_u0(0x0d);
			 break;
     }
  }
  VICVectAddr = 0; /* Acknowledge Interrupt */   
}


mesaj birleştirme:: 01 Aralık 2012, 19:27:38

      string_gonder_u0("olmadi olmadi ");karakter_gonder_u0(0x0d); ////////////////----------------> bu satır niye düşmüyor


__irq void UART0_IRQHandler(void) {
    
 volatile char dummy;
  volatile char IIR;
  struct buf_st *p;

  /*------------------------------------------------
  Repeat while there is at least one interrupt source.
  ------------------------------------------------*/
  while (((IIR = U0IIR) & 0x01) == 0) {
     switch (IIR & 0x0E) {
       case 0x06: /* Receive Line Status */
    string_gonder_u0("/* Receive Line Status */");karakter_gonder_u0(0x0d);
             dummy = U0LSR;  /* Just clear the interrupt source */
         break;

       case 0x04: /* Receive Data Available */
        string_gonder_u0("/* Receive Data Available */");karakter_gonder_u0(0x0d);
              break;
             case 0x0C: /* Character Time-Out */
          string_gonder_u0("/* Character Time-Out */");karakter_gonder_u0(0x0d);   
             break;

       case 0x02: /* THRE Interrupt */
           string_gonder_u0("/* THRE Interrupt */");karakter_gonder_u0(0x0d);
         break;

       case 0x00: /* Modem Interrupt */
       string_gonder_u0("/* Modem Interrupt */");karakter_gonder_u0(0x0d);
         break;

       default:
        string_gonder_u0("olmadi");karakter_gonder_u0(0x0d);
             break;
     }
  }
      string_gonder_u0("olmadi olmadi ");karakter_gonder_u0(0x0d); ////////////////----------------> bu satır niye düşmüyor
  VICVectAddr = 0; /* Acknowledge Interrupt */   
}

armsistem

eyvallah hocam şimdi anladım.