Using the Standard IO facilities of the avr-libc 

The avr-libc gives some facilities of the standard I/O. Only a limited subset of the standard IO is implemented (refer to the <stdio.h>: Standard IO facilities section of the avr-libc manual.). The uart.c source code could be used to interface the uart device with the Standard IO. The following example from the stdio man page of avr-libc illustrates the usage of the uart library.

#include <stdio.h>

#include “uart.h”

static int uart_putchar4IO(char ucData , FILE *stream);

static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar4IO, NULL,


static int uart_putchar4IO(char ucData , FILE *stream)



      return 0;


int main(void)



    stdout = &mystdout;

    printf("Hello, world!\n");

    return 0;



(to be continued…)

The index page