On Thu, 31 Mar 2005 14:59:10 -0600, Chuck Hackett
<egroupscdh@WhiteTrout.net> wrote:
>
> BTW: Even though this will eventually feed an AVR is there another list
> of
> helpful, non-flaming folks that I should direct questions like this to?
> I
> realized that it's not directly AVR related. So far I just subscribe to
> lists,
> haven't ventured into newsgroups yet.
> Regards,
> Chuck Hackett
<http://groups.yahoo.com/group/Electronics_101/>
ST
Winavr 3.4.1 AVR studio 4.1
I have a new program that keeps resetting. Also the timer interrupts
keeps firing too quick once I turn on the interrupts with sei. I have to
keep clicking through it and after maybe 10 times I get to step through
a single line of non timer0 interrupt code. The only difference is this
program and the other one I have no problem debugging is the board I
will run it on has a 32K external crystal clock and so I was using that
as my source code
Here is the code from the problem program for initializing the timer
/*
* Initialize timers - init timer 0 to use the real time clock crystal
* connected to TOSC1 and TOSC2. Use this timer as a 1 ms thread
* scheduling timer.
*/
void init_timers(void)
{
/*
* Initialize timer0 to use the 32.768 kHz real-time clock crystal
* attached to TOSC1 & 2. Enable output compare interrupt and set
* the output compare register to 32 which will cause an interrupt
* to be generated every 0.9765625 milliseconds - close enough to a
* millisecond.
*/
TIFR |= BV(OCIE0);
TIMSK |= BV(OCIE0); /* enable output compare interrupt */
ASSR |= BV(AS0); /* use asynchronous clock source */
TCNT0 = 0;
OCR0 = MS_OCRMATCH; /* non debug use 32 match in 0.9765625 ms */
TCCR0 = BV(WGM01) | BV(CS00); /* CTC, no prescale */
while (ASSR & 0x07)
;
}
The only differences are the ASSR |= BV(AS0); and then while (ASSR &
0x07) and I define MS_OCRMATCH to be 125 in the other program.
Am I doing something wrong?
At 09:55 PM 4/9/2005, wbounce wrote:
>Winavr 3.4.1 AVR studio 4.1
>I have a new program that keeps resetting. Also the timer interrupts
>keeps firing too quick once I turn on the interrupts with sei. I have to
>keep clicking through it and after maybe 10 times I get to step through
>a single line of non timer0 interrupt code. The only difference is this
>program and the other one I have no problem debugging is the board I
>will run it on has a 32K external crystal clock and so I was using that
>as my source
Are you simming, or jtagging?
If jtag, do you have the "run timers while stopped" option clicked?
I had that one bite me a while back, it apparently enabled itself
somehow. I know I've never turned it on.
> From: Dave VanHorn
> ....
> Are you simming, or jtagging?
>
> If jtag, do you have the "run timers while stopped" option clicked?
> I had that one bite me a while back, it apparently enabled itself
> somehow. I know I've never turned it on.
Dave, where's that option? I took a quick look and didn't find it (Studio
didn't have a very helpful HELP file either ...).
Cheers,
Chuck Hackett