home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP47.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program demonstrates the use of the HMSetRegister
- * function. It sets register 12, which happens to be the escape
- * code guard time register, to 50, then reads back the value
- * to be sure it worked okay.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void my_putc( char c );
- void main( void );
-
- void main()
- {
- int status;
- int value;
-
- status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 100, 100,
- 1200L, P_NONE, 1, 8, ON, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
-
- HMWaitForOK( TICKS_PER_SECOND, NULL );
- HMSetUpEchoRoutine( my_putc );
-
- HMReset(COM1);
- HMSetRegister( COM1, 12, 50 );
- value = HMGetRegister( COM1, 12 );
- printf( "Register 12 was set to %d\n", value );
- }
-
- void my_putc( char c )
- {
- putc( c, stdout );
- }