sgugan
Member level 1
Hi i am using mega32.
once the RXC interrupt set the control jumps to ISR routine. but it is not coming from out of ISR, its keeps on looping there.
how to come out of that.
PLS CHECK CODE
#include <avr/io.h>
#include <stdio.h>
#include <avr/interrupt.h>
#include <util/delay.h>
ISR(USART_RXC_vect)
{
// UCSRA=0x00;
// while((UCSRA & 0x80)==0x00);
// data=UDR;
// UDR=data;
// UDR='K';
// _delay_ms(100);
// while((UCSRA & 0x20)==0x00);
// asm("RETI");
// return 0;
PORTA=0xFF;
_delay_ms(400);
PORTA=0x00;
_delay_ms(400);
// UCSRA=0x00;
}
int i; char data;
int main(void)
{
DDRA=0xFF;
DDRD=0x02;
UCSRA=0x00;
UCSRB=0x98;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=25; //set baud rate
asm("SEI");
while(1)
{
// PORTA=0xFF;
// _delay_ms(400);
PORTA=0x00;
// _delay_ms(400);
// while((UCSRA & 0x80)==0x00);
// data=UDR;
// data='H';
// UDR=data;
// while((UCSRA & 0x20)==0x00);
// UCSRA=0x00;
}
}
once the RXC interrupt set the control jumps to ISR routine. but it is not coming from out of ISR, its keeps on looping there.
how to come out of that.
PLS CHECK CODE
#include <avr/io.h>
#include <stdio.h>
#include <avr/interrupt.h>
#include <util/delay.h>
ISR(USART_RXC_vect)
{
// UCSRA=0x00;
// while((UCSRA & 0x80)==0x00);
// data=UDR;
// UDR=data;
// UDR='K';
// _delay_ms(100);
// while((UCSRA & 0x20)==0x00);
// asm("RETI");
// return 0;
PORTA=0xFF;
_delay_ms(400);
PORTA=0x00;
_delay_ms(400);
// UCSRA=0x00;
}
int i; char data;
int main(void)
{
DDRA=0xFF;
DDRD=0x02;
UCSRA=0x00;
UCSRB=0x98;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=25; //set baud rate
asm("SEI");
while(1)
{
// PORTA=0xFF;
// _delay_ms(400);
PORTA=0x00;
// _delay_ms(400);
// while((UCSRA & 0x80)==0x00);
// data=UDR;
// data='H';
// UDR=data;
// while((UCSRA & 0x20)==0x00);
// UCSRA=0x00;
}
}