home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_09 / 1009049a < prev    next >
Text File  |  1992-04-03  |  686b  |  31 lines

  1. /***                LISTING 6                 ***/
  2. /***                                          ***/
  3. /***                 sout.c                   ***/
  4. /*** **************************************** ***/
  5. /***    OUTPUT A CHARACTER TO SERIAL PORT     ***/
  6. /*** **************************************** ***/
  7. #include "serial.h"
  8. #include <time.h>
  9.  
  10. extern int portbase;
  11.  
  12. int SerialOut (char Char_Value)
  13.   {
  14.    clock_t start, timeout;
  15.  
  16.    start = (clock());
  17.  
  18.    while((inp(portbase + LSR) & XMTRDY) == 0)
  19.     {
  20.      timeout = (clock());
  21.  
  22.      if((timeout-start) > 1)
  23.       {
  24.        return(-1);
  25.       }
  26.     }
  27.  
  28.   outp(portbase + TXR,Char_Value);
  29.   return (0);
  30. }
  31.