putchar.c
来自「8051试验程序 基础教材」· C语言 代码 · 共 32 行
C
32 行
/* PUTCHAR.C
The ANSI "putchar" function.
The putchar function writes the character c to the
output-stream pointed to by stream.
The function returns the character written. If an writing
error occurs the putchar shall return EOF.
$Name: V7_dot_30A V7_dot_21A $
Copyright 1986 - 1999 IAR Systems. All rights reserved.
*/
#include <stdio.h>
#include <ioC8051f000.h>
int putchar(int ch)
{
if (ch == '\n') {
while (!SCON_bit.TI);
SCON_bit.TI = 0;
SBUF = 0x0d; // output CR
}
while (!SCON_bit.TI);
SCON_bit.TI = 0;
return (SBUF = ch);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?