03-09-2010 09:08 AM
Hi,
I'm really new of GPIB programming and I'm experiencing some problems in communicating with an Agilent 81110A Pulse Generator.
Preliminary:
- I'm using a NI USB-HS. This board is recognized
- I've downloaded some GPIB examples and I can create a Visual C++ project that works (so I can include the Gpib-32.obj, the header file is recognized, etc...) and I can build my program.
This to say that I don't think that the problem is the communication.
Then, I'm trying to control the Pulse Generator.
This is what I wrote until now:
int Dev; // Device handle
char ReadBuffer[MYSIZE + 1]; // Read data buffer
char ErrorMnemonic[21][5] = {"EDVR", "ECIC", "ENOL", "EADR", "EARG",
"ESAC", "EABO", "ENEB", "EDMA", "",
"EOIP", "ECAP", "EFSO", "", "EBUS",
"ESTB", "ESRQ", "", "", "", "ETAB"};
//Get device handle
Dev = ibdev (BDINDEX, PRIMARY_ADDR_OF_DMM, NO_SECONDARY_ADDR, TIMEOUT, EOTMODE, EOSMODE);
if (ibsta & ERR)
{
GPIBCleanup(Dev, "Unable to open device"); //This is a function to get the error I've find in the examples. It is included in my code
errorLabel1->setText("Unable to open device"); //This is to display the error on the GUI (using QT library)
}
//Clear the device
ibclr (Dev);
if (ibsta & ERR)
{
GPIBCleanup(Dev, "Unable to clear device");
errorLabel2->setText("Unable to clear device");
}
//Identification write
ibwrt (Dev, "*IDN?", 5L);
if (ibsta & ERR)
{
GPIBCleanup(Dev, "Unable to write to device");
errorLabel3->setText("Unable to write the device");
}
//Read identification code
ibrd (Dev, ReadBuffer, MYSIZE);
if (ibsta & ERR)
{
GPIBCleanup(Dev, "Unable to read data from device");
errorLabel4->setText("Unable to read data from device");
} else {
ReadBuffer[ibcntl] = '\0';
errorLabel4->setText(ReadBuffer);
}
char *channel = "OUTP1 ON";
ibwrt (Dev, &channel, strlen(channel));
The thing that doesn't work is the last command, where I try to turn On the channel one of the device. So, for example, I correctly get the string that describe the Agilent Pulse generator.
A couple of things I've noticed:
- in the examples I have they don't use the Pointer data-type.
- I don't turn off the device at the end, but this shouldn't be a problem.
Thanks in advance for any answer you can give me
Francesco.
03-10-2010 03:28 AM
Dear Fransesco,
thank you so much for your post on our webforum. I'm no Visual C++ expert, so I can't help you with this programming issue. NI support goes to the level that the GPIB card communicates correctly; we can use MAX to test this. For the right commands / handling you should contact the manufacturer.
I noticed an instrument driver which can make it easier to implement the communication with your 81110A device, please find the download page under this link.
I hope this helps you further,
Best regards,
03-10-2010 07:03 AM
09-05-2012 05:36 AM
Hi, I'm using Keithley 4200 and Agilent 81110a pulse generator,
I also need to take DC sweep measurement and control pulse generator by GPIB
But I'm totally begginner with the instruments and their program.
Could you shall your program code with me????? If one day I could succedd editng your code to mine, I will also shall with you.
My email is jinshengzhi86@hotmail.com
Please help me~~~~~~~~~~
Thank you.
09-05-2012 08:10 AM
@성지 wrote:
Hi, I'm using Keithley 4200 and Agilent 81110a pulse generator,
I also need to take DC sweep measurement and control pulse generator by GPIB
But I'm totally begginner with the instruments and their program.
Could you shall your program code with me????? If one day I could succedd editng your code to mine, I will also shall with you.
My email is jinshengzhi86@hotmail.com
Please help me~~~~~~~~~~
Thank you.
No need to spam this message board with asking for help.