Hello,
I used MC9S12XET256 chip.
I used the continuous conversion interrupt to output the ADC value.
I want to turn off this interrupt. But it does not completely disable interrupts.
In other words, I want to control the use of interrupts.
I tried using the flags, but it fell into an infinite loop. And I changed the interrupt flag to disable and it did not work.
I can't find solutions. What should i do?
Thanks in advance.
Solved! Go to Solution.
Hmmm, continuous conversion with interrupt. Why? How long does it take to process data. Normally when I use continuous conversion I only get data from data registers and I know there are the last data there. If the conversion set converted faster than interrupt is done then a new flag is set. Where is the place you disable interrupt? Incorrect placement can lead to never ending loop or something which looks like never ending loop. For mi it looks like incorrectly selected algorithm.
BTW, do not mix clearing flags “fast flag clear” with manual clearing. The experience says me it can do some issues, I do am not able to explain but this is an experience.
When you want to stop continuous conversion you can also write to ATDCTL5 by selecting single conversion which performs only one more conversion set, calls isr if enabled and stop. Writing to ATDCTL5 stops last conversion and starts a new one. The period of your conversion set really sets the rules. What is your application? Probably approach with continuous mode without interrupt could be better.
Could you share your code to be able to analyze it and provide the best way of solution?
Best regards,
Ladislav
Hmmm, continuous conversion with interrupt. Why? How long does it take to process data. Normally when I use continuous conversion I only get data from data registers and I know there are the last data there. If the conversion set converted faster than interrupt is done then a new flag is set. Where is the place you disable interrupt? Incorrect placement can lead to never ending loop or something which looks like never ending loop. For mi it looks like incorrectly selected algorithm.
BTW, do not mix clearing flags “fast flag clear” with manual clearing. The experience says me it can do some issues, I do am not able to explain but this is an experience.
When you want to stop continuous conversion you can also write to ATDCTL5 by selecting single conversion which performs only one more conversion set, calls isr if enabled and stop. Writing to ATDCTL5 stops last conversion and starts a new one. The period of your conversion set really sets the rules. What is your application? Probably approach with continuous mode without interrupt could be better.
Could you share your code to be able to analyze it and provide the best way of solution?
Best regards,
Ladislav
Thanks for the answer.
I tested that i could stop the continuous conversion using the ATDCTL5 register. And after testing, i noticed that the ADC conversion interrupt paused.
By the way, After raising a question and thinking for a few days, I thought i didn't have to pause the ADC interrupt in my assignment.
Thank you again for answering the question.
Have a great day :smileyhappy:
Ji Hyun