From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-04-2017 01:18 AM
Hello everybody, I was advised to repost my original question from the PXI board, to the current board to get more exposure.
So here is the question again,
I have a PXI system on PXIe-1078 chassis, with PXIe-8821 controller (win7, 64bit).
The NI-VISA and NI-488.2 installed.
I have to pick up text messages, or send/receive short text files using GPIB communication.
"Text Message" represents sort of a command to do stuff with my PXI system, then return results to the host.
The communication is synchronous - meaning, the "Host" sends a text command. The listener picks up, performs the action, and return result. Meanwhile, the "Host" waits for MY application to finish the job.
Now, I'm trying to recreate this scenario. Set up a "GPIB listener" on PXI controller, that picks up incoming GPIB events, handles that event, then sends data back.
For now, I'm doing the following:
Simple CVI application to trigger GPIB events on my PC, and other application that picks up these events on PXI PC(the controller).
Here are some of my code details:
GPIB "events" Sending side:
setupFunction()
{
glGPIBdevice = ibfind ("GPIB0");
if(0<glGPIBdevice)
{
ibsic (glGPIBdevice);
ibsre (glGPIBdevice, 1);
ibdev (0, 0, NO_SAD, T30ms, 1, 0);
found = 1;
}
}
sendFunction()
{
status = ibwrt (glGPIBdevice, "HELLO", 5);
}
RECEIVING SIDE (PXI)
main()
{
glHnGPIBDevice = ibfind ("gpib1");
ibrsc (glHnGPIBDevice, 0);
status = ibInstallCallback (1, EVENT, ProcessGPIBEvent, 0);
}
void CVICALLBACK ProcessGPIBEvent()
{
MessagePopup ("GPIB Event", "GPIB event recieved.");
}
For now, that scheme doesn't work for me.
Any ideas what do I miss?
Thanks for the support 🙂
05-05-2017 10:40 AM
Hi @ArtB83,
Are you seeing any errors?
05-15-2017 09:46 AM
Sorry for a delay - I was a bit off the topic.
I'm trying to run NI example from here on 2 PCs - using the GPIB-USB-HS+ .
When I'm running the example on 2 PCs, I'm configuring 1 PC with
ibrsc(noncontroller,0)
the other
ibrsc(controller,1)
And nothing happens until I run the NI-MAX GPIB utilities, like GPIB analyzer, or GPIB scan for instruments.
When I do so, I get a library error on a "controller" PC for ibwrt: (iberr==6[0x6])
And on the "noncotroller" I get the same library error, but for ibrd.
These are my results so far. Any ideas?
05-16-2017 04:46 AM
Here are some more details - I've started using the GPIB Interactive Control from NIMAX. Please see the results in attached screenshots.
I'm trying to reproduce same procedures in CVI :
Here is the code of Controller side :
static int controller;
static int device;
static char buffer[100];
static int panelHandle;
int main ()
{
controller = ibfind ("GPIB0");
ibsic(controller);
ibsre(controller,1);
device = ibdev (0, 1, NO_SAD, T10s, 1, 0);
Delay(0.1);
while (1)
{
// If addressed to talk, send the response "I am a talker"
if ((ibsta&TACS)&&(!(ibsta&ATN)))
{
// Send data across the bus.
ibwrt (device, "I am a talker", strlen("I am a talker"));
ibconfig (device, IbcREADDR, 1);
return 0;
} // second if
}// while
} // main
nonController side:
static int noncontroller;
static char buffer[100];
static int panelHandle;
int main ()
{
// Open a session to the GPIB board
noncontroller = ibfind ("GPIB0");
// Release system control
ibrsc (noncontroller, 0);
// Change primary address from 0 to 1
ibpad (noncontroller, 1);
while (1)
{
// Wait until non-controller is listener and ATN line is dropped.
if ((ibsta&LACS)&&(!(ibsta&ATN)))
{
ibrd (noncontroller, buffer, 20); // Read data bytes
buffer[ibcnt] = '\n'; // Add linefeed and 0 to string.
buffer[ibcnt + 1] = 0;
MessagePopup ("GPIB communication event", buffer);
}
} // while
} // main
Still receive error num - 0x6 - according to GPIB manual it's a timeout error. My timeout is set to 10sec.
My assumption is improper work with TACS, LACS control lines - need help with that, and with GPIB Bus monitoring utility. Where are TACS/LACS located on that utility?
Thanks for the support 🙂
05-16-2017 01:37 PM
Hi ArtB83,
It sais in the example guide that the ibdev command (on the controller) includes GPIB addresses and access board index for the non-controller. I see from your images that you entered the default values as described in the example. Are you sure those are correct for your non-controller GPIB board?
-Mitchell | NI
05-17-2017 01:27 AM
Hi Mitchell,
Yes, I'm sure those are correct values. Tested on the interactive test panel.
For now, looks like I managed to succeed with my final goal. To send GPIB messages between 2 PCs.
Here is the code that I tested and it worked - again, the purpose is to send data back and forth between 2 PCs in pure synchronous way. I have attached 2 modified *.c files from examples that I found online and modified. They represent "listner" and "server" side. It was tested on 2 separate PCs.
I still have some questions regarding TACS and LACS how do they exactly work? Which bit they represent in status word? How does readdresing work? In my current solution, it looks like there is no real control on TALKING and LISTENING cycles. I would glad to know the more elegant way to implement it.
05-17-2017 02:10 PM
Hey ArtB83,
Glad to hear you got your test system working, and on multiple machines!
What are you referring to by TACS and LACS? I am unfamiliar with those acronyms.
05-20-2017 11:41 AM
Hi mfaltin, thank you.
TACS and LACS represent status bits in a status word that returned by "ibsta" macro.
"Based on the status bits set in Ibsta, the application takes whatever action
is appropriate. For example, the application could monitor the status bits TACS (Talker Active State) and LACS (Listener Active State) to determine when to send data to or receive data from the Controller." A quote from user manual.
I still can't figure out for sure how these control lines are functioning or how to operate them.
Regards.
05-25-2017 12:55 PM
Thank you for clarifying what the acronyms are. Could you elaborate a bit on why you think there is no Listening or Talking cycles?