Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

connecting two gpib-boards

hi,
i have 2 gpib-boards on two different machines. i am trying to communicate
between the cards. unfortunately i have timing problems. the boards will
lock up after a very short time.
does anybody have programmed something like this in an ms c++ environment?
basically i just want to use the cards to send data fast between the two
pcs.

any ideas are highly appreciated.

h
0 Kudos
Message 1 of 4
(4,076 Views)
I did this some years ago in QuickBASIC and later in Visual BASIC. It's not
hard and NI even has an App Note that describes this...

One GPIB is programmed in the normal way.

The other is NOT a system controller, and board level (vs. device level) IBWRT
and IBRD calls are used. Just put the IBRD and IBWRT in a loop, and use a
short timeout, like 100 milliseconds. Most of the time, they will timeout,
just ignore it and keep looping. When you DONT get a timeout, then you know
the GPIB controller (in the other machine) sent or received something. I used
some global variable for send and receive buffers. When IBRD eventually
didn't timeout, then I knew my RD$ buffer had a new message from the
controller. When I wanted to send something, I used SND$
and when IBWRT
eventually didn't timeout, then I knew the controller had received my message.

Good luck!

henning hummert wrote:

> hi,
> i have 2 gpib-boards on two different machines. i am trying to communicate
> between the cards. unfortunately i have timing problems. the boards will
> lock up after a very short time.
> does anybody have programmed something like this in an ms c++ environment?
> basically i just want to use the cards to send data fast between the two
> pcs.
>
> any ideas are highly appreciated.
>
> h

--
Best Regards,
Mike T

Mike Tranchemontagne
Consulting Applications Engineer
TeraComm, Inc.
148 Main Street
Building A, 3rd Floor
North Andover, MA 01845
877-900-TERA (8372)
978-557-9490 (FAX)
603-598-4773 (Direct Line and Cell)
0 Kudos
Message 2 of 4
(4,076 Views)
Is there a way to do this in a clean way? e.g. that the status-bits are used
to detect the beginning and finalization of a transfer (by use of ibwait
prior to reading or writing). I found that the LACS and TASC bits are not
reset after completion of a transfer...

Mike Tranchemontagne wrote:
>This is a multi-part message in MIME format.>--------------CC52921529A8C94F0C665CB6>Content-Type:
text/plain; charset=us-ascii>Content-Transfer-Encoding: 7bit>>I did this
some years ago in QuickBASIC and later in Visual BASIC. It's not>hard and
NI even has an App Note that describes this...>>One GPIB is programmed in
the normal way.>>The other is NOT a system controller, and board level (vs.
device level) IBWRT>and IBRD calls are used. Just put the IBRD and IBWRT
in a loop, and use a>short timeout, like 100 milliseconds. Most of the time,
they will timeout,>just ignore it and keep looping. When you DONT get a
timeout, then you know>the GPIB controller (in the other machine) sent or
received something. I used>some global variable for send and receive buffers.
When IBRD eventually>didn't timeout, then I knew my RD$ buffer had a new
message from the>controller. When I wanted to send something, I used SND$
and when IBWRT>eventually didn't timeout, then I knew the controller had
received my message.>>Good luck!>>henning hummert wrote:>>> hi,>> i have
2 gpib-boards on two different machines. i am trying to communicate>> between
the cards. unfortunately i have timing problems. the boards will>> lock up
after a very short time.>> does anybody have programmed something like this
in an ms c++ environment?>> basically i just want to use the cards to send
data fast between the two>> pcs.>>>> any ideas are highly appreciated.>>>>
h>>-->Best Regards,>Mike T>>Mike Tranchemontagne>Consulting Applications
Engineer>TeraComm, Inc.>148 Main Street>Building A, 3rd Floor>North Andover,
MA 01845>877-900-TERA (8372)>978-557-9490 (FAX)>603-598-4773 (Direct Line
and Cell)>>>--------------CC52921529A8C94F0C665CB6>Content-Type: text/x-vcard;
charset=us-ascii;> name="miket.vcf">Content-Transfer-Encoding: 7bit>Content-Description:
Card for Mike Tranchemontagne>Content-Disposition: attachment;> filename="miket.vcf">>begin:vcard
>n:Tranchemontagne;Mike>tel;fax:978-557-9490>tel;work:877-900-TERA or 603
598-4773>x-mozilla-html:TRUE>url:http://www.teracomminc.com/>org:Sales;TeraComm,
Inc.>version:2.1>email;internet:miket@teracomminc.com>title:AE>adr;quoted-printable:;;148
Main Street=0D=0ABuilding A, 3rd Floor;North Andover;MA;01845;>note;quoted-printable:877-900-TERA
is toll free to TeraComm sales office =0D=0A=0D=0A603
>598-4773 is home office and forwards to cell phone>fn:Mike T>end:vcard>>--------------CC52921529A8C94F0C665CB6-->
0 Kudos
Message 3 of 4
(4,076 Views)
I just finished writing a program to do this. the main computer controlling
our experiment is written in visual basic 6, windows98, and the slave
computer is running DOS, QuickBASIC4.5 and I had a hard time
getting it to go at first.

first use ibfind to find your gpib card and assign it a ud%
make sure it is not set to have the same primary address as the master
controller
ie. use ibpad to change it to something other than 0.
I also made sure the slave controller was using the CIC protocol
so I set it with but im not positive this is necessary, it works though
ibconfig(ud%, ibcCICPROT, 1)

then make it release system control
ibrsc(ud%, 0)


now you can make a loop that monitors ibsta using the ibwait function.
use zero as the mask
and it will not wait, it will report ibsta

status = ilwait(ud%, 0)

then look for the status bits LACS or TACS

if (status and LACS) then
'device is listener, ibrd
elseif (status and TACS) then
'device is talker, ibwrt
endif

also *VERY IMPORTANT*
make sure the master controller is set to readdress the non-controller each
time
and to UNaddress each time its finished, that is what sets LACS and TACS
and then unsets them. the default is to not.

on the main controller use
ibconfig(ud%, ibcReaddr, 1) and
ibconfig(ud%, ibcUnaddr, 1)

Greg



Uwe Kall wrote in message <39c1da70@newsgroups.ni.com>...
>
>Is there a way to do this in a clean way? e.g. that the status-bits are
used
>to detect the beginning and finalization of a transfer (by use of ibwait
>prior to reading or writing). I found that the LACS and TASC bits are not
>reset after completion of a transfer...
0 Kudos
Message 4 of 4
(4,076 Views)