KEPCO BIT 232F User Manual
Page 60

D-2
BIT 232 2/28/00
/********************************************************************
* RS232 interactive driver for BIT232
* use ROM BIOS INT 14 function calls
********************************************************************/
#include
#include
#include
#define TRUE 1
#define FALSE 0
#define PORT 2 /* serial port */
/* function prototypes */
void open_port(int n);
void put_serc(int n, int c);
int get_serc(int n);
int in_ready(int n);
int SendWecho(int n,int c);
void SendCommand(char *send_cmmd);
void SendCmmdWready(char *send_cmmd);
void main(void)
{
int c;
clrscr();
printf(“ ** BIT232 Interactive Driver Program - Press ALT + Q to exit \n”);
/* open the serial port */
open_port(PORT);
/* main program loop */
while (TRUE) {
/* process keyboard presses */
if (kbhit()) {
c = getch();
switch (c) {
case 0:
/* exit on Alt-X */
/* if ALT + Q */
if (getch() == 16)
exit(0);
break;
default:
{
SendWecho(PORT,c);
/* display it if one was available */
if (c != EOF)
putch(c);
if (c == ‘\r’)
putch(‘\n’);
}
}
}
/* process remote characters */
if (in_ready(PORT)) {
/* get character from serial port*/
c = get_serc(PORT);
/* display it if one was available */
if (c != EOF)
putch(c);
}
}
}