GW Instek GFG-3015 User Manual
Page 50

p. 46 GFG-3015
/*-----------------------------------------------*/
/* set baud rate */
/* ByteSize */
/* parity */
/* StopBits */
/*-----------------------------------------------*/
DCB dcb = {0};
dcb.DCBlength = sizeof(dcb);
if (!GetCommState(hComm, &dcb))
{
printf("%s",Error_Message[2]);
return FALSE;
}
dcb.BaudRate = CBR_9600; // current baud rate
dcb.ByteSize = 8; // number of bits/byte, 4-8
dcb.Parity = 0;
// 0-4=no,odd,even,mark,space
dcb.StopBits=0; // 0,1,2 = 1, 1.5, 2
if (!SetCommState(hComm, &dcb))
{
printf("%s",Error_Message[3]);
return FALSE;
}
/*---------------- Set In,Out Queue -----------*/
if(!SetupComm(hComm, 8196,8196))
{
printf("%s",Error_Message[4]);
return FALSE;
}
if (!EscapeCommFunction(hComm, SETDTR))
{
printf("%s",Error_Message[5]);
return FALSE;
}
return hComm;
}