These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Serial.c Source File

Serial.c

00001 /******************************************************************************/
00002 /* SERIAL.C: Low Level Serial Routines                                        */
00003 /******************************************************************************/
00004 /* This file is part of the uVision/ARM development tools.                    */
00005 /* Copyright (c) 2005-2007 Keil Software. All rights reserved.                */
00006 /* This software may only be used under the terms of a valid, current,        */
00007 /* end user licence from KEIL for a compatible version of KEIL software       */
00008 /* development tools. Nothing else gives you the right to use this software.  */
00009 /******************************************************************************/
00010 
00011 #include "debug_frmwrk.h"
00012 
00013 #define CR     0x0D
00014 
00015 
00016 void init_serial (void)  {               /* Initialize Serial Interface       */
00017     debug_frmwrk_init();
00018 }
00019 
00020 
00021 /* Implementation of putchar (also used by printf function to output data)    */
00022 int sendchar (int ch)  {                 /* Write character to Serial Port    */
00023 #if 1
00024    if (ch == '\n')  {
00025    _DBC(CR);                          /* output CR */
00026   }
00027 #endif
00028     _DBC(ch);
00029     return (ch);
00030 }
00031 
00032 
00033 int getkey (void)  {                     /* Read character from Serial Port   */
00034   return (_DG);
00035 }
00036 
00037 unsigned char getchar(void)
00038 {
00039     return getkey();
00040 }