Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

error -1073807194 when configuring serial port

I am trying to connect to two devices using FTDI UC232R cables using VISA communication. I am able to find the COM ports and serial numbers for these cables, and they work once, the very first time I try to run my vi. If I stop the vi and try to run it again, the code might make a connection to one of the devices. If I try to run a third time after stopping the code the second time because I received error -1073807194 when configuring serial port, neither one of the devices are able to connect. I am still trying to understand VISA communication, and know this could potentially be a problem with the COM ports not closing properly, or there being invalid data being stored in the buffer, but I have tried changing this part of my code and still receive the error. My code will work if I completely close out of the project I am working from, and re-open the vi, but it will only for the first time like before. 

The image below shows where I configure my serial port. I have even tried adding a time delay between the first write as shown. I call VISA Write many other times throughout my code before closing it.VISA.PNG

I am not sure if I need to add a VISA break, flush, or clear anywhere.

Thanks.

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

Hi

if you only communicate with one instrument, does it work?

Please show a bit more of your vi by attaching the vi.

 

How do you stop, by really stopping the vi and closig visa's or via the abort button on top of the vi?

greetings from the Netherlands
0 Kudos
Message 2 of 10
(4,411 Views)

I fixed the problem I was having- it had to do with not properly closing the visa session each time I tried to run the vi. I am able to stop the vi now via the abort button and get it to run again. The errors I am experiencing now is that the code does not consistently connect to both devices. It will consistently connect to the torque sensor, but not to the stepper motor. I am receiving the following errors/warnings:

1. error -1073807346 occurred at visa flush i/o buffer

2. error -1073807246 occurred at property node (arg 1) in visa configuration serial port

3. warning 1 occurred at property node (arg 1) in visa configuration serial port 

These errors are being found in various/different wires each time the vi is ran in the same section of code. 

0 Kudos
Message 3 of 10
(4,409 Views)

Hi

I advise not to stop via the abort button. Use a dedicated stop button. Aborting a vi means to push or pull an emergency brake. Not a nice way to stop but if necessary, because if your software goes wild you still can stop.

greetings from the Netherlands
0 Kudos
Message 4 of 10
(4,399 Views)

The idea is not to "stop" the vi through the abort button. I am trying to compile eight similar vi's into an executable, and this is just one of the eight that I am working on. When I load the executable, there are two different ways to stop; the abort button isn't even an option. I am able to run the executable, load the needed vi and make a connection to my two external devices on the rig I am using, but when I try to send a command on the rig it is giving me error -1073807346. This error either occurs at a visa open or a visa write. Is it possible that the visa session/reference is being closed somewhere else? Is there a time delay/timeout I am missing? When I run the vi on it's own without compiling it into the executable, it sends commands to my rig. It is only when I am trying to run it through the exe that it throws this error. 

0 Kudos
Message 5 of 10
(4,385 Views)

Mabe you can post your project, including the vi's you use (not the driver vi's)

It is difficult to spot an error without seeing something.

greetings from the Netherlands
0 Kudos
Message 6 of 10
(4,379 Views)

That is the only vi I am able to post. It works independently except for a few functions because those are executed when this is called within another vi in the project. The biggest issue is with the VISA communication. This vi and the others similar to it are the only ones that use visa references. I am receiving "Error -1073807346 occurred at VISA write. VISA: (Hex 0xBFFF000E) given session or object reference is invalid." This error occurs at any of the VISA writes within either the UI Loop or the Consumer/Producer Loop at random times. I have turned on the automatically close visa sessions option, and have tried to flush the visa buffer, but that did not make a difference. I don't understand why the VISA commands can't be accessed through another vi. 

0 Kudos
Message 7 of 10
(4,367 Views)

Hi

I would not be surprised when two of these calls actually are occuring at the same moment.

Especially UI and The producer Consumer loop will interact probabaly.

 

It is easier and better readable when you handle instrument calls only in the produce/consumer or work loop.

In the UI group generate commands for this loop and send cmds down to the worker.

Also try to write little subvi's that handle a command to an instrument, like building an instrument driver.

Your program will be more readable and it is also easier to incorporate more instruments while seeing what each task does.

 

Especially don't use the stacked sequence structure because it is difficult to wire error out wires in a nice way. And I have attached a small modification to one of these structures just to show how it can be done without a sequence structure but by sequencing by wire. The LabVIEW compiler handles the sequence correctly in such cases.

 

And I'm sure at the end of the program the chance of the QT cmd having an ivalid empty visa resource is for sure because you have enabled that in case no wire comes from that case the visa resource is cleared.

 

greetings from the Netherlands
0 Kudos
Message 8 of 10
(4,362 Views)

I'll work on eliminating the stacked sequence structures. I know those are not the most ideal structures to use. Thanks for the example on how to modify these.

 

Can you elaborate on what you said about the QT cmd? I am not fully understanding what you are saying about no wire coming from that case.

0 Kudos
Message 9 of 10
(4,357 Views)

I saw that the output of the eventstructure had a default filled in. Such a default is in case of a visa resource an empty resource. So the best you can do is rightclick on the visa resource outputs and disable the default value/

Meaning that you get an error when you have a visa resource not connected, and then make sure all have a valid resource.

greetings from the Netherlands
0 Kudos
Message 10 of 10
(4,353 Views)