LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I perform a serial communication using RS-232 with LV examples?!

I´m trying to perform a serial communication via RS-232 with LV 7.1 (my LV version) examples. I´ve downloaded the NI-VISA full 3.2 and I can´t run. I´ve done sucessfully a loop-back-test in two computers and they works well. The message error when try to perform my communications: "timeout expired operation before completed". Why?!

Thanxs
0 Kudos
Message 1 of 11
(3,589 Views)
You get this error when you try to communicate with an instrument? If that's the case, you'll get this error when the instrument doesn't return any data. Verify that you are sending the correct command and that you are sending the correct termination character. Termination characters are usually a Carriage Return (\r) or Line Feed (\n). You should check the commands by first using something like Hyperterminal. It would also help if you provided the make and model number of the instrument you're trying to talk to.
0 Kudos
Message 2 of 11
(3,584 Views)
I´m trying to communicate two computers with each other. For completing this job i´m using the first example of LV 7.1 search for: serial...

Thanxs
0 Kudos
Message 3 of 11
(3,571 Views)
You've got that program running on the first pc? What program do you have running on the second pc? Your second pc could have a LabVIEW program that has a while loop that runs continuously. Inside the while loop would be a VISA Read and VISA Write. Wire the results from the VISA Read to the VISA Write so that that it will echo back everything it gets. That's how you would do a loopback in software. The other thing you can do is open Hyperterminal on the second pc. When you do a write from pc 1, that data will appear on the Hyperterminal screen of pc2. You can type something in the Hyperterminal screen on pc2 and if you just do a VISA Read on pc1, you should see what you typed on pc2.
0 Kudos
Message 4 of 11
(3,565 Views)
Connecting two PC's via 9 pin serial connectors will require the use of a null modem cable that has pin 2 (recieve) on one end wired to pin 3 (transmit) on the other and visa versa, I believe. Also need pin 5 to pin 5 (ground) at a minimum if not using handshaking.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 5 of 11
(3,560 Views)
AnalogKid...

I'm using a cross-over cable (null cable, 2<->3 , 3<->2 and 5<->5). I'm using three pins: 2 (Tx), 3(Rx) and 5 (ground), I'm not using a handshaking! I'm using the same example in two computers (LV 7.1 Express my version).

Thanxs
0 Kudos
Message 6 of 11
(3,533 Views)
If you're using Advanced Serial Write and Read or Basic Serial Write and Read on both pc's, on pc1 you should be able to do just a write and then on pc2, do just a read. The opposite is also true. You can do just a write on pc2, and then do just a read on pc1. If you attempt to do both a write and read on a single pc, you'll get a timeout on the read because the program running on the other pc is not setup to automatically echo back what it reads.
0 Kudos
Message 7 of 11
(3,527 Views)
Dennis,

I´ve tried your test (your last suggestion) and the program doesn´t work! I´m selecting pc1 just for writing and pc2 to just for reading and it seems that the signal isn´t arriving on pc2 and the message error appears again. When I try the opposite communication (pc2, just writing and pc1, just reading), the unbelievable result is that the message sent arrives on pc1 (incredible), but the message is corrupted (wrong) and an error appears again. I´ve attached for you the LV example that I´m using. So, what is this phenomenon?!

Thanxs...
0 Kudos
Message 8 of 11
(3,507 Views)
I don't think there is anything wrong with the code but you can verify this by trying the same thing with Hyperterminal on both pc's. If you see the same thing, you may have wired up the cable incorrectly.
0 Kudos
Message 9 of 11
(3,503 Views)
Dennis,

I could perform the communication with Hypertherminal and before using the LV example both, sucessfully. But, in this new experimentation I didn´t change anything and they (computers) works well! Do you know why?!

Thanxs...
0 Kudos
Message 10 of 11
(3,453 Views)