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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB communication between two computers

Solved!
Go to solution

I am attempting to communicate between two computers via GPIB. The requirement is that one computer sends a command, the other one will receive it, save it and then reply accordingly. This reply will then be recevied by the first computer and displayed (This is the emulation of a device, the actual requirement is to communicate with a satellite TT &C)

I have achieved all of this . However, to be in the listen always mode I have wired a property node with infinite timeout (-1) before read. Now i cannot exit the VI as it is always stuck in the read function until a command is received. 

How can i exit the VI when it is stuck in the read function.

PS: Using GPIB for communication is a requiremnet of ht eproect and cannot be replaced.

 

 

Download All
0 Kudos
Message 1 of 5
(3,882 Views)
Solution
Accepted by topic author Millo

Hello,

 

You could have the read timeout, and then clear the time error and keep looping until you get a message.  And then you could use the compound arithmetic to stop the loop if you hit the stop button, or get an error other than a timeout, or if the read returns data.

 

Would this work for you?  I've attached your "write and then read.vi" with the code added.  Double check my logic, I'm pretty sure it's right but didn't run it.  Also, if you are returning a lot of data make sure the timeout is sufficient.

 

 

Justin Parker
National Instruments
Product Support Engineer
Message 2 of 5
(3,855 Views)

Thank you. . 

The transmitter portion is working fine now . . 

However, we still have one problem:

In the receiver portion (read and then write) what we want is that it always remains in a 'listen mode' and whenver it receives a command it can reply accordingly.

This has been achieved with a while loop. But every time we test the program we have to exit the VI forcefully (through task manager) becuase the while loop will not abort execution mid way.

Is there any way to achieve such a function that it does stay in an always listen mode BUT exits whenever we want it to?

 

Attached: VI of the receiver portion

0 Kudos
Message 3 of 5
(3,823 Views)

Millo,

 

Do not use -1 for a timeout setting.  Use a shorter timeout and check the error out from the Read to see if timeout occurred.  When Read times out, do not wirte to file or do the VISA Write.  Just loop around and try to read again.

 

Lynn

0 Kudos
Message 4 of 5
(3,810 Views)

I do it  as the article of the link below step by step. but when the commad  ibwrt "HELLO" is excuted on the controller,an EADR error retured.Is there anybody who can help me?

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHlWCAW&l=en-US#:~:text=Below%20is%20....

0 Kudos
Message 5 of 5
(1,573 Views)