HP 16500H User Manual page 56

Interface module
Hide thumbs Also See for 16500H:
Table of Contents

Advertisement

Programming the HP 16500B
To write programs that open \system\program
Example
The following C-language example opens the \system\program file and
sends several commands and queries.
#include <stdio.h>
#include <unistd.h>
#define STR_LEN 80
void putstr(file, str)
FILE *file;
char *str;
{
}
int getstr(file, str)
FILE *file;
char *str;
{
}
void main()
{
/* Send a query and retrieve and print the response */
/* Send command strings to the HP16500B */
5-10
fwrite(str, strlen(str), 1, file);
return(fread(str, 1, STR_LEN, file));
FILE *file;
int num;
char receive_str[STR_LEN];
file = fopen("/logic/system/program", "r");
while (getstr(file, receive_str) == 0);
fclose(file);
file = fopen("/logic/system/program", "w");
putstr(file, "*idn?\n");
fclose(file);
sleep(1);
file = fopen("/logic/system/program", "r");
while (getstr(file, receive_str) == 0);
fclose(file);
printf("%s\n", receive_str);
file = fopen("/logic/system/program", "w");
putstr(file, "*rst\n");

Advertisement

Table of Contents
loading

Table of Contents