Specifications
SR400 with the GPIB Interface
57
x = 0; /* init PORT1 value */
while (1)
{
TxGpib(sr400,"CR;CS"); /* reset and start new count period */
do
{
TxGpib(sr400,"QA1"); /* read counter a data */
GetGpib(sr400); /* into result string */
/* scan result for long integer */
if (!(sscanf(result, "%D", &n1)))
Statcheck(255);
}
while (n1<0); /* until count period done */
x += 0.005; /* increment PORT1 level */
if (x>10) x=0; /* reset if at 10 Volts */
sprintf(portstr, "PL1,%6.3f",x); /* make PORT1 command string */
TxGpib(sr400,portstr); /* send command */
/* print answer */
printf ("Counter A = %ld PORT1 = %f\n",n1,x);
}
}
/* ****************************************************** */
TxGpib(address,command) /* transmit a command to addressed device */
int address;
char *command;
{
int status;
char t_string[80];
sprintf(t_string, "UNT UNL MTA LISTEN %d DATA '%s' 10",address,command);
transmit(&status, t_string);
Statcheck(status);
}
/* ****************************************************** */
GetGpib(address) /* get result string from addressed device */
int address;
{
char r_string[40], temp[80];
int length, status;
sprintf(r_string, "UNT UNL MLA TALK %d",address);
transmit(&status, r_string); /* make device a talker */