04-27-2011 03:34 PM
Hi,
How can read the frequency from an instrument using labwindows? I am using HP 53131A (frequency counter).
04-27-2011 03:53 PM
Depending on how you connect to the instrument, you can download the appropriate driver from this page and integrate it into your application
04-27-2011 04:01 PM
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?
04-27-2011 04:36 PM
I got it, thanks. ibwrt() and ibrd() will do the job.
04-28-2011 04:29 AM
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