Ejemplo n.º 1
0
bool CGPIBDevice::Open(int nBUS, int nAddr, int nSecAddr)
{
	if(m_hGPIBDLL == NULL && !LoadGPIBDriver())
	{
		return false;
	}

	m_nDev = ibdev(nBUS, nAddr, nSecAddr, 13, 1, 0);
	if (m_nDev < 0 || (ibsta & ERR))
	{
		Log(CCommon::FormatString(_T("Failed to open GPIB device at GPIB::%d::%d::%d!"), nBUS, nAddr, nSecAddr));
		return false;
	}

	short n = 0;
	ibln(m_nDev, nAddr, 0, &n);
	if (n <= 0 || (ibsta & ERR))
	{
		Log(_T("No GPIB listener!"));
		return false;
	}
	else
	{
		Log(_T("GPIB device opened!"));
		ibclr(m_nDev);
		return true;
	}
}
////////////////////////////////////////////////////////////////////////
// Start of Main
int main()
{
  int sg;
  char FreqCom[11], FreqC[7], Amplitude[10], AmpC[4], Modulation[4];
char rd[12];
 
  sg = ibdev (0, 0x15, 0x0, 0, 0, 0); //ADDR=21

  strcpy(FreqC, "127000");
  strcpy(FreqCom, "FR");
  strcat(FreqCom,FreqC);
  strcat(FreqCom,"KZ");
  ibwrt (sg, FreqCom, 10);

  strcpy(AmpC, "+10");
  strcpy(Amplitude, "AP");
  strcat(Amplitude,AmpC);
  strcat(Amplitude,"DM");
  ibwrt (sg, Amplitude, 7);

  strcpy(Modulation, "AM");
  strcat(Modulation,"S4");
  ibwrt (sg, Modulation, 4);

//ibwrt(sg,"IFR",3);
//ibrd(sg,rd,12);
//printf("%s\n",rd);
  return 0;
}
Ejemplo n.º 3
0
void reset_connection_oscillo(void)
{
	address=1; //GPIB address of oscilloscope
	device = ibdev (0, address, NO_SAD, T30s, 1, 0);
	ibsic(device);
	
}
Ejemplo n.º 4
0
int CVIFUNC mouth_InitRF (void)
// Same for all the GPIB modes
{
	int err=0;
	// We only need to do this once
	if (-1==gpibDS345)
		gpibDS345 = ibdev (0, gpibDS345Addr, NO_SAD, T3s, 1, 0);
	errChk(mouth_Error("mouth_InitRF{ibdev call failed}",0,0));
	LastAmp=NoValue;
	LastFreq=NoValue;
Error:
	return (err?-1:0);
}
Ejemplo n.º 5
0
int wxGPIB::OpenDevice(const char* devname, void* dcs)
{
    // if dcs isn't NULL, type cast
    if(dcs) m_dcs = *(wxGPIB_DCS*)dcs;
    
    if(strncmp(devname,"gpib1",5) == 0) m_board = 0;
    else if(strncmp(devname,"gpib2",5) == 0) m_board = 1;
    if(m_board < 0) {
	   return -1;
    }
    // check for a valid timeout
    if((unsigned int)m_dcs.m_timeout > wxGPIB_TO_1000s) {
	   m_dcs.m_timeout = wxGPIB_TO_10us;
    }

    m_hd = ibdev(m_board,
			  m_dcs.m_address1,
			  m_dcs.m_address2,
			  m_dcs.m_timeout,
			  m_dcs.m_eot,
#ifdef __GNUG__
			  // FIXME!
			  // linux-gpib-3.2.08 doesn't work with any EOS (blocks). 
			  // Because we always has to add an EOS on the message 
			  // (independent of the m_eosChar setting), we can ignore it! 
			  0
#else
			  (m_dcs.m_eosMode << 8) | m_dcs.m_eosChar
#endif
	   );
    if(m_hd < 0) {
	   // no gpib controller installed (not found)
	   return -2;
    }
    // test for a connected listener (device with given address)
    short int listen = 0;
    ibln(m_board,m_dcs.m_address1,NO_SAD,&listen);
    if(!listen) {
	   // no listener at the given address
 	   CloseDevice();
 	   return -3;
    }
    // reset device
    ibclr(m_hd);
    // save state, error and count
    m_state = ThreadIbsta();
    m_count = ThreadIbcnt();
    m_error = ThreadIberr();
    // no error
    return 0;
};
Ejemplo n.º 6
0
/***************************************************************************
 *
 * Name:      InitMeter
 * Arguments: None
 * Returns:   handle to opened device
 *
 * Open the device.  If there is an error opening prints a message
 * and exit.  Otherwise set the timeout to 3 seconds. Send a reset
 * command to the meter and set the range to Volts AC.
 *
 ***************************************************************************/
int InitMeter() {
   int  device;
   char spr;
   /**/
   device = ibdev(BOARD_NUM, PAD, SAD, 12, 1, 0);
   if (device >= 0) {
      ibclr (device);
      ibrsp (device,&spr);
      ibtmo (device,T3s);                    /* Set timeout to 3 seconds */
      WriteCommand(device, RESET_CMD);      /* Reset the meter */
      WriteCommand(device, RANGE_CMD);      /* Set to Volts AC range */
   }
   return (device);
}
Ejemplo n.º 7
0
/**
  Open device connected to GPIB.
  @param boardNum Id/number of board to open.
  @param PAD Primary device address in range 1-30 @see PIDsLstnTest
  @param SAD Secondary device address.
  */
int GPIB::open(int boardNum, int PAD, int SAD)
{
    SendIFC(boardNum);
    if ((Ibsta() & ERR) != 0) {
        return -1;
    }

    devId = ibdev(boardNum, PAD, SAD, T1s, 1, 0);
    if (devId >= 0) {
       ibclr(devId);
       ibrsp(devId, &poll);
       ibtmo(devId, T3s);
       SendLLO(boardNum);
    }

    return devId;
}
Ejemplo n.º 8
0
void *gpibPort::portOpen(void)
{
    int ret;
    int gpibAddress;
    int sta;

    gpibAddress = atoi(deviceString);

    handle = ibdev( BDINDEX, gpibAddress, NO_SECONDARY_ADDR, T1s, 1, 0 );
    if ( ibsta & ERR )
    {
        GPIBCleanup( (char*)"Unable to open device" );
        exit( -1 );
    }

    sta = ibconfig( BDINDEX, IbcAUTOPOLL, 0 ); // enable auto serial polling
    if ( sta & ERR )
    {
        GPIBCleanup( (char*)"Problem setting Autopoll" );
        exit( -1 );
    }

    if (eosMode)
    {
        ibeos( handle, eosMode);
    }

    if (eotMode)
    {
        ibeot( handle, eotMode);
    }

    ibtmo( handle, timeout);

    portService();

    Dev = &handle;

    return Dev;
}
Ejemplo n.º 9
0
bool clsGpib::init()
{
    ibdev(0,intAddress,0,10,1,0);

    Send(0,intAddress,"*IDN?",strlen("*IDN?"),DABend);
    char data[50];
    Receive (0,intAddress, data, 50, STOPend);

    QString strData = QString(data);
    QStringList strDataList = strData.split('\n');
    if(strDataList.count()>1)
    {
        strData =strDataList[0];
    }
    else
        strData="";

    if(strData.isEmpty())
    {
        blInit=false;
    }
    else
    {
        if(strData.contains("WAYNE"))
        {

            blInit = true;
        }
        else
        {
            blInit = false;
        }
    }


    return this->blInit;
}
Ejemplo n.º 10
0
void reset_connection_SRS(void)
{
	address=2; //GPIB address of SRS DG 535
	device1 = ibdev (0, address, NO_SAD, T10s, 1, 00001000);
	ibsic(device1);
}
Ejemplo n.º 11
0
/* main program block */
int main () {
 puts("v0.2\n");
 //define some variables and constants
 char command[strsize]; char buff[32]; char buff2[32];
 char response[strsize];
 char cdata[strsize]; char bdata[strsize];
 char cdata0[skip]; char cdata1[skip]; char bdata0[skip]; char bdata1[skip];
 char cdata2[skip]; char cdata3[skip];
 int data0; int data1; int data2; int data3; int datab;
 int count_idx; int counter; int counter_b; int j; int character;
 double array1[30]; double array2[30]; double array3[30]; double arrayb[30];
 double average1;   double average2;   double average3;   double averageb;
 const int minor    = 0;
 const int pad      = 4;//configurable on the 974 by switches
 const int pad_994  = 5;//configurable on the 994 by switches
 const int sad      = 0;
 const int send_eoi = 1;
 const int eos_mode = 0;
 const int timeout  = T1s;
 //initialize arrays
 for(j=0;j<30;j++){
  array1[j]=0.0;  array2[j]=0.0; array3[j]; arrayb[j]=0.0;
 }
 //ask for time of measurement
 puts("Looks like we'll be measuring some data. Please choose."); puts("1   second   -- press 'enter'");
 puts("0.2 seconds  -- press 'a' then 'enter'"); puts("[press x to quit]");
 fgets(buff,32,stdin); if(buff[0]=='x')  return 0;
 //choose singles or accidentals
 puts("Do you want to monitor the singles or the pairs?"); puts("singles -- press 'enter'");
 puts("pairs -- press 'a' then 'enter'"); puts("[press x to quit]");
 fgets(buff2,32,stdin); if(buff2[0]=='x') return 0;
 //make gnuplot pipe and load the startup script
 FILE *pipe_gp = popen("gnuplot -noraise","w");
 fputs("load 'startup_2ch.p'\n", pipe_gp);
 //find the ortec counters
 counter   =  ibdev(minor, pad, sad, timeout, send_eoi, eos_mode);
 counter_b =  ibdev(minor, pad_994, sad, timeout, send_eoi, eos_mode);
 //read startup string
 gpibread(counter, response); gpibread(counter_b, response);
 //initialize device
 gpibwrite(counter,"INIT\n"); gpibwrite(counter_b,"INIT\n");
 //read ok string
 gpibread(counter, response); gpibread(counter_b, response);
 // set to computer mode
 gpibwrite(counter,"COMPUTER\n"); gpibwrite(counter_b,"COMPUTER\n");
 //set to remote control
 gpibwrite(counter,"ENABLE_REMOTE\n"); gpibwrite(counter_b,"ENABLE_REMOTE\n");
 //auto-transmit counter data at end of scan
 gpibwrite(counter,"ENABLE_ALARM\n"); gpibwrite(counter_b,"ENABLE_ALARM\n");
 //display timer on both counters
 gpibwrite(counter,"SET_DISPLAY 1\n"); gpibwrite(counter_b,"SET_DISPLAY 0\n");
 //set the counter time
 if(buff[0]=='a') { // 0.2 seconds
  gpibwrite(counter,"SET_COUNT_PRESET 2,0\n"); gpibwrite(counter_b,"SET_COUNT_PRESET 02,1\n");
 }
 else { // 1 second
  gpibwrite(counter,"SET_COUNT_PRESET 1,1\n"); gpibwrite(counter_b,"SET_COUNT_PRESET 10,1\n");
 }

 //initialize ncurses
 initscr();
 nodelay(stdscr, TRUE);
 noecho();
 keypad(stdscr, TRUE);
 curs_set(0);

 //counting loop
 for(count_idx=1 ; count_idx <= max_counts ; count_idx++) {
  //clear counters
  gpibwrite(counter,"CLEAR_COUNTERS\n"); gpibwrite(counter_b,"CLEAR_COUNTERS\n");
  //start the count
  gpibwrite(counter,"START\n");  gpibwrite(counter_b,"START\n");
  gpibread(counter, cdata);      gpibread(counter_b, bdata);
  gpibwrite(counter_b,"STOP\n"); gpibwrite(counter,"STOP\n");
  //process the string
  memcpy(cdata0,cdata,8);        cdata0[8]='\0';
  memcpy(cdata1,cdata+skip,8);   cdata1[8]='\0';
  memcpy(cdata2,cdata+2*skip,8); cdata2[8]='\0';
  memcpy(cdata3,cdata+3*skip,8); cdata3[8]='\0';
  data0 = atoi(cdata0); data1 = atoi(cdata1);
  data2 = atoi(cdata2); data3 = atoi(cdata3);
  memcpy(bdata0,bdata,8);        bdata0[8]='\0';
  memcpy(bdata1,bdata+skip,8);   bdata1[8]='\0';
  datab = atoi(bdata1);
  //build the array
  for (j=0;j<30;j++) {
   array1[j]=array1[j+1]; array2[j]=array2[j+1]; array3[j]=array3[j+1]; arrayb[j]=arrayb[j+1];
  }
  array1[29]=data1; array2[29]=data2; array3[29]=data3; arrayb[29]=datab;
  //calculate the average
  average1=0.0; average2=0.0; average3=0.0; averageb=0.0;
  for (j=0;j<10;j++) {
   average1 = average1+array1[29-j]; average2 = average2+array2[29-j];
   average3 = average3+array3[29-j]; averageb = averageb+arrayb[29-j];
  }
  average1=average1/10.0; average2=average2/10.0; average3=average3/10.0; averageb=averageb/10.0;
  //plot some stuff
  fprintf(pipe_gp,"set title \"idx=%d Ch1=%d (av=%0.1f), Ch2=%d (av=%0.1f), Ch3=%d (av=%0.1f)\\n pairs-accs=%d (av=%0.1f), accs=%d (av=%0.1f)\"\n",count_idx,data1,average1,data2,average2,data3,average3,data3-datab,average3-averageb,datab,averageb);
  fputs("plot '-' w boxes ti 'channel 1' axes x1y1, '-' w boxes ti 'channel 2' axes x1y2\n", pipe_gp);
  if(buff2[0]=='a') {
   for (j=0;j<30;j++) {
    fprintf(pipe_gp, "%f %f\n", j+0.25 ,array3[j]-arrayb[j]);
   }
   fprintf(pipe_gp, "e\n");
   for (j=0;j<30;j++) {
    fprintf(pipe_gp, "%f %f\n", j+0.75, arrayb[j]);
   }
   fprintf(pipe_gp, "e\n");
  }
  else {
   for (j=0;j<30;j++) {
    fprintf(pipe_gp, "%f %f\n", j+0.25 ,array1[j]);
   }
   fprintf(pipe_gp, "e\n");
   for (j=0;j<30;j++) {
    fprintf(pipe_gp, "%f %f\n", j+0.75, array2[j]);
   }
   fprintf(pipe_gp, "e\n");
  }
  //remember to flush!
  fflush(pipe_gp);
  //if theres a keypress, gotta press the killswitch
  if (keywaiting(&character)) break;
 }
 //close the pipe
 pclose(pipe_gp);
 //done with ncurses
 clear();
 refresh();
 endwin();
 //end of code
 return 0;
}
Ejemplo n.º 12
0
int _cdecl main(void) {
	// Ensure that the board being used is Controller-In-Charge

	SendIFC(GPIB0);
	if (ibsta & ERR)
	{
		GPIBCleanup(GPIB0, "Unable to open board");
		return 1;
	}

	// Assign the scope an identifier

	int Dev = ibdev(BDINDEX, PRIMARY_ADDRESS, SECONDARY_ADDRESS,
		TIMEOUT, EOTMODE, EOSMODE);
	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to open device");
		return 1;
	}

	ibclr(Dev);
	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to clear device");
		return 1;
	}

	// Preliminary querying

	printf("Querying scope with [*IDN?] ...\n");

	ibwrt(Dev, "*IDN?", 5L);
	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to write to device");
		return 1;
	}

	ibrd(Dev, ReadBuffer, 80);
	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to read data from device");
		return 1;
	}

	ReadBuffer[ibcntl] = '\0';
	printf("%s\n\n", ReadBuffer);

	// Prepare scope for waveform

	ibwrt(Dev, "DAT:SOU CH1", 11L);
	ibwrt(Dev, "DAT:ENC RIB;WID 1", 17L);
	ibwrt(Dev, "HOR:RECORDL 500", 15L);
	ibwrt(Dev, "DAT:STAR 1", 10L);
	ibwrt(Dev, "DAT:STOP 500", 12L);
	ibwrt(Dev, "HEAD OFF", 8L);

	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to initialize waveform parameters");
		return 1;
	}

	ibwrt(Dev, "ACQ:STATE RUN", 13L);

	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to acquire waveform");
		return 1;
	}

	ibwrt(Dev, "CURV?", 5L);
	ibrd(Dev, &c, 1);
	ibrd(Dev, &c, 1);
	rslt = atoi(&c);
	ibrd(Dev, ReadBuffer, rslt);
	ReadBuffer[rslt] = '\0';
	rslt = atoi(ReadBuffer);
	ibrd(Dev, wfm, rslt);
	ibrd(Dev, &c, 1);

	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to read waveform");
		return 1;
	}

	ibwrt(Dev, "WFMPRE:CH1:NR_PT?;YOFF?;YMULT?;XINCR?;PT_OFF?;XUNIT?;YUNIT?", 59L);

	memset(ReadBuffer, 0, 80);

	ibrd(Dev, ReadBuffer, 80);

	if (ibsta & ERR)
	{
		d_GPIBCleanup(Dev, "Unable to read waveform preamble");
		return 1;
	}

	sscanf_s(ReadBuffer, "%d;%e;%e;%e;%d;%[^;];%s", &nr_pt, &yoff, &ymult, &xincr, &pt_off, xunit, yunit);

	//outfile = fopen("WFM_DATA.dat", "wb");

	//_strdate(date);
	//_strtime(timenow);

	//fprintf(outfile, "%s,%s,\"%s\",\"%s\",\"%s\"\n", xunit, yunit, date, timenow, "CH1");

	//for (i = 0; i<nr_pt; i++)
	//{
	//	fprintf(outfile, "%14.12f,%14.12f\n", (float)(i - pt_off)*(float)(xincr),
	//		(float)(((float)wfm[i] - (float)yoff) * ymult));
	//}

	//fclose(outfile);
	// Offline the board and end
	ibonl(GPIB0, 0);
	return 0;
	//// Ensure that the board being used is Controller-In-Charge
	//SendIFC(GPIB0);
	//if (ibsta & ERR)
	//{
	//	GPIBCleanup(GPIB0, "Unable to open board");
	//	return 1;
	//}

	//// Create an array containing valid GPIB primary addresses to
	//// pass to FindLstn, terminated by decl-32's NOADDR
	//for (loop = 0; loop < 30; loop++) {
	//	Instruments[loop] = (Addr4882_t)(loop + 1);
	//}
	//Instruments[30] = NOADDR;

	//// Find all instruments on the bus, store addresses in Result
	//printf("Finding all instruments on the bus...\n\n");

	//FindLstn(GPIB0, Instruments, Result, 31);
	//if (ibsta & ERR)
	//{
	//	GPIBCleanup(GPIB0, "Unable to issue FindLstn Call");
	//	return 1;
	//}

	//// Assign the number of isntruments found and print such a number
	//Num_Instruments = ibcntl;

	//printf("Number of instruments found = %d\n\n", Num_Instruments);

	//Result[Num_Instruments] = NOADDR;

	////Print out each instrument's PAD and SAD

	//for (loop = 0; loop < Num_Instruments; loop++)
	//{
	//	PAD = GetPAD(Result[loop]);
	//	SAD = GetSAD(Result[loop]);
	//	Primary_Addr[loop] = PAD;

	//	if (SAD == NO_SAD)
	//	{
	//		Secondary_Addr[loop] = 0;
	//		printf("The instrument at Result[%d]: PAD = %d SAD = NONE\n\n",
	//			loop, PAD, SAD);
	//	}
	//	else
	//	{
	//		Secondary_Addr[loop] = SAD;
	//		printf("The instrument at Result[%d]: PAD = %d SAD = %d\n\n",
	//			loop, PAD, SAD);
	//	}

	//}

	//// Assign each device an identifier, then clear the device

	//for (loop = 0; loop < Num_Instruments; loop++)
	//{
	//	Dev[loop] = ibdev(BDINDEX, Primary_Addr[loop], Secondary_Addr[loop],
	//		TIMEOUT, EOTMODE, EOSMODE);
	//	if (ibsta & ERR)
	//	{
	//		d_GPIBCleanup(Dev[loop], "Unable to open device");
	//		return 1;
	//	}

	//	ibclr(Dev[loop]);
	//	if (ibsta & ERR)
	//	{
	//		d_GPIBCleanup(Dev[loop], "Unable to clear device");
	//		return 1;
	//	}
	//}

	//// Communicate with each device
	//// Currently, only querying with "*IDN?"

	//printf("Querying each device with [*IDN?] ...\n\n");

	//for (loop = 0; loop < Num_Instruments; loop++)
	//{
	//	ibwrt(Dev[loop], "*IDN?", 5L);
	//	if (ibsta & ERR)
	//	{
	//		d_GPIBCleanup(Dev[loop], "Unable to write to device");
	//		return 1;
	//	}

	//	ibrd(Dev[loop], ReadBuffer, ARRAYSIZE);
	//	if (ibsta & ERR)
	//	{
	//		d_GPIBCleanup(Dev[loop], "Unable to read data from device");
	//		return 1;
	//	}

	//	ReadBuffer[ibcntl] = '\0';
	//	printf("Returned string from Result[%d]: %s\n\n", loop, ReadBuffer);
	//}

	//scanf_s("%c", &c);

	//// Offline the board and end
	//ibonl(GPIB0, 0);
	//return 0;
}
Ejemplo n.º 13
0
void main() {

    printf("Read 10 measurements from the Fluke 45...\n");
    printf("\n");

/*
 *  Assign a unique identifier to the Fluke 45 and store in the variable
 *  DVM.  IBDEV opens an available device and assigns it to access GPIB0
 *  with a primary address of 1, a secondary address of 0, a timeout of
 *  10 seconds, the END message enabled, and the EOS mode disabled.
 *  If DVM is less than zero, call GPIBERR with an error message.
 */

    dvm = ibdev (0, 1, 0, T10s, 1, 0);
    if (dvm < 0) gpiberr("ibdev Error");

/*  Clear the internal or device functions of the Fluke 45.             */

    ibclr (dvm);
    if (ibsta & ERR) gpiberr("ibclr Error");

/*
 *  Reset the Fluke 45 by issuing the reset (*RST) command.  Instruct the 
 *  Fluke 45 to measure the volts alternating current (VAC) using auto-ranging
 *  (AUTO), to wait for a trigger from the GPIB interface board (TRIGGER 2),
 *  and to assert the IEEE-488 Service Request line, SRQ, when the measurement
 *  has been completed and the Fluke 45 is ready to send the result (*SRE 16). 
 */

    ibwrt (dvm,"*RST; VAC; AUTO; TRIGGER 2; *SRE 16", 35L);
    if (ibsta & ERR) gpiberr("ibwrt Error");

/*  Initialize the accumulator of the 10 measurements to zero.              */

    sum = 0.0;

/*
 *  Establish FOR loop to read the 10 measuements.  The variable m will
 *  serve as the counter of the FOR loop.
 */

    for (m=0; m < 10 ; m++) {

     /*  Trigger the Fluke 45.                                       */

         ibtrg (dvm);
         if (ibsta & ERR) gpiberr("ibtrg Error");

     /*
      *  Request the triggered measurement by sending the instruction
      *  "VAL1?". 
      */

         ibwrt (dvm,"VAL1?", 5L);
         if (ibsta & ERR) gpiberr("ibwrt Error");

     /*
      *  Wait for the Fluke 45 to request service (RQS) or wait for the 
      *  Fluke 45 to timeout(TIMO).  The default timeout period is 10 seconds. 
      *  RQS is detected by bit position 11 (hex 800).   TIMO is detected
      *  by bit position 14 (hex 4000).  These status bits are listed under
      *  the NI-488 function IBWAIT in the Software Reference Manual.  
      */

         ibwait (dvm,TIMO|RQS);
         if (ibsta & (ERR|TIMO)) gpiberr("ibwait Error");

     /*  Read the Fluke 45 serial poll status byte.                  */

         ibrsp (dvm, &spr);
         if (ibsta & ERR) gpiberr("ibrsp Error");

     /*
      *  If the returned status byte is hex 50, the Fluke 45 has valid data to
      *  send; otherwise, it has a fault condition to report.  If the status
      *  byte is not hex 50, call DVMERR with an error message.
      */

         if (spr != 0x50) dvmerr("Fluke 45 Error", spr);
     
     /*  Read the Fluke 45 measurement.                              */
         
         ibrd (dvm,rd,10L);
         if (ibsta & ERR) gpiberr("ibrd Error");

     /*
      *  Use the null character to mark the end of the data received
      *  in the array RD.  Print the measurement received from the
      *  Fluke 45.  
      */

         rd[ibcnt] = '\0';
         printf("Reading :  %s\n", rd);

     /*  Convert the variable RD to its numeric value and add to the
      *  accumulator.    
      */

         sum = sum + atof(rd);

    }  /*  Continue FOR loop until 10 measurements are read.   */

/*  Print the average of the 10 readings.                                  */

    printf("   The average of the 10 readings is : %f\n", sum/10);

    ibonl (dvm,0);         /* Disable the hardware and software            */

}