EasyManua.ls Logo

Rohde & Schwarz SMW200A - Page 779

Rohde & Schwarz SMW200A
1312 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...
Network Operation and Remote Control
R&S
®
SMW200A
764User Manual 1175.6632.02 ─ 16
Templates are created in ASCII format with file extension *.expcodetempl.
Example:
Example to the code generator template NICVI.expcodetmpl:
#EXTENSION_START
.c
#EXTENSION_END
#INIT_CODE_START
#include <ansi_c.h>
#include <visa.h>
#include <cvirte.h>
#define MAX_BUFFER_SIZE 200
static ViStatus status;
static ViSession defaultRM, handle;
static void write_command(char *command)
{
char writeBuffer[MAX_BUFFER_SIZE];
char readBuffer[MAX_BUFFER_SIZE];
int length;
int readCount;
strcpy(writeBuffer, command);
//append "*OPC?" to sync
strcat(writeBuffer, ";*OPC?");
length = strlen (writeBuffer);
writeBuffer[length]='\n';
length = length+1;
viWrite (handle, writeBuffer, length, VI_NULL);
//read result
viRead(handle, readBuffer, 100, &readCount);
}
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
//create a VISA session and return a handle to it
viOpenDefaultRM (&defaultRM);
//create a VISA session to the serial port and return a handle to it
viOpen (defaultRM, (ViRsrc)"TCPIP::localhost::INSTR", VI_NULL, VI_NULL,
&handle);
#INIT_CODE_END
#COMMAND_CODE_START
write_command("%COMMAND");
#COMMAND_CODE_END
References

Table of Contents

Related product manuals