Appendix A-Example; A-1 C/C++ - Anritsu LMR Master S412E Programming Manual

An integrated, handheld multi-function land mobile radio test tool
Hide thumbs Also See for LMR Master S412E:
Table of Contents

Advertisement

Appendix A — Example
A-1
C/C++
This example is run on the command line. It sends the *IDN? query to the instrument and
prints the response to the console.
// IdnExample.cpp : Microsoft Visual Studio-Generated Example
//
Based on Example 2-1 in the NI-VISA User Manual
//
Usage : IdnExample "TCPIP::xxx.xxx.xxx.xxx::inst0::INSTR"
//
where xxx.xxx.xxx.xxx is the IP address of the
//
instrument.
//
Output : The string identity string returned from the
//
instrument.
//
VISA Header : visa.h (must be included)
//
VISA Library : visa32.lib (must be linked with)
#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "visa.h"
#define BUFFER_SIZE 255
int main(int argc, char* argv[])
{
ViStatus status; /* For checking errors */
ViSession defaultRM, instr; /* Communication channels */
ViUInt32 retCount; /* Return count from string I/O */
ViChar buffer[BUFFER_SIZE]; /* Buffer for string I/O */
char tempDisplay[BUFFER_SIZE]; /* Display buffer for example */
char *pAddress;
/* Make sure we got our address. */
if ( argc < 2 )
{
printf("Usage: IdnExample
\"TCPIP::xxx.xxx.xxx.xxx::inst0::INSTR\"\n");
printf("\t where xxx.xxx.xxx.xxx is the IP address of your
instrument.\n");
return –1;
}
/* Store the address. */
pAddress = argv[1];
/* Begin by initializing the system*/
status = viOpenDefaultRM(&defaultRM);
S412E PM
PN: 10580-00319 Rev. N
A-1

Advertisement

Table of Contents
loading

Table of Contents