VTI Instruments Corporation
30
VM2710A Programming
R
EGISTER
A
CCESS
P
ROGRAMMING
E
XAMPLE
The following register access example includes parameter set-up, testing and data retrieval:
#include <utility.h>
#include <ansi_c.h>
#include <nivxi.h>
#include "stdio.h"
#include <userint.h>
#include "vxitech.h"
static double volt, voltmin, voltmax, accumulate;
static char *reg_base;
int main()
{
static INT16 addr = 9;
static UINT32 i, window, value;
static INT32 int_value;
static NIVXI_STATUS ret;
static double delta_time, del_time;
static UINT8 buf[100];
/* Register access variables */
static UINT16 *data_hi, *data_lo, temp;
Cls ();
/* Initialize the library */
ret = InitVXIlibrary ();
/* Put in a known state */
vxiwrt(addr, "*rst");
vxiwrt(addr, "conf:volt:dc 10");
vxiwrt(addr, "volt:nplc 1");
/* Ask the instrument how big an integration time it is using */
vxiwrtrd(addr, "volt:nplc?", buf);
/* Compute a delay time of one integration value */
del_time = atof(buf) * 0.0166667;