03-01-2012 01:47 AM
Hello all !
I need to read and write data to and from a serial port (rs232) independently and simultaneously .
i'm sorry that i can't put a picture of this but it is very simple :
i used "configure serial port" and passed the resource reference to two while loops.
one loop is reading data and the other loop is writing data to the port.
the problem is when the read loop (read from serial function) waits for data - it locks the other loop from running (write to serial function is blocked).
i searched the forum and find that visa open function has "duplicate session" option - is this what i need ?
if true, can anyone explain exactly how to wire and use it in the correct way ?
thanks a lot.
guy.
Solved! Go to Solution.
03-01-2012 09:26 AM
I have no idea how you did your coding so that one loop is blocking the other since you don't want to post an image. Going to be hard to tell you what to change.
03-02-2012 09:06 AM
hookso,
It is my understanding that a serial port may pass data bi-directionally, but the information cannot be passed simultaneously. You may need two ports or perhaps a parallel port.
03-03-2012 11:11 AM
A picture of my problem is attached !
03-03-2012 11:47 AM
03-03-2012 11:54 PM
because i will have to poll the port all the time.i want my code efficient.
03-04-2012 09:34 AM
I fail to see how periodically polling for bytes is any less efficient than constantly doing a read that times out but the duplicate VISA session can be tried. It's an option with the VISA Open function.
03-05-2012 03:12 AM
Ok , i found an example that solved my problem : a VI called serialduplicatesessions.
The file is attached.
this is the link for any case : http://zone.ni.com/devzone/cda/epd/p/id/1727
04-06-2016 08:17 PM
It also solves my problem. Thanks