Trouble with printf / stdout

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to print out some information and I'd like to print it all on the same line. I have the following code:

printf("%7d%7d%7d%7d\r",	(Int16)sensor_delta_filters[0].output,					(Int16)sensor_delta_filters[1].output,					(Int16)sensor_delta_filters[2].output,					(Int16)sensor_delta_filters[3].output);

Unfortunately, this causes it to not print immediately, I think because it is buffered. So I added

setbuf( stdout, NULL );

I am now no longer getting into my _write routine. I can still call Puts_Uart_1( char*, Uint16 ) and write to the UART.

int _write(int file, char * ptr, int len)
{ 
	while (len--)
		Put_Tx_Char_Uart_1(*ptr++); 
  
	return len; 
}

I'm using AVR Studio 6.0 and AVR_32_bit_GNU_TOOLCHAIN_3.4.0_332 4.4.3
Any help?