Teledyne SyriXus 65x Installation And Operation Manual page 152

Syringe pumps
Table of Contents

Advertisement

SyriXus Series Pumps Installation and Operation Guide
Section 8 Serial Interface
Example of C Program Demonstrating Conversion of Pump Commands to DASNET Frames
#include<stdio.h>
#include<conio.h>
#include "b:comm.c"
int conv_das();
unsigned char in[256],out[256],buf[256];
char unitnum;
main()
{
unsigned port;
int speed;
cputs("ENTER UNIT ID=");
scanf("%d",&unitnum);
cputs("ENTER COM PORT=");
scanf("%d",&port);
cputs("ENTER BAUD RATE=");
scanf("%d",&speed);
comm_open(port,speed);
in[0]=50;
cputs("ALL ENTRIES IN CAPS\n\r");
while(1)
cputs("\n\rENTER STRING(Q TO QUIT) >>>");
cgets(in);
if(in[2]=='Q') break;
conv_das(&in[2],out);
cputs("\nDASNET FORMATTED OUTPUT >>>");
puts(out);
comm_putc(0x0d);
dput(out);
comm_putc(0x0d);
dgets(buf);
cputs("\nDASNET RESPONSE >>>");
puts(buf);
comm_flush();
}
comm_close();
}
conv_das(char *in, char *out)
{
unsigned sum;
char *c_ptr;
c_ptr=out;
*out++=unitnum+0x30;
*out++='R';
if (!strcmp(in,"R"))
{
*out++=' ';
*out++=0x00;
}
else
sprintf(out,"%3.3X%s",strlen(in),in);
for (sum=0 ; *c_ptr; c_ptr++)
sum+=*c_ptr;
sum=(0x100 - sum) & 0x0FF;
sprintf(c_ptr,"%2.2X",sum);
}
EAR99 Technology Subject to Restrictions Contained on the Cover Page
8-10
/* edit to path needed */
/* a 'C' example of DASNET serial control */
/* get parms */
/* open comm port */
/* convert string */
/* output converted string */
/* send "CR" to serial port */
/* output converted string to serial port */
/* end with a "CR" */
/* get response */
/* output response */
/* flush serial buffer to start again */
/* dasnet conversion utility */
/* point to output */
/* put id first */
/* add "R" to output */
/* if just "R" add space to string */
/* add # char to string */
/* add all chars together */
/* get check sum */
/* insert into string */

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Syrixus 260xSyrixus 500xSyrixus 500xvSyrixus 1000x

Table of Contents