0574774ワット発電中さん
2019/01/22(火) 23:14:01.59ID:SUk48xYistatic int stdPutc( char c, FILE *stream );
static FILE suStream = FDEV_SETUP_STREAM( stdPutc, NULL, _FDEV_SETUP_WRITE );
static int stdPutc( char c, FILE *stream )
{
while ( !( UCSRA & (1<<UDRE) ) );
UDR = c;
return 0;
}
int main( void )
{
stdout = &suStream;
printf_P( PSTR("Hello world") );
}
ヘッダファイルとUSARTの初期化は省略しているので注意。(あくまでも標準出力を設定するサンプルなので)