08-16-2023 04:26 PM
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.
08-16-2023 04:47 PM
@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.
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?
08-17-2023 12:25 AM - edited 08-17-2023 12:26 AM
@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.
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.
08-20-2023 04:54 PM
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
08-21-2023 09:52 AM - edited 08-21-2023 09:53 AM
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.
08-21-2023 02:32 PM
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.
08-21-2023 03:25 PM
Long shot:
Make sure all related passports are enabled:
08-21-2023 03:30 PM
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.
08-21-2023 06:59 PM
@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?
08-22-2023 02:49 AM
@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.