Hello all, i am using lpc2148 in one of my application. i used adc conversion competition interrupt, so that no need to poll it. It works fine when first time it completes conversion of adc and execute ISR, but interrupt flag (ADINT) not get clears even i read all registers (ADDR,ADGDR,ADSTAT), so next time when adc conversion get complete, it does not jump to ISR.
Please help....
Note that you did add a delay without any comment to the reason.
Was it because the read/write delays when interfacing a peripherial can result in a quick acknowledge of the interrupt to have the processor directly make a second interrupt for the same event - all because the VIC still saw the peripherial as needing service?
The delay needed to handle that issue is _very_ short and can be handled much better than calling any delay function. Most often, it's enough to just optimize the order of the source code statements. And obviously, code shouldn't contain any "black magic" without there being proper documentation to remind the original coder - and let other developers understand the reason for any strange-looking code.
Too much people are busy copy/pasting too much black-magic code without having any idea why the code looks like it does - or if it even needs to look like that. So bad code tends to spread like rings on water.
Delay in while(1) is because of the that when new instructions or other contain is added then it also work and it is for the purpose that we have to restart the conversion after getting the first interrupt and delay in is because of read/write delay of controller.....
But the process of restarting the conversion depends on your application....sometimes it needs immediate some tile it needs after few seconds....
Delayed restart of conversion really should not be implemented by hanging the ISR.
The whole idea with ISR is to make sure that the ADC can perform the magic concurrently with normal software processing.
Sometimes, it's enough to slow down the clock rate to the ADC to adjust the number of samples/second the ADC will manage. The next option is to have a timer ISR that decides when it's time to start a conversion. There are lots of options, but sleeping in an ISR is really not the recommended route to go since that hurts the reaction to other interrupts that happens to have a lower priority - or hurts all other ISR in case you don't allow nested interrupts.