Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Robert Adsett

At 01:37 PM 11/3/2007 -0700, Cat C wrote:
>Hi,
>
>Here's some lines from the array ISR that doesn't work:
>
>ISR(SIG_COMPARATOR)//When the Analog Input toggles
>{
>uint8_t ipChanNo = 0;
>uint8_t iCount = TCNT0 - 9;//So we always get it quickly and adjusted
>TCNT0 = 0;                      //Clear Timer
>if (bit_is_set(TIFR, TOV0) && bit_is_clear(ACSR, ACO))  //If we have overflow
>and input went HI
>   {                             //We started the first positive pulse 
> after LO SYNC
>         sbi(TIFR, TOV0);        //Clear overflow Flag TOV0 by writing logic 1
>         RemoteDecoderStatusCurrent = SyncReceived;
>         return;
>   }
>switch (RemoteDecoderStatusCurrent)
>   {
>case SyncReceived:
>...
>case CountingCh1://
>         if (bit_is_clear(ACSR, ACO))
>         {
>                 iCh[1] = iCount ;       //THIS LINE!!!!
>                 ipChanNo++;
>                 RemoteDecoderStatusCurrent = FinishedCh1;
>         }
>         else RemoteDecoderStatusCurrent = StatusERROR;
>         break;
>//Blah Blah
>   }
>}
>
>In main() I just keep looping reading iCh1 or iCh[1] and turn on an LED if
>greater than a value
>
>If I change the line marked "THIS LINE" to iCh1 = iCount ; ipChanNo++;


What happens in either case?

Does anything other than the ISR change iCH?


>Sorry about the formatting, it doesn't keep when pasted, I had to adjust
>manually...


Not much to do about that I think.

Robert

Another sign of the end of civilization, our technical magazines are 
getting chatty
 From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/

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.