hello,
i have problem with ATMEGA128 too. I want to do simple "Hello World" using AVR Studio 5.0. i wrote this program:
#include <avr/io.h>
#include <stdio.h>
static int uart_putchar(char c, FILE *stream);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
_FDEV_SETUP_WRITE);
int main(void)
{
init_uart();
stdout = &mystdout;
printf("Hello, world!\n");
/* while(1)
{
//TODO:: Please write your application code
}
*/
}
static int uart_putchar(char c, FILE *stream)
{
if (c == "\n")
uart_putchar("\r", stream);
loop_until_bit_is_set(UCSR1A, UDRE);
UDR1 = c;
return 0;
}
static int init_uart()
{
UCSR1A = 0x20;
UCSR1B = 0x18; //Transmitter & Receiver enable
UCSR1C = 0x06;
UBRR1H = 0x00;
UBRR1L = 0x0C; //Baud Rate 38400, frequency 10000 MHz
return 0;
}
I use COM-Port terminal. But somehow it didn't work at all. On COM-Port Terminal there is nothing. Could you please help me? Thank you for your help