Agilent Technologies E4406A VSA Satellite Radio User Manual


 
116 Chapter 2
Programming Fundamentals
C Programming Using VTL
16-bit Applications
The following is a summary of important compiler-specific
considerations for the Windows compiler.
For Microsoft Visual C++ version 1.5:
To set the memory model, do the following:
1. Select Options | Project.
2. Click on the Compiler button, then select Memory Model from
the Category list.
3. Click on the Model list arrow to display the model options, and
select Large.
4. Click on OK to close the Compiler dialog box.
You may wish to add the include file and library file search paths.
They are set under the Options | Directories menu selection:
C:\VXIPNP\WIN\INCLUDE
C:\VXIPNP\WIN\LIB\MSC
Otherwise, the library and include files should be explicitly specified
in the project file.
Example Program
This example program queries a GPIB device for an identification
string and prints the results. Note that you must change the address.
/*idn.c - program filename */
#include "visa.h"
#include <stdio.h>
void main ()
{
/*Open session to GPIB device at address 18 */
ViOpenDefaultRM (&defaultRM);
ViOpen (defaultRM, “GPIB0::18::INSTR”, VI_NULL,
VI_NULL, &vi);
/*Initialize device */
viPrintf (vi, “*RST\n”);
/*Send an *IDN? string to the device */
printf (vi, “*IDN?\n”);
/*Read results */
viScanf (vi, "%t", &buf);
/*Print results */
printf (“Instrument identification string: %s\n”, buf);
/* Close sessions */