Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] ISR not exiting?

2009-02-24 by Charlie Heath

David,

In your code you need to do this:

    Debug_Port &= ~(1 << Debug_Pin); // Low

instead of this:

    Debug_Port |= (0 << Debug_Pin); // Low

The modifed code reads Debug_Port into a temp register, clears the Debug_Pin
bit by anding with a mask consisting of all bits set except for the bit
assigned to Debug_Pin, and then writes the temp reg back to Debug_Port.

Your version reads Debug_Port into a temp register, but doesn't change the
bit assigned to Debug_Pin since oring a zero leaves the bit unchanged, and
then writes the temp reg back to Debug_Port.

HTH,
Charlie

----- Original Message ----- 
From: "David VanHorn" <microbrix@gmail.com>
To: <AVR-Chat@yahoogroups.com>
Sent: Tuesday, February 24, 2009 12:46 PM
Subject: [AVR-Chat] ISR not exiting?


> I'm using GCC.
>
> When I comment out the first Debug_Port line, the debug pin does not go
high.
> When I leave it in, the debug pin goes high, but never goes low.
> Am I missing something special I have to do to exit an ISR?
>
> // Timer 0 overflow ISR
> ISR(TIMER0_OVF_vect)
> {
> Debug_Port |= (1 << Debug_Pin); // High
>
> // Dec to zero timer
> if (LCD_Timer > 0)
> {
> LCD_Timer--;
> }
>
> if ((Raw_Data_Size = 0) & !(GICR & (1<< INT0))) //
> // If the summer is finished, and sampling is disabled
> {// enable sampling
> GICR  |= (1<<INT0)|(0<<INT1); // Enable eampling
> Raw_Edge_Flag = 0; // Looking for the start of a pulse
> }
>
> Debug_Port |= (0 << Debug_Pin); // Low
> }
>
> -- 
>
> "The very powerful and the very stupid have one thing in common. Instead
of
> altering their views to fit the facts, they alter the facts to fit their
> views... which can be very uncomfortable if you happen to be one of the
> facts that needs altering." Doctor Who, Face of Evil
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.