/*********************************************************************/
/*
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;
LPCTSTR ComPortNumber;
BOOL PortReady;
COMMTIMEOUTS timeout;
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,
Spectrum Master PM
// Structure with COM Port settings
// Pointer to the COM port number
// Return val after setting the COM Port
// Structure with Time out values
GENERIC_READ | GENERIC_WRITE,
0, // exclusive access
NULL, // no security
*/
*/
*/
*/
*/
*/
101
Need help?
Do you have a question about the Spectrum Master MS2711D and is the answer not in the manual?