getsuart.c

来自「采用C语言,软件模拟硬件UART端口,基于PIC系列处理器实现.」· C语言 代码 · 共 26 行

C
26
字号
/* $Id: getsuart.c,v 1.1 2003/12/09 22:43:28 GrosbaJ Exp $ */
#include <p18cxxx.h>
#include "sw_uart.h"

/********************************************************************
*    Function Name:  getsUART                                       *
*    Return Value:   void                                           *
*    Parameters:     buffer: pointer to string                      *
*                    len: length of characters to receive           *
*    Description:    This routine receives a string of characters   *
*                    from the SW UART of length specified by len.   *
********************************************************************/
void getsUART(char *buffer, unsigned char len)
{
  char i;    // Length counter
  unsigned char data;

  for(i=0;i<len;i++)   // Only retrieve len characters
  {
    data = getcUART(); // Get a character from the USART
                       // and save in the string
    *buffer = data;
    buffer++;          // Increment the string pointer
  }
}

⌨️ 快捷键说明

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