SyriXus Series Pumps Installation and Operation Guide
Section 8 Serial Interface
8-12
EAR99 Technology Subject to Restrictions Contained on the Cover Page
CloseHandle(hCom);
printf("Comm intr released\n");
}
void conv_das(char *in, char *out)
{
unsigned sum;
char *c_ptr;
c_ptr=out;
*out++=0x30; /* put id first */
*out++='R';
if (!strcmp(in,"R"))
{
*out++=' ';
*out++=0x00;
}
else
sprintf_s(out,255,"%3.3X%s",strlen(in),in);
for (sum=0 ; *c_ptr; c_ptr++)
sum+=*c_ptr;
sum=(0x100 - sum) & 0x0FF;
/* get check sum */
sprintf_s(c_ptr,255,"%2.2X",sum);
}
void dgets (char *buffer)
{
char * ptr;
DWORD dwBytesRead = 0;
ptr = buffer;
while (1)
{
char buf[2];
/* get char if there
*/
if(!ReadFile(hCom, buf, 1, &dwBytesRead, NULL))
{
//error occurred. Report to user.
}
*buffer=buf[0];
if (*+ == 0x0d && ptr!=buffer || dwBytesRead==0)
{
*buffer = 0;
break;
}
}
}
void dputs(char *out)
{
int n;
DWORD dwBytesRead = 0;
Example of Visual C++ Program Showing Conversion of Pump Commands to
DASNET Frames (Continued)