LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from instrument

Hi,

 

How can read the frequency from an instrument using labwindows? I am using HP 53131A (frequency counter).

0 Kudos
Message 1 of 5
(3,034 Views)

Depending on how you connect to the instrument, you can download the appropriate driver from this page and integrate it into your application



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,032 Views)

I should have specified this. I am using a GPIB connection. and I am creating a CVI to write and read....

 

Also how can I implement the "waituntildone" Need after Write, before Read?

0 Kudos
Message 3 of 5
(3,029 Views)

I got it, thanks.  ibwrt() and ibrd() will do the job.

0 Kudos
Message 4 of 5
(3,015 Views)

Gembo,

 

Using ibwrt and ibrd to connect to a 53131, is quite complicated as you need to understand what commands to send to the instrument and what answers to expect.

An easier way is to use a so called "instrument driver" for 53131a you can download it from this link http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:id/q/53131a/, it is a zip file named hp5313xa.zip, that contains an function tree file HP5313XA.FP, source and header files, also a doc file in which each function is explained.

 

Using this instrument driver hides all the low level GPIB implementation, taking measurements from the instuments becomes easy.

 

First you need to open an instrument sesion using Initialize function (hp5313xa_init). Than you have to configure your instrument measurement, you can do it with various config type functions, configure the trigger type, level etc, arm the instrument and than read measurements. When you are done with the instrument, you have to close instrument sesion.

 

An example for taking measurements with this instrument driver

 

#include "HP5313XA.h"
#include <userint.h>
#include <cvirte.h>


static ViReal64 Ch1Freq;
static ViStatus status;
static ViSession Handle53131A = 0L;

 

 

int main (int argc, char *argv[])
{
 
 char ErrorMsg[1024];
 
 if (InitCVIRTE (0, argv, 0) == 0)
  return -1;    /* out of memory */
 
 status = hp5313xa_init ("GPIB::1::INSTR", VI_ON, VI_ON, 1, &Handle53131A);  /*  Open instrument session       */
 if(status != VI_SUCCESS) goto ErrorHandling;
 
 /*
 
 Here you have to configure measurement type, trigger and arm instrument for measurement
 
 */
 
 status = hp5313xa_queryMeas (Handle53131A, 3, 0, &Ch1Freq);      /*  Take measurement        */
 if(status != VI_SUCCESS) goto ErrorHandling;

 hp5313xa_close (Handle53131A);             /*  Close instrument session       */
 return 0;
 
ErrorHandling:
 
 hp5313xa_errorMessage (Handle53131A, status, ErrorMsg);       /*  Convert error code to readable message error  */
 MessagePopup("Error !!!", ErrorMsg);

 if(Handle53131A != 0L) hp5313xa_close (Handle53131A);       /*  Close session         */
  return(-1);
}

 

Regards 

0 Kudos
Message 5 of 5
(3,007 Views)