[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Input capture feature on ATmega128 not working?

From: Geir Tore Olsen
Subject: RE: [avr-gcc-list] Input capture feature on ATmega128 not working?
Date: Sat, 5 Oct 2002 12:05:36 +0200

Hi There!

The signal mname you're trying to use doesn't exist.


If the signal name is incorrect the offending signal makes a jump to the
reset vector. Correct me if I'm wrong.

Regards gtoo

-----Original Message-----
From: address@hidden [mailto:address@hidden
Behalf Of John Miles
Sent: Saturday, October 05, 2002 5:35 AM
To: address@hidden
Subject: [avr-gcc-list] Input capture feature on ATmega128 not working?

Hi, all --

I'm trying to get the input capture pin working on my ATmega128 under GCC.
The problem seems to be that every time the input capture interrupt fires,
the chip reboots.

Here's the code:

// Read and store ICR1 value, and reset timer

PORTB = ~(ICR1 >> 8);

TCNT1 = 0;

int main(void)
// Set up 500-ns (2 MHz) timer for input-capture pin PD4


TCCR1B = (1 << CSB1) | (1 << ICNC); // Timer source = system clock/8
TCNT1 = 0; // Clear timer count
TIFR = 1 << ICF1; // Clear ICF1 and pending interrupts
// TIFR = 1 << TOV1;

TIMSK = 1 << TICIE1; // Enable capture event interrupt
// TIMSK = 1 << TOIE1;

DDRD &= ~(1 << 4); // PD4 = input


// Port B = output

DDRB = 0xff;

while (1);

The commented-out lines above were temporary debug hacks to verify that I
could successfully trap overflows on timer 1, which worked fine. Not shown
above is code to xor the port-B lines with 0xff at the beginning of main()
to demonstrate that the chip is rebooting itself.

Anyone know of any issues surrounding the use of the input-capture interrupt
on an ATmega128 part?  There doesn't seem to be much code out there that
uses this feature on the '128.  Fuses are programmed for full ATmega128 mode
(non-ATmega103-compatible), clock is 16 MHz crystal, compiler is the 3.2
version of GCC for Win32 from the http://www.smartsolutionnet.de/avrgcc/

Thanks! -- john

avr-gcc-list at http://avr1.org

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]