NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing COM Handle Between CVI and LV

I have a COM port that ideally I don't want to open and close when switching between CVI and LV. At the moment LV opens it, stores the handle in TS and then it is used as a input param to a CVI/DLL call. 

 

I can't figure out the combination of signed/unsigned/char/ViSession that would make this work. Every time I try to call something in CVI IO Trace shows an error for "reference is invalid". When I see LV call that COM port I see "DC_Load", the alias we gave our COM port.

 

I tried inputting that to viWrite("DC_Load", "test", 4); and have the same issue. 

 

Something I'm trying to understand is right now I'm in debug mode. So LV and CVI might be different process' and thus sharing is impossible, even if I were to get the right combination for sharing the param correctly.

 

Is there a way to run where TS runs everything as one process so sharing IS possible, once the param issue is figured out?

 

P.S. Running on Win 10

Relevant: https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/How-can-I-have-two-LabVIEW-exes-share-a-COM-...

0 Kudos
Message 1 of 2
(638 Views)

For the record I've managed to use the exact handle from LV, to viWrite in CVI and it says invalid handle. int worked. 

 

The problem of invalid handle still persists however. Obviously the Process ID's are different, which likely points to "Windows only allows one COM port per process". 

 

Just want to know if there's a way to force TS to control CVI and LV under the same process ID.

0 Kudos
Message 2 of 2
(612 Views)