4) Also i had tested comport connection using loopback testing method that i can see whatever i typed in i/p on o/p at a flash magic's terminal window.
In Flash Magic have you set baudrate to 9600 bps and did the loopback test ? If yes, did you get the proper output (echo) ?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 #define F_CPU 7372800 #include<avr/io.h> #include <util/delay.h> void UART_Init(unsigned int baudrate) { unsigned int baudPrescale = 0; baudPrescale = (((F_CPU / (baudrate * 16UL))) - 1); UBRRL = baudPrescale; UBRRH = (baudPrescale >> 8); UCSRC = (1<<URSEL) | (1<<UCSZ1) | (1<<UCSZ0); UCSRB = ((1<<TXEN)|(1<<RXEN) | (1<<RXCIE)); } void UART_Write(char data) { while(!(UCSRA & (1<<UDRE))); UDR = data; } void UART_Write_Text(char *data) { while(*data) { UART_Write(*data++); } } int main(void) { DDRB = 0xFF; DDRC = 0xFF; DDRD = 0xFF; UART_Init(9600); _delay_ms(200); while(1) { UART_Write_Text("ATMega8 UART\r\n"); _delay_ms(1000); } }
I have used external clock frequency that is crystal of 7.3728 MHz.
for sure it makes a difference wether the clock is internal 1MHz or crystal 7.3728MHz...If i not set the fuse bits....is this the cause of not getting proper o/p on hyperterminal in my case??
This means: not per s/w, but programming.Note that the fuses cannot be changed by the MCU itself.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?