From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Substitute or manipulate VISA read in instrument library

Solved!
Go to solution

Hello,

 

I am facing a bit of an odd problem. I got an intrument with a driver library and this is working so far. The problem is that this is only meant for GPIB and people want to control it over its serial port. So I modified the initialize VI to do the proper setup in case a com port is selected instead of GPIB and now I can successfully control the device over serial with the VIs from the library.

 

What doesn't work however is read from the instrument as it turns out that over serial it will send some additional lines at the start of every message that do not get send over GPIB and thus confuse the VIs from the library. Of course it is not difficult to discard those lines after reading, but I would have to do it for every single read operation in this instrument driver library and this is hugel.

 

So I thought if I could somehow change all calls to VISA read to my own VI which includes the discarding, everything would be fine. But I did not find a way to do this. Does anyone know how this is done or how to do it in a better way? Of course I could go through virtual com ports and a seperate program but I want to avoid additional software installation at the user PC.

 

Thanks in advance to everyone, I hope you can help.

0 Kudos
Message 1 of 4
(885 Views)

The best way is to create a copy of the whole instrument library and create a VI scripting tool that will go into every VI and add your parsing to discard those extra lines for every VISA read operation.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 4
(864 Views)
Solution
Accepted by Ozlo

Well I would just make a VI that has VISA Read and the code to discard the "extra"  inside of it.

 

Then use the Search and Replace function to replace every "VISA Read" in your project with that VI.

 

That will get your project working.

 

Then maybe take the time to fix the library so it can handle either GPIB or Serial and submit it to the Instrument Driver Network for others to use.

========================
=== Engineer Ambiguously ===
========================
Message 3 of 4
(833 Views)

Thanks for your help. I tried exactly that, had the read and discard VI ready and then just accidently found how to get rid of the whole problem. It turned out that those extra messages were part of an undocumented feature that I accidently switched on and now off again.

 

Unfortunately more issues appeared. I fixed some of them and got it to read a waveform in a basic way. At that point, it became clear that the process is so much slower than GPIB that it is just not practical. The intrument does only allow slow baudrates. So people agreed to buying a GPIB adapter.

 

Anyway thanks again for the fast help.

0 Kudos
Message 4 of 4
(786 Views)