HP (Hewlett-Packard) Drive Network Card User Manual


 
54
Chapter 5
session
in the Instrument Handle field
Display the Reading
1 Select the Reading parameter.
2 Select Code and click Declare Variable. The Declare Variable dialog appears.
3 Enter reading in the Variable Name field.
4 Check the boxes titled Execute declaration in Interactive Window and Add
declaration to top of target file “*.c”. Click OK.
5 Select Code and click Insert Function Call to insert the function and values into
your program. Close the function panel. The hp34401a_Read function appears
in your program.
Close the Session
1 From the library tree, select Close. The Close function panel opens.
2 Enter session in the Instrument Handle field.
3 Select Code and click Insert Function Call to insert the function and values into
your program. Close the function panel. The hp34401a_Close function
appears in your program. Your final program should contain the code below:
#include <ansi_c.h>
#include "hp34401a.h"
#include <cvirte.h>
static ViReal64 reading;
static ViSession session;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
hp34401a_InitWithOptions (
"GPIB0::23::INSTR", VI_FALSE,
VI_TRUE, "Simulate=1", &session);
hp34401a_ConfigureMeasurement (session,
HP34401A_VAL_DC_VOLTS, 1.5, 0.001);
hp34401a_ConfigureTrigger (session,
HP34401A_VAL_IMMEDIATE, 0.01);
hp34401a_Read (session, 1000, &reading);
printf ("%f", reading);
hp34401a_close (session);
return 0;
}
Note:
To display the reading, add a printf function. Before the Close function, type: