06-26-2014 07:57 PM
While you are going there--- And you are hitting an edge case!
VISA Reads and VISA Writes can be "Synchronous" or "Asynchronous" (right-click menu on the primitaves) You REALLY want to read and understand the differences by digging deep into the LabVIEW help file.
06-26-2014 08:47 PM
Oh man, Jeff opened up a can of worms!
Against common wisdom I recommend synchronous rather than async. (by right clicking on the icon).
Asynchronous calls will cause a spinlock to keep checking to see if the VI is done. This will kill your CPU. But it does not consume a LV execution thread. With 30 async calls your CPU might come to a standstill.
Use of synchronous calls will use a LV execution thread but are easier on the CPU. You will have to hand edit the number of LV threads for the number of simulataneous calls you might have. There is a "threadconfig.vi" in the vi.lib that will set the # of threads up to 8 (IIRC). I would do that for the main execution engine that you are using (or assign all your I/O vis to a specific engine like "user1"). But you will have to find the labview .ini file and hand edit it to make it do such a large thread allocation. It is pretty easy to find the items to edit once you set them with threadconfig.vi.
Warning. This solution is not endorsed by NI! YMMV.
06-26-2014 09:27 PM
Seth
That is why I encouraged reading the help file studously!
This does sound like an edge case! I cannot try it! I do not have the "bajllion" devices
WARNING! requesting "Async..." does not mean the VISA call completed asynchronously. It gets complicated.
06-26-2014 10:40 PM
Jeff·Þ·Bohrer wrote:
That is why I encouraged reading the help file studously!
This does sound like an edge case! I cannot try it! I do not have the "bajllion" devices
WARNING! requesting "Async..." does not mean the VISA call completed asynchronously. It gets complicated.
I agree and actually arguing with NI developers has been the main way of figuring that out. A bit of testing is well worth the effort here when running those 30 serial port simultaneously. I found out a lot about VISA in just opening two serial ports and sending packets back and forth at various sizes and measuring throught put. Became a useful VISA test tool.
The other tuning I was pointing out is the number of threads in an execution system. This also is very open to debate and depends on the cost overhead of thread switching which can cause system thrashing. It depends if you are I/O limited or CPU limited.
And the last tuning is the OS itself. There is a huge difference in latencies between windows and mac os x. I have some custom software that was writtne in VB and can barely keep up with 6 or 7 serial ports at a time on very new hardware. It replaced a C program that I had written under Unix that had no problems with very old hardware. YMMV depending on a lot of factors.
PS. the "sth" are initials. it is Scott
06-27-2014 11:25 AM
Also TERMINATION setting.
I find my biggest cause of slow communication between my test station and the UUTs is not getting the termination setting to match the termination settings of the UUT. Big mistake to assume.
To expand a little bit more, I open two VISA sessions per com port (64 total) one for sending (VISA Write) and one for receiving (VISA Read) duplicate session set to True. This allows you the write at the same time you are reading (or waiting to read) from the same com port.
For each UUT, the Testing SubVI each launch it’s own copy of a communication server VI for it’s assigned comport that opens the two VISA sessions. One sessions is constantly looping reading (more like waiting) at the comport for any bytes with a timeout set to 3 sec. Any messages received are time stamped and logged to a file. Then passing filtered messages back to the Testing SubVI in a queue. This allows a VISA Write function to work while the VISA Read function is blocked waiting for a reply.
The UUT can on their own send out a message mainly due to some error conditions (I prefer devices that only speak when spoken to) So regardless what the Testing SubVI or the top level VI is doing, I will always receive, time stamp and log any messages when they are received.
Again this communication server only knows about and only cares about a single comport, very simple to code, maintain and scalable.
06-27-2014 01:38 PM
06-27-2014 01:40 PM - edited 06-27-2014 01:43 PM
Try a hard wire loop back on the remaining comports (Tx to Rx) and read back what you write
http://www.ni.com/white-paper/3450/en/
06-27-2014 04:10 PM