home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-4.ZIP / GSAMP / GSAMP.ZIP / EXAMP47.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  1.1 KB  |  49 lines

  1. /*
  2.  *  EXAMP47.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This example program demonstrates the use of the HMSetRegister
  9.  *  function.  It sets register 12, which happens to be the escape
  10.  *  code guard time register, to 50, then reads back the value
  11.  *  to be sure it worked okay.
  12.  *
  13.  */
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #include "asiports.h"
  18. #include "ibmkeys.h"
  19. #include "gf.h"
  20.  
  21. void my_putc( char c );
  22. void main( void );
  23.  
  24. void main()
  25. {
  26.     int status;
  27.     int value;
  28.  
  29.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 100, 100,
  30.                       1200L, P_NONE, 1, 8, ON, ON);
  31.     if ( status < ASSUCCESS ) {
  32.         printf( "Failed to open the port.  Status = %d\n", status );
  33.         exit( 1 );
  34.     }
  35.  
  36.     HMWaitForOK( TICKS_PER_SECOND, NULL );
  37.     HMSetUpEchoRoutine( my_putc );
  38.  
  39.     HMReset(COM1);
  40.     HMSetRegister( COM1, 12, 50 );
  41.     value = HMGetRegister( COM1, 12 );
  42.     printf( "Register 12 was set to %d\n", value );
  43. }
  44.  
  45. void my_putc( char c )
  46. {
  47.     putc( c, stdout );
  48. }
  49.