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++;
Sorry about the formatting, it doesn't keep when pasted, I had to adjust
manually...
_________________________________________________________________
Former Police Officer Paul Gillespie�s TAKE BACK THE INTERNET tips and
tricks, watch the video now http://safety.sympatico.msn.ca/Message
Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access
2007-11-03 by Cat C
Attachments
- No local attachments were found for this message.