2006-09-03 10:22 PM
2006-06-21 10:56 PM
I have got a problem with the interrupt.
I configure the register for an external interrupt on portB pin6 on rising edge. The interrupt never launch. Someone have an idea? /* Example code for ITC for ST72F521 */ #include ''ST7lib_config.h'' //prototype declarations void EI3_IT_Routine(void); void main(void); #ifndef NULL #define NULL (void *)0 #endif extern void _Startup(); /* startup routine */ extern void EI3_IT_Routine(); #pragma CONST_SEG .myVectorTable /* Interrupt vector table, to be linked at the address 0xFFE0 (in ROM) */ volatile void (* const _vectab[])() = { NULL, /* 0xFFE0 */ NULL, /* 0xFFE2 */ NULL, /* 0xFFE4 */ NULL, /* 0xFFE6 */ NULL, /* 0xFFE8 */ NULL, /* 0xFFEA */ NULL, /* 0xFFEC */ NULL, /* 0xFFEE */ EI3_IT_Routine, /* 0xFFF0 */ NULL, /* 0xFFF2 */ NULL, /* 0xFFF4 */ NULL, /* 0xFFF6 */ NULL, /* 0xFFF8 */ NULL, /* 0xFFFA */ NULL, /* 0xFFFC */ _Startup, /* Reset Vector */ }; #pragma DATA_SEG DEFAULT void main (void) { unsigned char Pin = 6; ITC_LEVEL Priority = IT_LEVEL_2; /*Variable Declaration*/ ITC_Init (); /* Initialise ITC */ EnableInterrupts /*Reset Interrupt mask*/ // ITC_SetPriority (((unsigned char)IT_TIMERA | ((unsigned char)IT_EI0)), // IT_LEVEL_2); /* Sets Interrupt Priority FOR EI0 AS LEVEL 2*/ ITC_SetPriority (IT_EI3, IT_LEVEL_0); /* Sets Interrupt Priority FOR EI2 AS LEVEL 1*/ // Priority = ITC_GetPriority (IT_EI0); /* Gets Priority */ while (!(ITC_Get_CurrentLevel () == IT_LEVEL_0)); /* Checks Current interrupt priority*/ // ITC_ConfigureInterrupt(IT_PortA,Pin, IT_EDGE_F); /*Set falling edge sensitivity for EI0*/ ITC_ConfigureInterrupt(IT_PortB,Pin, IT_EDGE_R); /*Set falling edge sensitivity for EI2*/ // ITC_DisableTLI (); /*Disables TLI interrupt */ // ITC_TLISensitivity (IT_EDGE_R); /* Sets Rising edge for TLI */ // ITC_EnableTLI (); /* Enables TLI interrupt */ PCDDR = 0x08; PCOR = 0x08; PCDR = 0x00; } /******************************************************************************* Interrupt Subroutine for EI2 *******************************************************************************/ #ifdef _HIWARE_ /* Test for HIWARE Compiler */ #pragma TRAP_PROC SAVE_REGS /* Additional registers will be saved */ #else #ifdef _COSMIC_ /* Test for Cosmic Compiler */ @interrupt /* Cosmic interrupt handling */ #else #error''Unsupported Compiler!'' /* Compiler Defines not found! */ #endif #endif void EI3_IT_Routine (void) { unsigned int i; PCDDR = 0x0C; PCOR = 0x0C; PCDR = 0x00; for (i = 0; i < 50000; i++) { Nop } PCDR &= 0xFd; }2006-09-03 10:22 PM
Keep your eyes to the port Configuration:
PxDDR = .... PxOR = .... The configuration must be Input - Interrupt for the corresponding Port-Pin ( 0, 1 = DDR, OR) Flag combination