9 years, 11 months ago.

setting interrupt priority between 2 InterruptIn?

Hi all

I'm using two InterruptIn interrupts in my code and was wondering if it's possible to set one to a higher priority than the other. I'm using one of my interrupts for sampling an Analog input and the other one to setup and update a PWM period for the sampling.

A problem that I think is occurring is that when the PWM update interrupt occurs it's stopping the sampling interrupt, executes the PWM interrupt then restarts the sampling interrupt making the sampling results lose a point or 2.

I think that if the sampling interrupt had a higher priority this would be less likely to miss a point but I'm relatively new to mbed programming (LPC1768) and am not sure how to do such a thing. From some research I've seen that priority between an Interrupt and a ticker can be achieved using the below lines of code but haven't come across anything similar for 2 interrupts.

<<code>> NVIC_SetPriority(EINT3_IRQn, 0); //set interupt to highest priority 0. NVIC_SetPriority(TIMER3_IRQn, 1); // set ticker priority to 1. Lower priority <</code>>

Any suggestions on the matter would be much appreciated.

Thank you -Stephen

Be the first to answer this question.