Mar 8, 2006 #1 A 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
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
Mar 8, 2006 #2 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 atmega uart Salam, Code: AVR306: Using the AVR UART in C (3 pages, revision B, updated 7/02) This Application Note describes how to set up and use the UART present in most AVR devices. C code examples are included for polled and interrupt controlled UART applications Doc http://www.atmel.com/dyn/resources/prod_documents/DOC1451.PDF Code http://www.atmel.com/dyn/resources/prod_documents/avr306.zip SPHiNX
atmega uart Salam, Code: AVR306: Using the AVR UART in C (3 pages, revision B, updated 7/02) This Application Note describes how to set up and use the UART present in most AVR devices. C code examples are included for polled and interrupt controlled UART applications Doc http://www.atmel.com/dyn/resources/prod_documents/DOC1451.PDF Code http://www.atmel.com/dyn/resources/prod_documents/avr306.zip SPHiNX