EasyManua.ls Logo

HP 1670A Series - To Write Programs that Open \Systern\Prograrn

HP 1670A Series
108 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Example
Programming
the
Logic
Analyzer
To
write
programs
that
open
\sys
tern
\program
Programming
the
logic
analyer
within
a C program
The following example in C
opens
the
\system\program
file and sends
several commands and queries.
#include
<stdio.h>
#include
<unistd.h>
#define
STR_LEN
80
void
putstr(FILE
*file,
char
*str)
{
fwrite(str,
strlen(str),
1,
file);
int
getstr(FILE
*file,
char
*str)
return(fread(str,
1,
STR_LEN,
file));
void
main()
{
FILE
*file;
int
num;
char
receive_str[STR_LENJ;
/*
Send
a
query
and
retrieve
and
print
the
response
*/
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(l);
file=
fopen("/logic/system/program",
"r");
while
(getstr(file,
receive_str)
==
0);
fclose
(file);
printf("%s\n",
receive_str);
/*
Send
command
strings
to
the
logic
analyzer
*/
file=
fopen("/logic/system/program",
"w");
putstr(file,
"*rst\n");
putstr(file,
":sel
1\n");
5-10

Table of Contents

Related product manuals