[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] USART - Interrupt - problem
From: |
Onno van Eijk |
Subject: |
[avr-gcc-list] USART - Interrupt - problem |
Date: |
Sat, 22 May 2004 21:20:42 +0200 |
Hi,
Just recently I have started programming micro controllers. I am using
the ATMega32 on an stk500 with avr-gcc (on Debian), and I have run into
trouble I cannot solve.
I just want to use receive data by Interrupt, but I can't get it going.
See the sample code below. While running this code nothing happens. I
have tried different variations but nothing seems to help.
(Disabling the interrupt and enabling the code in the main.while loop
does work; so the serial USART + Connection work fine)
settings
lfuse: 0xca
hfuse: 0x59
lock: 0x3f
Any Idea's?
grz,
Onno
#include <avr/io.h>
#include <avr/signal.h>
#include <avr/interrupt.h>
SIGNAL(SIG_USART_RECV)
{
while ( !(UCSRA & (1 << RXC) ) );
PORTC = UDR;
}
int main (void)
{
cli(); /* Disable all interrupts */
UCSRB = 0x90; /*RXCIE on, RXEN on */
UCSRC = 0x86; /*8bit char, no parity, 1 stop bit */
UBRRH = 0x00; /*(Bautrate 19.2 kHz @ fosc=1.8432 Mhz)*/
UBRRL = 0x05;
DDRC = 0xFF; /* All PortC pins are outputs */
PORTC = 0xFF;
MCUCR = 0x00;
sei(); /* Enable interrupts */
while (1)
{
//while ( !(UCSRA & (1 << RXC) ) );
//PORTC = UDR;
};
}
- [avr-gcc-list] USART - Interrupt - problem,
Onno van Eijk <=