⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.c

📁 s3c2410上用Keil开发的ucosII源代码
💻 C
字号:
/******************************************************************************/
/* SERIAL.C: Low Level Serial Routines                                        */
/******************************************************************************/
/* This file is part of the uVision/ARM development tools.                    */
/* Copyright (c) 2005-2006 Keil Software. All rights reserved.                */
/* This software may only be used under the terms of a valid, current,        */
/* end user licence from KEIL for a compatible version of KEIL software       */
/* development tools. Nothing else gives you the right to use this software.  */
/******************************************************************************/

#include <s3c2410.h>                     /* LPC21xx definitions               */

#define CR     0x0D


/* implementation of putchar (also used by printf function to output data)    */
int sendchar (int ch)  {                 /* Write character to Serial Port    */

  if (ch == '\n')  {
    while (!(UTRSTAT0 & 0x20));
    UTXH0 = CR;                          /* output CR */
  }
  while (!(UTRSTAT0 & 0x20));
  return (UTXH0 = ch);
}


int getkey (void)  {                     /* Read character from Serial Port   */

  while (!(UTRSTAT0 & 0x01));

  return (URXH0);
}

⌨️ 快捷键说明

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