07-12-2007 09:56 AM
07-12-2007 09:58 AM
Oops, my mistake, as I am not familiar with the HP command set and I guess I didn't get the difference between "OUTPUT" and "OUTP". Thanks for setting the record straight, Dennis!
gpibtester
07-12-2007 10:06 AM
Imai,
If you attempt to do a GPIB read when you issue a command like FM:STAT ON, you will always get an error because doing a read is just plain WRONG. GPIB instruments don't work that way and I don't believe it works with the 8648. The only time you can do a read is when you issue a command with a ? at the end. That is what tells the instrument that you are requesting data. Without the ?, the transmit buffer on the instrument wil be empty. You might want to google 'GPIB tutorial' to get a better understanding of GPIB.
02-25-2011 05:20 AM
Hi D beil ,
I am able to configure the USB.
I am having GPIB-USB-HS( Nationa Instrumnets).
I am facing one issue i am not able to make the device as non controller.
For controller i am using the ibtest program given in the linux-gpib-3.2.14 examples. from ibtest i am opening the board and sending the command 33 for making other gpib device as listner. Now i am making the board terminal as talker device and sending the data.
Data sent is recived at the Non controller end now i am calling the ibwrt API for writing the response. For this again i am sending the command 65 for making the non controller as Talker now. But it is not getting change to talker the ibsta shows still the listner bit is set.
The behaviur is inconsitence one in ten time i am able to make the device as listner and able to read the data through ibtest program.
I am working on non controller part only. Any help in this will be helpful
for non controller i am using the following program:
#include "gpib/ib.h"
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
using namespace std;
static char buffer[100];
static int panelHandle;
static int noncontroller;
int main ()
{
printf("entered main ");
cout <<"entered main "<<endl;
int err;
// Open a session to the GPIB board
// err = noncontroller = ibfind ("violet");
err = noncontroller = ibfind ("usb_connector");
//noncontroller = ibfind ("gpib0");
cout <<"ibfind done "<<endl;
cout << err << endl;
// Release system control
err = ibrsc (noncontroller, 0);
cout <<"released "<<endl;
cout << err << endl;
// Change primary address from 0 to 1
err = ibpad (noncontroller, 1);
cout << err << endl;
cout << "LACS="<<(err&LACS) << endl;
// uint8_t ret = MLA (1);
// cout << "MLA ="<<(int)ret << endl;
while (1)
{
//cout <<"before ibwait "<<endl;
// Update Status variable
err = ibwait (noncontroller, 0);
cout <<"after ibwait status =" <<err<<endl;
//cout <<"after ibwait "<<endl;
// Wait until non-controller is listener and ATN line is dropped.
if ((ibsta&LACS)&&(!(ibsta&ATN)))
{
cout <<"reading "<<endl;
cout<<"LACS is set"<<endl;
ibrd (noncontroller, buffer, 100); // Read data bytes
printf ("%s\n",buffer); //print buffer
buffer[ibcnt] = '\n'; // Add linefeed and 0 to string.
buffer[ibcnt + 1] = 0;
printf ("%s",buffer); //print buffer
//return 0;
//Send (noncontroller, 0, "Iamat alker", 13, 0);
// If addressed to talk, send the response "I am a talker"
if ((ibsta&TACS)&&(!(ibsta&ATN)))
{
// cout <<"writing "<<endl;
cout<<"TACS is set"<<endl;
// ibrsv(noncontroller, 64);
// Send data across the bus.
//ibwrt (noncontroller, "I am a talker", strlen("I am a talker"));
ibwrt (noncontroller, "I am a talker", 13);
//send (noncontroller, 0, "I am a talker", 13, 0);
//return 0;
} // second if
//}
} // while
return 0;
} // main
02-28-2011 09:48 AM
himanshu's post was mistakenly posted on wrong thread. Please check out the rest of the conversation here.