2008-10-04 02:20 AM
ST72324BK2 External Interrupts Problem
2008-10-04 02:20 AM
I am using St72324BK2 Micro controller. i want to use external interrupt ei1 on port F (0 & 1 pin). I am using ST7lib
It is actually a RTC made from its MCC using MCC ISR. THe MCC ISR works fine..For external interrupt when i have configured the external interrupt pin & its sensitivity....it compiles fines but when i run it on hardware....First of all two problems 1. Whenever i apply Falling edge on Pin 0....no change in anything infact no sign of interrupt. 2. When i configure the program for Pin 1.....and i apply the falling edge i.e. connect the pin to GND.....it toggles the pin status which i selected to toggle whenever ei1 ISR is run. but the Microcontroller then does not show any working...it hangs or sometimes the MCC interrupt also does not work which is shown as the Blinking LED of RTC display is also not working. No interrupt takes place. Please help me with that. am i doing right. I even set sensitivity and input configuration of pin without use of any library methods but still no difference. The Configuration of pins and external pins is shown here ADC_Init(ADC_DEFAULT); ADC_Select_Channel(0); /* Watch Dog initialization */ //#define WDGREFRESH WDG_Refresh(0x4a) // WDGREFRESH; /* I/O Port initialization */ IO_Init(); IO_Output(IO_PUSH_PULL, IO_PORT_A, (IO_PIN_3|IO_PIN_4|IO_PIN_6|IO_PIN_7));//LED Control IO_Output(IO_PUSH_PULL, IO_PORT_C, 0xff); IO_Input(IO_FLOATING, IO_PORT_D, IO_PIN_0); //Battery Voltage ADC Input IO_Output(IO_PUSH_PULL, IO_PORT_B, IO_PIN_4); //Decimal Point on Display IO_Output(IO_PUSH_PULL, IO_PORT_B, IO_PIN_0); //Clock Point on Display IO_Output(IO_PUSH_PULL, IO_PORT_B, IO_PIN_3); //Relay Control IO_Input(IO_PULL_UP, IO_PORT_E, (IO_PIN_0|IO_PIN_1)); IO_Input(IO_PULL_UP, IO_PORT_F, (IO_PIN_4|IO_PIN_6|IO_PIN_7)); //LED Default Configuration IO_Write(IO_PORT_A, IO_PIN_7, IO_DATA_LOW); IO_Write(IO_PORT_A, IO_PIN_6, IO_DATA_HIGH); IO_Write(IO_PORT_A, IO_PIN_4, IO_DATA_HIGH); IO_Write(IO_PORT_A, IO_PIN_3, IO_DATA_HIGH); ITC_Init(); /* Main Clock initialization */ //MCC_Init(MCC_DEFAULT|MCC_IT_ENABLE); //MCC_SlowMode(MCC_SLOW_DISABLE, MCC_CLK_0); //MCC_RTC_Timer(MCC_RTC_3); //MCC_Beep(MCC_BEEP_1); //ITC_SetPriority(IT_MCC, IT_LEVEL_1); ITC_SetPriority(IT_EI1, IT_LEVEL_2); //ITC_SetPrioritEnableInterrupts;y(IT_EI3, IT_LEVEL_2); //ITC_SetPriority(IT_EI0, IT_LEVEL_2); /* Interrupt controller initialization */ //DisableInterrupts; IO_Input(IO_PULL_UP_IT, IO_PORT_F, IO_PIN_1); //ITC_ConfigureInterrupt(IT_PortF, 1, IT_EDGE_F); DisableInterrupts; EICR = 0x00; EnableInterrupts; and the ISR files is here /* =========================================================================== */ /* Project: First Program */ /* File: First ProgramInt.c */ /* Organization: */ /* Author: (initial version generated by RBuilder) */ /* Date: 9/12/2008 */ /* =========================================================================== */ #include ''ST7lib_config.h'' /* --------------------------------------------------------------------------- */ /* Function: MCC_IT_Routine(void) */ /* Purpose: Interrupt Subroutine for MCC Interrupt */ /* Date: 9/12/2008 */ /* --------------------------------------------------------------------------- */ #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 MCC_IT_Routine(void){ extern volatile unsigned int x1; extern volatile unsigned int seconds; extern volatile unsigned char Run; if (x1 == 29) { if (Run == 1) { PBDR ^= 0x01; } seconds++; x1 = 0; } else { x1++; } MCC_Clear_IT(); }/* end of MCC_IT_Routine(void) */ void EI1_IT_Routine(void) { PBDR ^= 0x01; } AM I DOING ANY MISTAKE IN DECLARING THE EXTERNAL INTERRUPT or Port PIn. please help me.