Yahoo Groups archive

AVR-Chat

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

Thread

WinAVR GCC timers and interrupts

WinAVR GCC timers and interrupts

2004-01-19 by Adrian

Hi,

I'm struggling to collate the info in the 2313
datasheet and the include files for winavr
distribution of GCC.

I want to learn to use the timers & interrupts. I
started off with a polled timer test (writing code
from memory so may not be precise) to add interruopt
driven later:

TCNT0=0;// set timer counter
TCCR0=1<<CS02|1<<CS00;// set to /1024

do {} while (~(TIFR & TOVR0)) // wait for overflow

This appeared to hang in loop for ever  - I'd expected
it to pass straight through after a miniscule pause.


Any ideas what's wrong?

As regards interrupts, I looked at docs avr/signal.h
and couldn't decide if an sei was required or not.

Is there a URL with GCC code fragment to show proper
usage of INTERRUPT macro etc?

TIA,

Adrian



=====
-
*********************************************

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

Re: [AVR-Chat] WinAVR GCC timers and interrupts

2004-01-19 by Rogier Schouten

Hi,
I only know assembler, so this may not be what you are looking for:
You should enable the timer interrupt in TIMSK (don't know which bit right now) and all interrupts using SEI.
Rogier
Show quoted textHide quoted text
----- Original Message -----
From: Adrian
Sent: Monday, January 19, 2004 9:36 AM
Subject: [AVR-Chat] WinAVR GCC timers and interrupts

Hi,

I'm struggling to collate the info in the 2313
datasheet and the include files for winavr
distribution of GCC.

I want to learn to use the timers & interrupts. I
started off with a polled timer test (writing code
from memory so may not be precise) to add interruopt
driven later:

TCNT0=0;// set timer counter
TCCR0=1<
do {} while (~(TIFR & TOVR0)) // wait for overflow

This appeared to hang in loop for ever - I'd expected
it to pass straight through after a miniscule pause.


Any ideas what's wrong?

As regards interrupts, I looked at docs avr/signal.h
and couldn't decide if an sei was required or not.

Is there a URL with GCC code fragment to show proper
usage of INTERRUPT macro etc?

TIA,

Adrian



=====
-
*********************************************

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html

Yahoo! Groups Links

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.