NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Implementation of printf(...) function

April 17, 2011
by caballeroroberto
caballeroroberto's Avatar

Hi,

Do you know where I could find the implementation of the printf() function for the ATMega 168 chip? I am trying to understand how the FDEV_SETUP_STREAM() and uart_put/getchar() functions interact with it. I don't see how the FILE stream and charc c parameters in uart_putchar(char c, FILE stream) are passed.

Thanks.

April 17, 2011
by bretm
bretm's Avatar

Just search for "avr-lib source code" and you'll find it. It ends up calling vfprintf, which then makes multiple calls to putc, which just ends up calling uart_put or whatever other function is supplied when you create the stream structure.

Post a Reply

Please log in to post a reply.

Did you know that a NerdKit can be used to build an iPhone-controlled R/C car? Learn more...