flash using UART | Microcontroller › AVR › flash using UART This topic has 0 replies, 1 voice, and was last updated 9 years, 1 month ago by niteesh. Viewing 1 post (of 1 total) Author Posts August 3, 2015 at 11:36 am #3796 niteeshParticipant #define F_CPU 1000000 #include <avr/io.h> #include <util/delay.h> #include <avr/boot.h> #include <inttypes.h> #include <avr/interrupt.h> #include <avr/pgmspace.h> #include <stdio.h> ////////////////////////////////////////////////////////////////////////////////////// #define BAUD 4800UL #define MY_UBRR ((F_CPU/ (16UL * BAUD))-1) void usart_init() { UBRRH = MY_UBRR>>8; UBRRL = MY_UBRR; UCSRB = (1<<RXEN)|(1<<TXEN); UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); } void usart_write(unsigned char data) { while(!(UCSRA & (1<<UDRE))); UDR = data; } unsigned char usart_read() { while(!(UCSRA &(1<<RXC))); return UDR; } void usart_string(unsigned char *str) { unsigned char i = 0; while(str != '