home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * si_test.c - serial port test program.
- *
- * Purpose: This file contains functions to test the serial interface
- * functions. It will communicate with a 300 baud device
- * through the keyboard. (Can be connected directly to a Hayes
- * modem via com1 port).
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include "blackstr.h"
- #include "sc_head.h"
- #include "si_head.h"
-
-
- void main()
- {
- struct SI_PARMS sparm;
- int status;
- char c,d;
-
- //sc_init(3,7,0); /* init screen */
-
- /*************************************************************
- SET UP SERIAL PORT CHARACTERISTICS IN STRUCTURE
- **************************************************************/
- sparm.type = 0; /* line type */
- sparm.wbits = 8; /* 8 bits per word */
- sparm.parity = FALSE;
- sparm.baud = 2; /* 300 baud */
- sparm.stop = 2; /* 2 stop bit */
-
- status = si_init(0,&sparm); /* do initialization */
- if(status& 0x6000) {
- printf("\n\r Error - COM port initialization status is %x (hex) ",status);
- exit(0);
- }
- sc_puts("\n\rSimple terminal program (COM1 @300bps)...[ESC] to Exit\n\n\r");
-
- /******************************************************************
- NOW JUST SEND/RECEIVE BYTES BETWEEN THE SERIAL PORT AND CONSOLE
- *******************************************************************/
- while(1) {
- while((d = (char)si_getc(0)) != 0)
- sc_putc(d);
- if(kb_hit())
- si_putc(0,c=kb_getc()); /* half duplex mode */
- if(c==0x1b)
- exit(0);
- }
- }
-
-