07-06-2010 12:59 PM
Thanks for the fast reply. So I am trying to just write the codes without the driver. First, I would like to initialize the device. Should I do that via the VISA commands, or ib commands? So far I have this:
VM = ibdev (0, 7, NO_SAD, T10s, 1, 0); //Nano Volt Meter
if (iberr != 0) return iberr;
Csrc=ibdev (0, 23, NO_SAD, T10s, 1, 0); //Current Source
if (iberr != 0) return iberr;
MUX = ibdev (0, 10, NO_SAD, T10s, 1, 0); //MUX
if (iberr != 0) return iberr;
.
.
.
When I execute this as the beginning of my initialization, I get a NON FATAL RUN TIME ERROR, iberr = 7. I looked that error up and it says that "The GPIB interface board does not exist, its driver is not loaded, or it is not configured properly." However, I can communicate with this device via MAX and there is no problem. But I noticed that MAX uses VISA commands. So what am I doing wrong that I can't connect to this device in CVI?
07-06-2010 03:33 PM
How can I get my instruments' handles? I need that to write commands with VISA
07-07-2010 06:47 PM
Hi ArashE,
If you are looking to implement VISA communication, I would suggest looking at some of the shipping examples. You can locate these within the NI Example Finder from LabWindows CVI (Help»Find Examples) and access other C source code files from Start»Programs»National Instruments»VISA»Examples.
08-26-2010 04:49 PM
Keithley 2420 is the high power version of Keithley 2400. Following partial codes are what I use to control Keithley 2400 through GPIB.
You should be able to modify the codes for your application.
//---------------------------------------------------------------------------------------------------------------------------------------------------
#include <utility.h>
#include <formatio.h>
#include <gpib.h>
#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
#include <cvirte.h>
#define GPIB_card 0
#define KE2400_GPIBaddr 19
static int KE2400Sweep; // the user panel
char set_state_cmd[200], str_buffer[100];
double IV[5];
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((KE2400Sweep = LoadPanel (0, "KE2400_rev.uir", PANEL)) < 0)
return -1;
if (SUCCESSFUL!=OpenKE2400())
return -1;
DisplayPanel (KE2400Sweep);
RunUserInterface ();
DiscardPanel (KE2400Sweep);
return 0;
}
int OpenKE2400(void) //initialize source meter
{
short dev_ready = FALSE;
char message[50];
KE2400 = ibdev(GPIB_card, KE2400_GPIBaddr, 0, T10s, 1, 0);
ibln(KE2400, KE2400_GPIBaddr, NO_SAD, &dev_ready);
if ( dev_ready != TRUE )
{
sprintf(message, "KE2400 Source meter is not ready!");
MessagePopup ("Device Error", message);
return -1;
}
else
return SUCCESSFUL;
}
.............
//set source meter to souce voltage, reading current, and set compliance current
Fmt (set_state_cmd, "%s<:Sens:Func:Conc Off;:Sour:Volt:Rang:Auto On;:Sour:Func Volt;:Sens:Func 'Curr:DC';:Sens:Curr:Prot %f\n", compI);
ibwrt (KE2400, set_state_cmd, strlen(set_state_cmd));
//set source voltage value, and turn output on
Fmt (set_state_cmd, "%s<:Sour:Volt %f;:Sour:Del 0.1;:Output On\n", presentV);
ibwrt (KE2400, set_state_cmd, strlen(set_state_cmd));
...............
ibwrt (KE2400, ":Read?\n", 6); //read results from source meter
ibrd (KE2400, str_buffer, 99);
Scan(str_buffer, "%s>%5f[x]", &IV); //save results in an array
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------