Teledyne SyriXus 65x Installation And Operation Manual page 155

Syringe pumps
Table of Contents

Advertisement

Example of Visual C++ Program Showing Conversion of Pump Commands to
int count=0;
n=strlen(out);
// start of packet
if(!WriteFile(hCom, "\r", 1, &dwBytesRead, NULL))
{
//error occurred. Report to user.
}
// data
if(!WriteFile(hCom, out, n, &dwBytesRead, NULL))
{
//error occurred. Report to user.
}
//end of packet
if(!WriteFile(hCom, "\r", 1, &dwBytesRead, NULL))
{
//error occurred. Report to user.
}
}
void commOpen(int port, long speed)
{
TCHAR szComPort[20];
if (port < 10)
wsprintf(szComPort, _T("COM%d"), port);
else
wsprintf(szComPort, _T("
\\\\.\\COM%d
hCom = CreateFile(szComPort,
GENERIC_READ|GENERIC_WRITE, // desired access should be read&write
0,
// COM port must be opened in non-sharing mode
NULL,
// don't care about the security
OPEN_EXISTING,
0,
// usually overlapped but non-overlapped for existence test
NULL);
// always NULL for a general purpose COM port
if (INVALID_HANDLE_VALUE == hCom)
{
printf("\nComm %d port not available",port);
//Sleep(2000);
//exit(1);
Sleep(1000);
return;
}
else
{
printf("\nComm %d port available ",port);
dcbSerialParams.DCBlength=sizeof(dcbSerialParams);
if (!GetCommState(hCom, &dcbSerialParams))
{
//error getting state
printf("Error getting Comm Port state");
EAR99 Technology Subject to Restrictions Contained on the Cover Page
SyriXus Series Pumps Installation and Operation Guide
DASNET Frames (Continued)
"),port);
// IMPORTANT: must use OPEN_EXISTING for a COM port
Section 8 Serial Interface
8-13

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Syrixus 260xSyrixus 500xSyrixus 500xvSyrixus 1000x

Table of Contents