From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

How can I duplicate a COM session?!

Is there a way to dublicate a COM session? I'm using a external application which have to run on the same port (com1) as my LV app. Now I always get the error (-1073807246) from LV when I'm trying to open the same com1 session! How can I solve this problem?
Although there is an input on the 'open VISA' for duplicate session it doesn't work and I get this error back! It's necessary to use the same port because of the app. so this means I can't switch to another one.

Thanks
Norick
0 Kudos
Message 1 of 7
(2,717 Views)
Hi

As far as I know there is now way to access a com-port from more than one application.
This is handled by the operating system - if an application tries to open a com-port it gets the ressource from the os (unless it is not in use already) and it is blocked for other applications.

Why do you have to use the same port?

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 2 of 7
(2,715 Views)
Hi
the reason is that I program my HW with an external app. This prog use for example COM1. To turn on my specific HW I'm using LV. The problem is now that I have to start the external app (DOS based programmer)with the System Exec.vi before I turn on my HW with LV. This is the point where I run into trouble with the same port because this external prog opened already the COM1 which I'm also using to turn on my HW! This port have to be open to program my HW.

The external prog is a VB C++ program. If I would know the port handle in LV I could probably send it to the external app first and I would not need to open the port in the external app again.


regards
Norick
0 Kudos
Message 3 of 7
(2,706 Views)
Norick, there is really no way to share a COM port.
I wonder why you cannot simply close the port, launch the external application then reopen the port.
In any case, it would be a mess to access the HW at once with the DOS app.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 7
(2,701 Views)
Is it not possible to program your HW with LV? If you know the protocol you could it as well.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 5 of 7
(2,695 Views)
I have done similar, but I do not recomend it.

If at all possible, go with Becktho's suggestion of eliminating the other software and just code everything in LV.

I urge this approach because the sharing of the com resource (I believe) is an exercise in futility at best.

If we have to stick with the other software then two extra serial ports and some custom built serial cables could be used to get this going.

Here is what I have in mind.

Com1 > Other software
Com2 > LV recieve
Com3 > LV transmit

Wire the cable such that the transmit line from the device is connected the the recieve line of Com2. In LV copy all data from Com2 receive line to Com2 transmit. The cable should route Com2 transmit to Com1 recieve.

Wire the compliment to tap into the transmit from Com1 >>> Com3 recv >>> LV copy >>> Com3 transmit >>> Device recieve.

When you have all of this in place, and working the original software would talk out it own port have have no idea you are in the middle.

At that point your LV code could insert commands and intercept responses as required.

BUT...

I would not be suprised if you end up having to learn enough about the protocol that Becktho's suggestion will look pretty simple.

Happy wiring,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 7
(2,687 Views)
Well I do know the protocol to program my HW with LV but I was searching for another poss. because this external DOS-programmer already exists. So I agree with becktho's way although it's a hard work... 😞


Ben, thanks for your input about the wiring solution. Well that could work but the cables are fixed and unfortunately impossible to rewire it 😞

Pinpanter:
The problem is that I have to start my external programmer first which is opening a com-port. After I launched this app. I turn on my HW which is on the same port for programming. Now I do run in the conflict of using the same port! Unfortunately I can't turn on my HW first and close the port afterwards.


It seems that I have to follow becktho's suggestion...


Thanks guys for your help
regards Norick
0 Kudos
Message 7 of 7
(2,670 Views)