We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, For reasons I switched from one development program(IDE) to the KEIL IDE. Now I have problems using interrupts. My program don't what to enter the "ADC sample on channel0 is ready" interrupt service routine. In main.c /* -------------------------------- Configuration of ADC -------------------------------- */ ADC_CSR = 0x0140; //0x0140; interrupt for channel 0 enabled ADC_CPR = 0x0DF; //0x0FFF; geeft een timer van 0.73 Hz RCCU_BOOTCR = RCCU_BOOTCR | 0x0020; //Turn on clocks to ADC, etc // Configure IRQ /* EIC IRQ configuration ADC12_IRQHandler*/ EIC_SIR18 = ((unsigned int)ADC12IRQHandler)<<16 | 1; /*set EIC_SIR18 register for ADC to generate interrupts with priority 1*/ /* Enable irq interrupt channels */ EIC_IER0 = CHANNEL(18); /* EIC interrupt enable register */ EIC_ICR = EIC_IRQ_ENABLE; /*the ISR that is never entered*/ #pragma userclass (CODE = IRQ) // A/D IRQ: Executed when A/D Conversion is done void ADC12IRQHandler(void)__irq { IOPORT2_PD ^= 0xF000; /*for test purposes just blick 4 LED's*/ ADC_CSR &= 0xFFFE; // clear sample ready flag EIC_IPR0 = CHANNEL(18); } #pragma userclass (CODE = default) /********************************EOF**************/ I checked and the ADC is running, with memry view I see samples in the DATA0 register. Also the sample ready and sample over run flags are activated. Before I used the following code but this code does not work with my new IDE+compiler: main.c /* -------------------------------- Configuration of ADC -------------------------------- */ PCU_BOOTCR = PCU_BOOTCR | 0x0020; //Turn on clocks to ADC, etc ADC_CSR = 0x0140; //0x0140; interrupt enabled ADC_CPR = 0x0FFF; //0x0FFF; geeft een timer van 0.73 Hz /* EIC IRQ configuration */ EIC_SIR18 = ((unsigned int)ADC_IRQ_isr)<<16 | 1; /* EIC interrupt enable register */ EIC_ICR = EIC_IRQ_ENABLE; /* Enable irq interrupt channels */ EIC_IER0 = CHANNEL(18); /* switch to SYS mode and enabled interrupts */ #define SWITCH_IRQ_TO_SYS asm(" msr CPSR_c,#0x1F \n stmfd sp!,{lr}" ) /* switch back to IRQ mode with IRQ disabled */ #define SWITCH_SYS_TO_IRQ asm (" ldmfd sp!,{lr} \n msr CPSR_c,#0x12|0x80") /* END USER CODE FUNCTIONS1 */ void T0_EFTI_isr ( void ) __attribute__ ((interrupt ("IRQ"))); void ADC_IRQ_isr ( void ) __attribute__ ((interrupt ("IRQ"))); void ADC_IRQ_isr ( void ) { SWITCH_IRQ_TO_SYS; /*60 BEGIN USER CODE ADC_IRQ */ IOPORT2_PD ^= 0xF000; /*for test purposes just blick 4 LED's*/ /* END USER CODE ADC_IRQ */ SWITCH_SYS_TO_IRQ; // clear IRQ Pending bit EIC_IPR0 = CHANNEL(18); } I tied a lot of things but nothing works, does somebody know what I am doing wrong. Regards, Erik Z