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-07-2021 12:24 PM
Hello,
I want to communicate between two PCs using Labview. I am using a null modem cable with USB to RS232 converters.
I am able to send data from PC1 and receive it on PC2.
Once this communication is done I want to send data from PC2 to PC1 which I am not able to do.
I want to manage to run this in a loop.
I tried an example of this and attached the VIs.
Thanks!
Solved! Go to Solution.
10-07-2021 01:02 PM
Hi ahmed,
@ahmedmaken wrote:
I am able to send data from PC1 and receive it on PC2.
Once this communication is done I want to send data from PC2 to PC1 which I am not able to do.
Why aren't you able to achieve that?
Do you get any errors? Which ones?
(A big problem is your try to close the same COM port reference twice even though you only oopen that port once…)
What about thinking about the communication protocol before implementing it?
What about using some command/response schemes?
What about reading books on (FTP or similar) server algorithms to learn from?
10-07-2021 01:51 PM - edited 10-07-2021 01:57 PM
I recommend you watch this video to give you some ideas on how to properly format your messages: VIWeek 2020/Proper way to communicate over serial
10-07-2021 02:17 PM
Ok, looking at the code a little closer...
1. Do not branch your VISA Resource. You are causing the Write and the Read to happen at the same time and closing it twice. Do the write, if necessary, and then attempt to read.
2. You need to append a Line Feed to the string you write through the serial port. This will allow the other side to detect the termination character and stop the read.
3. The rest of your logic makes very little sense. What exactly are you trying to get the two computers to do? It looks like a ping-pong setup, which I am not a fan of. You should have one machine in control of the system. A tells B to do something. B sends the data back. A can then decide to move to the next point and tell B when it is ready for the next measurement. In this scenario, A is the master, maintaining the state of the system and B just does what it is told. So perhaps a more obvious command structure would be desired such as sending "Take Measurement" instead of "01".
10-08-2021 10:11 AM
I exactly want to do something like this but I can not find a way to implement it in the code.
10-18-2021 07:41 AM
Hello,
I want to communicate between two PCs using Labview. I am using a null modem cable with USB to RS232 converters.
PC1 (Stage) sends the signal to PC2(which is controlling the Camera) to take pictures at specific points and save them accordingly.
I am able to run these programs in the 'highlight mode' but not without it.
I tried changing the delays value but it still doesn't make a difference.
I don't know if I did something wrong here or have not added something important to run the program smoothly.
Help Required. Thanks!
10-18-2021 09:13 AM
You definitely should not be constantly and opening and closing the ports. Open the ports before their respective loops and close the ports after the loops.
10-18-2021 09:44 AM
Like this?
10-18-2021 10:33 AM
You only need to initialize and close the ports once.
10-18-2021 11:06 AM
Okay thanks. I did that too. But still the problem is not solved.