LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Virtual COM port I/O Error

Hi,

I have created virtual paired COM ports since I want to show I can write to one com port and then read on another, shortly after I write.  I believe I have everything setup correctly as I can use FoxTerm (terminal emulator) to write to one port and listen to another.  Everything works as expected.  However, I do the same in labview and labview can't even open the com port.  it give me the"VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error."  Even trying to write anything at all results in an I/O error.  I have used similar code to read from a standard COM port that has RS232 device hooked up to it and it works just fine.  Is this because I have created virtual COM ports?

 

Am I missing something here?  Any help would be great.  Here is my code for write and read.

 

Rudy_01_0-1692220975898.png

 

Rudy_01_1-1692221010673.png

 

0 Kudos
Message 1 of 10
(1,359 Views)

@Rudy_01 wrote:

Hi,

I have created virtual paired COM ports since I want to show I can write to one com port and then read on another, shortly after I write.  I believe I have everything setup correctly as I can use FoxTerm (terminal emulator) to write to one port and listen to another.  Everything works as expected.  However, I do the same in labview and labview can't even open the com port.  it give me the"VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error."  Even trying to write anything at all results in an I/O error.  I have used similar code to read from a standard COM port that has RS232 device hooked up to it and it works just fine.  Is this because I have created virtual COM ports?

 

Am I missing something here?  Any help would be great.  Here is my code for write and read.

 

Rudy_01_0-1692220975898.png

 

Rudy_01_1-1692221010673.png

 


That's not code any more than a picture of your favorite text editor is code.  Why don't you upload some real code - i.e., the VI - instead of a few pictures that we can't even see what is inside that (ugh) stacked sequence structure (SSS)?  Could you describe what "virtual paired COM ports" are?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 10
(1,355 Views)

@Rudy_01 wrote:

Hi,

I have created virtual paired COM ports since I want to show I can write to one com port and then read on another, shortly after I write.  I believe I have everything setup correctly as I can use FoxTerm (terminal emulator) to write to one port and listen to another.  Everything works as expected.  However, I do the same in labview and labview can't even open the com port.  it give me the"VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error."  Even trying to write anything at all results in an I/O error.  I have used similar code to read from a standard COM port that has RS232 device hooked up to it and it works just fine.  Is this because I have created virtual COM ports?

 

Am I missing something here?  Any help would be great.  Here is my code for write and read.

 

Rudy_01_0-1692220975898.png

 

Rudy_01_1-1692221010673.png

 


You need to exit the other application that is reserving the resources VISA  needs.  Your other application has an exclusive lock.   LabVIEW (or anything else) just cannot "borrow a cup of VISA." From the neighbors that are using those VISA resources. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 10
(1,306 Views)

Thanks for taking a look at this.  The other program that correctly openend and communicated (FoxTerms) is not open.  I closed it.  I use that all the time to debug and have never had an issue with it opening and locking.  Is that the application you are referring too?  The application I used to create the virtual com ports was "Virtual Serial Ports Tools". Here is my code.  I only modified the labview example a little to write and read from the two ports.  

I appreciate you looking into this.

Here is the screen shot of my device manager that shows the two ports 

Rudy_01_0-1692568386214.png

 

0 Kudos
Message 4 of 10
(1,269 Views)

I have no experience with the simulated COM ports you are using.  There is a possibility VISA just cannot work with it.  But as far as your code, you need to have both ports open at the same time.  I would restructure it like the following.  The idea is that you write when you want and you read only when there is data to read.  I also always append the End Of Line character to make sure the termination character is sent.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 5 of 10
(1,224 Views)

Thanks for sending the mod.  I tried it and I still get the same error code, -1073807298.  I tried using the visa property node instead of visa serial port and got the same result.  I really don't think there is anything special about the port.  It worked just fine with FoxTerm.  Not sure what else to try here.

0 Kudos
Message 6 of 10
(1,206 Views)

Long shot:

Make sure all related passports are enabled:

billko_0-1692649509299.png

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 10
(1,196 Views)

Maybe give this a shot:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Le9SAE&l=en-US

 

FWIW, that's not the error you get if something else has the VISA resource. I believe you get -1073807246 "The resource is valid, but VISA cannot currently access it."

 

OP, are you using the HHD tools? I'm pretty sure I tried those and they worked fine with LabVIEW but it's been a while. Maybe try rebooting everything and giving it another shot.

0 Kudos
Message 8 of 10
(1,191 Views)

@Rudy_01 wrote:

 I tried using the visa property node instead of visa serial port and got the same result. 


Are you sure you need to configure/open the virtual serial port at all? What happens if you just start using it with no configuration, just jumping straight to VISA write?

 

If it errors out at the property node, that node probably has 5 or more separate things that it sets.  Could you see if all 5+ things cause the error, or if some settings work while others return an error?

0 Kudos
Message 9 of 10
(1,174 Views)

@Kyle97330 wrote:

@Rudy_01 wrote:

 I tried using the visa property node instead of visa serial port and got the same result. 


Are you sure you need to configure/open the virtual serial port at all? What happens if you just start using it with no configuration, just jumping straight to VISA write?

 

If it errors out at the property node, that node probably has 5 or more separate things that it sets.  Could you see if all 5+ things cause the error, or if some settings work while others return an error?


Definitely try to find out if it is one of the property nodes in Serial Init that causes this. Your FoxTerm (and other terminal programs) often simply ignore errors when trying to set serial port parameters such as number of data and stop bits, assuming that the port driver doesn't support that at all as it only implements the default. NI-VISA is a bit more critical and in general that is a good thing. Unlike with a terminal program, you are the programmer here and are responsible to do that type of conditional error suppressing yourself. So see which of the property nodes causes an error by trying them one by one and then eventually ignore this error when it is returned.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 10
(1,149 Views)