Yes, this can, and HAS been done! Admittedly, this is an ADVANCED GPIB
WHY would you want to do this? You may need to have the "black box computer"
translate GPIB commands originally intended for one instrument, so you can use a
newer replacement instrument. It may be the case that the original source code
and/or developement software tools are no longer available. (Think old,
On the other hand, if you just need to log GPIB traffic, and pass it on, then
NI's GPIB+ Analyzer card is all you need.
But if you really need to modify the GPIB commands on the fly, then you need TWO
GPIB cards in the black box computer.
The first card is setup/programmed to NOT be a system controller, and board
level IBRD and IBWRT calls are made to receive and send GPIB messages with the
(main) GPIB controller. Just put the IBRD and IBWRT in a loop, and use a short
timeout, say .1 second. Most of the time, these will timeout. But when the
(main) controller sends a message, the IBRD won't timeout, and your program then
knows it has recieved a new GPIB message from the main controller. Likewise,
when you need to send a response back to the main controller, just keep calling
IBWRT until it doesn't time out, then you know the main controller received it.
The second GPIB would be setup/programmed in the normal way, as GPIB system
The application software running on the black box computer would recieve a GPIB
message on the first (talker/listener) GPIB, process it in some way, then send
it to the instrument on the second (controller) GPIB.
I myself wrote a program for Tektronix TLA700 logic analyzers that makes the NI
PCMCIA-GPIB controller card behave exactly like a GPIB Talker/Listner. The
program parses the received GPIB commands and executes them by making calls to
the TLA700 software. This program was written in VB6 and is available from
(note: I no longer work for Tek...)
Consulting Applications Engineer
148 Main Street
Building A, 3rd Floor
North Andover, MA 01845
603-598-4773 (Direct Line and Cell)
Carsten Gruening wrote:
> I am trying to develop some sort of 'computer black box' (a computer
> with a GPIB - board and some software) to catch all GPIB commands
> from a controller to a device and back.
> The commands from the controller must be interpreted by the 'black box'
> and then send to the device - and the other way around.
> Has anybody some ideas how to do this? I would be VERY happy to
> get some sample code in c/c++.
> Thanks in advance,
> P.S.: My problem is that it seems that I have 2 contoller on the bus at some
> time which causes problems.