HP (Hewlett-Packard) AHA-8940 Network Router User Manual


 
40 VXI Programming Using the IEEE 1394 Serial Bus Chapter 3
Block Transfers using
HP VISA
This program performs a block transfer of 60,000 readings using the
HP E1563A digitizer and the HP VISA function viMoveIn32.
// 1563visa.CPP - This program configures the HP E1563A digitizer using its
// VXIplug&play driver and then transfers a block of 60,000 readings from
// the digitizer’s FIFO memory to the computer using the VISA viMoveIn32
// function.
#include "hpe1563.h"// include the driver header file
#include "visa.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
// project files: 1563visa.cpp, hpe1563.lib, VISA.lib
// specify the addressing path
#define E1563 "VXI0::64::INSTR" // VXI addressing
// prototypes
void check(ViSession vi, ViStatus error);
void err_handler(ViSession vi, ViStatus err);
void main(void)
{
ViSession vi;
ViStatus errStatus, err;
ViInt32 rdgs[60000];
ViReal64 range;// range variable for reading conversions
ViInt16 *dataPtr;// pointer to cast readings to 16-bit integers
int i;
ViChar err_message[256];
// open a VXIplug&play device session and reset the digitizer
errStatus = hpe1563_init(E1563,0,1,&vi);
if( VI_SUCCESS > errStatus)
{
hpe1563_error_message( vi, errStatus, err_message);
printf("Unable to open %s\n", E1563);
printf("hpe1563_init() returned error message %s\n", err_message);
return;
}
// enable digitizer error detection
hpe1563_errorQueryDetect(vi, 1);
// set a 5s timeout period to allow functions to complete
errStatus = hpe1563_timeOut(vi, 5000);
check(vi, errStatus);
// configure the digitizer to take 60,000 post-trigger readings
// not to exceed 4V on channel 1
errStatus=hpe1563_configure(vi, 1, 4.0, 60000, 1);
check(vi, errStatus);