getchar.c

来自「Flashfile system for avr, ICC, IAR compi」· C语言 代码 · 共 35 行

C
35
字号
/*              GETCHAR.C

   The ANSI "getchar" function.

   The getchar function reads the character c from the
   input-stream pointed to by stream. 
   The function returns the character read.
   
   $Name: V3_34O V3_34N Spiff7 V3_34M V3_34L V3_34K V3_34J V3_34I V3_34H V3_34G $    

   Copyright 1986 - 1999 IAR Systems. All rights reserved.
*/


//#include <stdio.h>
#include <iom128.h>

int getchar(void)
{
   while (!(UCSR0A & 0x80))
   	  ;   //wait for character
   return((int) UDR0 & 0xFF);  //grab character 
}

/*
int putchar1(int ch)
{
   while (!(UCSR1A & 0x20))
      ;    //wait xmit ready
   UDR1 = (unsigned char) ch;
   return (ch);                 //send the character
}
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?