04-04-2019 09:44 PM
Shall you please guide me... for the data transfer between computer VI to myRio VI using same serial port
Objective using same serial port : First Vi (Desktop/computer) write the data, Second VI (myRio) read the data
I found the below link, which may be the exact solution. But the program VI is not working with Labview 2016.
http://www.ni.com/example/29287/en/
Windows will only allow one program to access a serial port at a time. This is so that two programs do not try to talk to the same device at the same time and scramble each other's data; however, you can coordinate two or more VI's, so that they work together and share the serial port by using VISA. The first VI opens the VISA session and puts the VISA refnum into a queue and then begins to talk to the serial device. The second VI would read the VISA refnum from the same queue. The VISA driver coordinates the activities of the two VIs automatically, since they are both using the same VISA refnum.
04-04-2019 10:37 PM
I'm afraid your description doesn't clearly describe what you are trying to do?
You talk about how two programs can't access the same serial port at the same time. That is true.
But you talk about "data transfer between computer VI to myRio VI using same serial port". What exactly does that mean? What serial port? One on your computer? One on your myRIO? Wouldn't they be two different serial ports?
The link you attached is about getting two different VI's in the same session of LabVIEW to work together to share the same serial port. So that is a 3rd thing you are describing, but really doesn't apply to either of the first two situations you described.
Perhaps you can attach a sketch of how things are connected together, and describe your application in a little more detail about what data is being passed back and forth via the serial port(s).
04-04-2019 11:09 PM
Thanks for the reply.
Please refer my project objective,
I created "computer VI" for the leap motion sensor, which can work on computer. This will help to get data (x, y, z).
This data need to send to myRio, which is connected to computer through USB.
myRio will use this data to control three motors.
04-05-2019 02:17 AM - edited 04-05-2019 02:18 AM
Hi RAMASG,
- don't initialise the serial port in each iteration of the "computer VI" loop, just once before the loop is enough!
- append a TermChar to the string in the "computer VI", use NL aka 0x0A aka \n
- DON'T use BytesAtPort in the "myRIO VI"
- don't initialise the serial port in each iteration of the "myRIO VI" loop!
- just read 999 bytes in the "myRIO VI" and let the TermChar handle the message length automatically!
04-05-2019 03:19 AM
Dear GerdW,
Thanks for the feedback.
I amended the program. But I'm sure about point (2 & 5).
Please find enclosed the attachment and review the same.
04-05-2019 03:37 AM
But I'm not sure about point (2 & 5).
Sorry for the typo error
04-05-2019 03:38 AM
Hi RAMASG,
But I'm sure about point (2 & 5).
You need to add the TermChar to the message string you create in your "computer VI".
Finished…
04-05-2019 04:34 AM
Thanks for your support and details.
But I couldn't able to make it.
Shall you please help to guide me further.
04-05-2019 05:29 AM
04-11-2019 03:59 AM
Appreciated your earlier reply.
myRio VI is still not reading the data from Computer VI.
Shall you please enlighten the com port selection in both VI.