HA243821
Issue 5 Mar 98
Section5
Page 5 - 53
MODEL 346 INSTALLATION AND OPERATION MANUAL
5.7.9 C PROGRAM LISTING (Cont.)
/**************************************************************************
FUNCTION
:
SEND BYTE
DESCRIPTION
:
This routine sends a single char “byte” out of the comms port.
ARGUMENTS
:
port = port offset.
RETURNS
:
A character sent via the BIOS routines.
NOTES
:
**************************************************************************/
void send_byte( int port, char byte )
{
while((_bios_serialcom(_COM_SEND,port,byte) & TRE) !=0)
;
}
/**************************************************************************
FUNCTION
:
GET BYTE
DESCRIPTION
:
This routine gets a single character “byte” from the comms port.
ARGUMENTS
:
port = port offset.
RETURNS
:
A character via the BIOS routines.NOTES:If there is no byte to get,
this will lock up on an XT or time-out after 1 sec. on an AT
**************************************************************************/
char get_byte( int port)
{
return((char)_bios_serialcom(_COM_RECEIVE,port,0) & 0x7f
);
}
/**************************************************************************
FUNCTION
:
GET BYTE FILT
DESCRIPTION
:
This routine gets a single character “byte” from the comms port, but
allows for a latency time delay in the first character.
ARGUMENTS
:
port = port offset.
RETURNS
:
A character via the BIOS routines, or NUL if nothing seen.NOTES:This
will lock up on an XT or time-out after 1 second on an AT
**************************************************************************/
char get_byte_filt( int port )
{
char buff;int i = 10;/* Try char ten times then quit. */
while( ((buff= get_byte( port )) == NUL ) && (i— >=0));
return(buff);
}