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.
10-30-2006 11:20 AM
10-30-2006 11:27 AM
To make sure your cable is good, try shorting out the Tx Data and Rx Data pins on the far side and see if the data gets returned. If you have a breakout box, make sure your handshaking signals are OK (DTR, DSR, CD, RTS, CTS).
You could also use Hyperterminal on both computers to see if the data is going across both ways. Do this first. If OK, post your code.
10-30-2006 12:14 PM
10-30-2006 12:36 PM
10-30-2006 01:01 PM
10-30-2006 01:11 PM - edited 10-30-2006 01:11 PM
OK, I just looked at the Basic 2 Port Serial vi. This vi is expecting two connections to two different com ports on the same computer. This isn't what you want I think. What you want is a vi on one computer that writes then waits for serial bits to read. On the other computer, you want to read first then write. Write your own vi's using the Basic Serial vi as an example on how to write and read. One exception, you need to use the Bytes at Port function to wait for serial bytes to arrive before attempting to read them. Look at the picture below:
Add this to your code. It waits in a loop for bytes to arrive at the serial port. After arriving, it reads the bytes. The timeout control value is in tenths of a second and is used in case the serial port never receives anything. The Num Bytes control is used in case you want to wait for a certain number of bytes before reading. You can set it to 0 and it will read all bytes.
Message Edited by tbob on 10-30-2006 12:14 PM
10-30-2006 02:18 PM
10-30-2006 02:43 PM
So you have just one PC with a null modem cable between COM1 and COM2? You are writing to COM1 with one vi and expecting to read from COM2 with the other vi? It could be that when you are closing the VISA session to either COM port that the data is lost. Don't close the COM port yet. Write just one vi and do this:
1. Initialize COM1 and COM2.
2. Write some characters to COM1.
3. Read characters from COM2.
4. Close both ports.
User Error In/Out to dictate the execution flow.
10-30-2006 03:06 PM
10-30-2006 04:14 PM