Ни как не получается заставить Printf печатать в UART под IAR. Пример брал из ICC компилятора, проверял всё на Proteus, что самое интересное IAR в своём симуляторе C-SPY печатает в терминал как надо, в реалии в UART симворы не выводит.
вот такой код
#
#define ENABLE_BIT_DEFINITIONS
#include <iom8.h>
#include <inavr.h>
#include <stdio.h>
//extern int _textmode;
int putchar(int c)
{
// if (_textmode && c == '\n')
putchar('\r');
//while ((USR & 0x20) == 0) // UDRE, data register empty
// ;
while ( !( UCSRA & (1<<UDRE)) );
UDR = c;
return c;
}
//UART0 initialize
// desired baud rate: 9600
// actual: baud rate:9600 (0,0%)
/*
void uart0_init(void)
{
UCSRB = 0x00; //disable while setting baud rate
UCSRA = 0x00;
//UCSRC = BIT(URSEL) | 0x06;
UBRRL = 0x2F; //set baud rate lo
UBRRH = 0x00; //set baud rate hi
UCSRB = 0x18;
}*/
void uart0_init(void)
{
/* Set baud rate */
UBRRH = 0x00;
UBRRL = 0x2F;
/* Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
}
int main( void )
{
uart0_init();
while(1)
{
putchar('1');
printf("dcvjkxcznhkvxncv");
}
return 0;
}
#