Section 5
Page 5 - 52
HA243821
Issue 5 Mar 98
MODEL 346 INSTALLATION AND OPERATION MANUAL
5.7.9 C PROGRAM LISTING (Cont.)
/
**************************************************************************
FUNCTION
:
INIT PORT
DESCRIPTION
:
This routine is used to initialise the comms port to the selected baud
rate and sets 7 data bits with even parity.
ARGUMENTS
:
port
= port offset.
baud
= Required baud rate of port.
RETURNS
:
Void
NOTES
:
Supported Baud rates are 300, 600, 1200, 2400, 4800 and 9600.
Supported ports are COM1-4 (0-3)
**************************************************************************/
void init_port(port,baud)
int port,baud;
{
unsigned status,service, databyte;
switch(baud)
{
case 300:
baud=_COM_300;
break;
case 600:
baud=_COM_600;
break;
case 1200:
baud=_COM_1200;
break;
case 2400:
baud=_COM_2400;
break;
case 4800:
baud=_COM_4800;
break;
default :
case 9600:
baud=_COM_9600;
break;
}
service = _COM_INIT;/* _COM_SEND _COM_RECEIVE _COM_STATUS */
databyte = _COM_CHR7 |_COM_STOP1 | _COM_EVENPARITY | baud ;
(void) _bios_serialcom(service, port, databyte);
}