08-19-2010 12:16 PM
Hello guys,
is anyone have LabWindows .prj files for controlling Keithley 6487 via GPIB? Yes i know i already can make it but it would be great using some expert users projects instead of my poor tryings.
Thanks for your attention,
Teoman Özdal
MKU, Hatay, Turkey
08-19-2010 02:14 PM - edited 08-19-2010 02:17 PM
Keithley 6485/6487 share many same GPIB commands and functions. Following C codes are the basic functions that
I use to control both equipment through GPIB. No driver is needed to download or install.
I'm not a professional programmer, but the codes works just fine for me. Should be helpful to you.
//==================================================================================
#include <cvirte.h>
#include <userint.h>
#include <ansi_c.h>
#include <formatio.h>
#include <gpib.h>
static int GPIB_card=0;
//----------- For Keithley 6485/6487 Picoampmeter ----------------
static int KE6485_addr=14;
static int devKE6485=0;
int Keithley_measure_mode=0; // 0 meaning one-shot mode, 1, continuous mode
char rd_buffer[50];
int InitKE6485(void);
void read_KE6485(double *current);
double amp;
//----------------------------------------------------------------
int InitKE6485(void)
{
short dev_ready=0;
devKE6485 = ibdev (GPIB_card, KE6485_addr, NO_SAD, T3s, 1, 0);
ibln(devKE6485, KE6485_addr, NO_SAD, &dev_ready);
if ( !dev_ready )
{
MessagePopup ("Device Error", "Keithley picoampmeter is not ready!");
return FALSE;
}
else
{
ibwrt (devKE6485, "SYST:ZCH 0", 10); // disable 0 check
ibwrt (devKE6485, "AVER 0", 6); // disable digital average filter
ibwrt (devKE6485, "MED 0", 5); // disable median filter
ibwrt (devKE6485, "CURR:NPLC 1", 11); // set NPLC to 1
ibwrt (devKE6485, "DISP:DIG 6", 10); // 5 digit resolution
}
return SUCCESSFUL;
}
void read_KE6485(double *current)
{
ibwrt (devKE6485, "READ?", 5);
ibrd (devKE6485, rd_buffer, 45); // the returned string is 43 bytes long
Scan (rd_buffer, "%s>%f", current); // only reads the first value
}
Continuous measurement mode:
ibwrt (devKE6485, "TRIG:COUN INF", 13);
ibwrt (devKE6485, "INIT", 4);
One-shot measurement mode:
ibwrt (devKE6485, "ABOR", 4); // stop continuous measure mode
ibwrt (devKE6485, "TRIG:COUN 1", 11); // one-shot measurement mode
Upon exitting your porgram, use following commands
ibwrt (devKE6485, "SYST:ZCH 1", 10); // enable 0 check for protection
ibloc (devKE6485); // set Keithley meter back to local mode
ibonl (devKE6485, OFF);
//==========================================================================================
08-19-2010 04:42 PM
Oh thank you very much dcl9000,
but how can i use this C codes? Could you please explain it? Thank you.
08-21-2010 06:45 AM
Guys, any answer please?
08-21-2010 07:03 AM
Hi,
one possibility to better understand this code might be to also have a look at the sample provided with CVI, gpibrw.cws
In general, moving the mouse over a function call and e.g. pressing Ctrl+P will bring up a popup panel with the required parameters. Here you can press F1 on each individual parameter, or Shift+F1 for the complete function help.
08-22-2010 06:06 PM
Hey Wolfgang,
that is what my problem you are talking about. Thanks anyway, but it could be great for me if someone share a project.
08-24-2010 02:53 PM
Hi! Rakinroll,
To communicate with the equipment after establishing the connection with ibdev(...) function, you send commands using ibwrt(...) and read data using ibrd(...). That's almost all you need. The rest is to learn how to develop a CVI project and incorporate the functions into your codes to complete what you want to accomplish.