OPEN_EXISTING,

 

 

0, // no overlapped I/O

 

 

NULL); // null template

/* Set up the COM Ports Input and Output Buffer

Syntax -

 

 

BOOL SetupComm(

 

 

HANDLE hFile,

// handle to communications device

DWORD dwInQueue,

// size of input buffer

DWORD dwOutQueue

// size of output buffer

);

 

 

*/

 

 

PortReady = SetupComm(ComHandle, 5000, 5000);

/* Open the existing COM Settings

Syntax -

 

 

BOOL GetCommState(

 

 

HANDLE hFile,

// handle to communications device

LPDCB lpDCB

// pointer to device-control block

 

 

// structure

);

 

 

*/

PortReady = GetCommState(ComHandle, &CommSettings);

/*Check to see if it was successful*/ if(!PortReady)

{

CloseHandle(ComHandle);

fclose(fp);

exit(0);

}

/* This is USed to Update the CommSettings Structure Variables*/

//Setting the Baud Rate switch (ComBaud)

{

case ‘1’:

CommSettings.BaudRate = CBR_9600; // rate - 9600

break; case ‘2’:

CommSettings.BaudRate = CBR_19200; // rate - 19200 break;

114

Site Master PM

Page 120
Image 120
Anritsu S331D, S332D manual Site Master PM, Openexisting