// set an immediate trigger
errStatus = hpe1563_trigEvent(vi, 1, hpe1563_TRIG_IMM, 0.0); check(vi, errStatus);
// set the minimum sample period
errStatus = hpe1563_sampTim(vi, hpe1563_SAMP_TIM_MIN); check(vi, errStatus);
//disable digitizer error detection hpe1563_errorQueryDetect(vi, 0);
//initiate the digitizer
errStatus = hpe1563_initImm(vi);
//pause 78 ms
//transfer the (60,000) readings from the digitizer using the VISA
//function viMoveIn32 - use the same session name (vi) opened for
//VXIplug&play
err = viMoveIn32(vi, VI_A16_SPACE, 0x08, 60000, (ViPUInt32)rdgs); if(err < VI_SUCCESS) err_handler(vi, err);
//confirm readings transferred are valid dataPtr = (ViInt16 *)rdgs;
//query digitizer reading range
errStatus = hpe1563_range_Q(vi, 1, &range); printf("Reading samples are:\n\n");
for (i=0; i<10; i+=2)
{
printf("%lf\n\n",dataPtr[i]*range/32768);
}
//reset digitizer following the transfer errStatus = hpe1563_reset(vi);
//close the device session
hpe1563_close(vi);// HP VXIplug&play session
}
//************************************************************ // error checking routine
void check (ViSession vi, ViStatus errStatus)
{
ViInt32 inst_err;
ViChar err_message[256];
if(VI_SUCCESS > errStatus)
{
if(hpe1563_INSTR_ERROR_DETECTED == errStatus)
{
Chapter 3 | VXI Programming Using the IEEE 1394 Serial Bus 41 |