interrupt problem!

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all

I have been active interrupt of the TCC0 but it does not exit from interrupt loop at all!

It means it does not return to while loop!

can every body help me?

This topic has a solution.
Last Edited: Wed. Nov 27, 2019 - 02:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Looks like a missing semicolon on line 47
.
Seriously, how could anyone help without seeing the code?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hasanzadeh99 wrote:
interrupt loop

What do you mean by that?

 

Generally, loops in interrupt handlers a A Bad Thing.

 

As clawson says, it is impossible to debug your code without seeing your code!

 

For how to post source code, see Tip #1.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

In addition to the above:

 

How do you know it entered into the interrupt routine?

 

How have you verified your clock speed?

 

Do you have other interrupts running, and if so are they working?

 

Xmega Chip:

 

Read the section carefully for the interrupt you are setting up.

On the E5's, and perhaps some others, YOU have to clear the interrupt bit from your code within the interrupt handler.

On most of the other AVRs the interrupt is automatically cleared for you when the interrupt handler code executes.

 

Depending upon the interrupt source, if you don't reset the interrupt, it will run the interrupt code, exit back to Main, run one instruction within the Main Loop, and then re-enter the interrupt; and repeat.

That can make it look like it is never exiting the interrupt.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't need return, ret, or reti in your IRQ's ...the compiler will properly handle getting into and returning from your IRQ code block

 

You can certainly have some "looping" IN your IRQ, as long as it is very limited time-wise (such as toggling pins, shifting out a few bits, looping to add up a few values, etc) 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Nov 23, 2019 - 09:22 PM