hello all,
i am doing project on LPC2378
I have one input pin on LPC2378 connected to some other assembly which has opto assembly connected to it
when ever opto is cut i.e whenever there is transition on opto signal to LPC2378, I take reading from ADC
I also have tick timer which is also running at interrupt of 100msec
thus for LCP2378, I have 2 interrupts,
timer interrupt which is tick timer as IRQ
input pin interrupt as FIQ (falling edge)
in FIQ interrupt I am polling for ADC busy status and taking the reading of ADC
I am taking 50 readings, My FIQ is working fine as I am able to take reading on every transition of opto signal
but out of 50, one reading is going out of range.
can you tell me if I am missing FIQ interrupt due to timer interrupt?
Please reply as I can discuss my code.
thanks
"I cannot used ADC as interrupt as it is called in FIQ routine"
My suggestion was that the pin interrupt (your current FIQ) would not have a ADC poll loop, but just start an ADC conversion. Then an ADC interrupt would pick up the result.
The goal should always be to avoid loops in interrupt handlers, and have them return as quickly as possible. This gives more CPU for the main loop, and better interrupt response times for other interrupt sources.
Don't stay in the interrupt, use a state machine to sequence activity, leave, and come back when the ADC interrupts for each of the samples. Staying in the interrupt handler and waiting for 50 samples is not the way to do this.