Interruption is blocked

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

Hi 
I am using atmega328P , as it shown in the attached picture 
when the interruption is executed , the program doesn't turn back to the main to execute the rest of the program ? 
i made 2 functions ; one to blink led in portC and the other in PORT D 
the Led in PORT D (interruption) is working fine but the Led for PORT C in the main is not executed 
is there a problem ?? 

Attachment(s): 

Last Edited: Fri. Jun 19, 2020 - 10:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

atmega328P  is not an ARM so you are not positing in the right place. There is no "while forever" type loop in your main, that's usually a problem.

/Lars

 

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

ooops sorry this forum is about  'arm related' : can I change my post to another place ? 
i added :
while(1)

{

   portc_led();

still not working 

Last Edited: Fri. Jun 19, 2020 - 07:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can't, but a Moderator can move it for you.

 

Please see Tip #1 (in my signature, below) for how to properly post source code & pictures.

 

You may need to be on the desktop site to see signatures.

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was moved by someone to the Atmel Studio (AVR-related) forum however the topic has nothing to do with Studio problems, so it's moving again to the mega and tiny forum.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

You've not cleared the reason for the interruption - so my guess is that it keeps on interrupting. What does the datasheet for the mega328 say about the spi interrupts?

 

If you run the code in the Atmel Studio simulator, what happens?

Last Edited: Fri. Jun 19, 2020 - 11:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

You've not cleared the reason for the interruption - so my guess is that it keeps on interrupting. What does the datasheet for the mega328 say about the spi interrupts?

 

 

SPIF is cleared by hardware when executing the
corresponding interrupt handling vector.

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