cancel
Showing results for 
Search instead for 
Did you mean: 

Program not entering interrupt

ezanen9
Associate II
Posted on October 19, 2005 at 08:57

Program not entering interrupt

3 REPLIES 3
ezanen9
Associate II
Posted on October 18, 2005 at 10:06

Hi,

For reasons I switched from one development program(IDE) to an other. 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)<

/* 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)<

/* 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,

Jimmey

vincentchoplin9
Associate II
Posted on October 18, 2005 at 12:02

Hi,

You said that the error appeared when switching from one IDE to another. This is not surprising since there is no universal standard for declaring interrupt routines.

You should say which IDE you are using now, and then the people who support this IDE can answer you. I don't think anybody will be able to help without this information.

Actually, my advice is to contact directly the vendor of your new IDE.

Vincent

[ This message was edited by: VincentC on 18-10-2005 15:35 ]

ezanen9
Associate II
Posted on October 18, 2005 at 12:05

Ok thanks, did not know that.

I am using Keil uVision 3 now.

If somebody has an simple interrupt example, that fine as well.

Regards,

Jimmey