Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Implementaion of UART in ATmega16

Status
Not open for further replies.

arunima.srivastava

Newbie level 1
Joined
Jan 27, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
atmega16 uart

Hi all
I am implementing UART in microcontroller ATmega16.The code is as follows

#define FOSC 6000000
#define BAUD 9600
#define MY_UBRR
#include<avr/io.h>
#include<stdio.h>
void serinit(){
// UBRRH=0x00;
UBRRL=0x26;
UCSRA=0x00;
UCSRB=0x08;
UCSRC=0x86;
// UBRRH=0x00;
return;
}
void sersend(unsigned char c){

while((UCSRA & 0x20)==0);


UDR=c;
return;
}
int main(){
unsigned char i=0;
PORTD=0xff;
DDRD=0xff;

serinit();

while(1){
sersend(50);
i++;
}

return 0;
}

but it is not working.can any body plz help me, suggesting any changes in this code or providing me some other code.

Plz help me asap.
Thnx
 

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,045

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top