EasyManua.ls Logo

Anritsu Site Master S331D - Page 119

Anritsu Site Master S331D
132 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
/*********************************************************************/
/* BOOL OpenCommunications(int ComPort, int ComBaud) */
/* Description : This function is to Open the communication port */
/* and set the port settings */
/* Inputs : int - ComPort entered as a command line argument */
/* int - ComBaud The Baud rate for Communication */
/* Returns: SUCCESS - If the Communication link was established*/
/* FAIL - IF there was an error opening the COM Port */
/*********************************************************************/
BOOL OpenCommunications(int ComPort, int ComBaud)
{
DCB CommSettings; // Structure with COM Port settings
LPCTSTR ComPortNumber; // Pointer to the COM port number
BOOL PortReady; // Return val after setting the COM Port
COMMTIMEOUTS timeout; // Structure with Time out values
switch (ComPort)
{
case ‘1’:
ComPortNumber = “COM1";
break;
case ‘2’:
ComPortNumber = “COM2";
break;
case ‘3’:
ComPortNumber = “COM3";
break;
case ‘4’:
ComPortNumber = “COM4";
break;
default:
CloseHandle(ComHandle);
fclose(fp);
exit(0);
break;
}
/* Creating a File to Open a COM Port*/
ComHandle = CreateFile( ComPortNumber,
GENERIC_READ | GENERIC_WRITE,
0, // exclusive access
NULL, // no security
Site Master PM 113

Table of Contents

Related product manuals