LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview/Arduino Uno Initialize Failure

I recently purchased an Arguino Uno and started playing around with it.  I got it to communicate and ran all the examples just fine.  Then I started working on my own VI.  Now as soon as it tries to run Arguino initialize it errors out.  I also tried re-running the examples and I get the same errors.  I can still talk to it through its sketch pad but cannot relink it with labview without restarting my computer.  I am able to duplicate this anytime I run my vi.  It dies during the initialize.  I originally tried to run it with default baud rates and only selecting my Com port but when that wasn't working either I switch to controls and manually set the baud to the same rate

Initialize.png

0 Kudos
Message 1 of 4
(6,085 Views)

SR62 wrote:

I can still talk to it through its sketch pad but cannot relink it with labview without restarting my computer.  I am able to duplicate this anytime I run my vi.  It dies during the initialize.

It is because you never close the connection.  If you never close the connection the computer thinks you are still connected but then when you try to re-run your VI it tries to make a connection to something that is already occupied by the computer.

So, you need to make sure you ALWAYS run the Close VI.  This means that you should never "Abort Execution" (the stop sign button) when working with Arduino.  Also, you don't need to restart your whole computer, you only need to restart LabVIEW (close it all completely then start it back up).  When you close LabVIEW, it releases the Arduino so that you can then reconnect to it.

0 Kudos
Message 2 of 4
(3,831 Views)

Nathan is correct.

When programming with LabVIEW we often talk about open, read/write, close.  Open might be opening a file, or opening a hardware resource.  Either way it is important to close the handle to free the resource.  If you fail to close the resource you have what is known as a leak (if you do this with memory its a memory leak, with a file its a file handle leak, etc).

If you leak an Arduino reference (more specifically the VISA Resource contained in the Arduino Reference) you can kill it without closing LabVIEW by opening the Arduino close VI, selecting the COM port associate with your Arduino (there will even be an icon next to the name to indicate that there is an open reference to it), and then click run.  This will run a VISA close on the COM port and allow you to re-open it when you run your main VI again.

-Sam K

LIFA Developer

0 Kudos
Message 3 of 4
(3,831 Views)

Sammy_K wrote:

If you leak an Arduino reference (more specifically the VISA Resource contained in the Arduino Reference) you can kill it without closing LabVIEW by opening the Arduino close VI, selecting the COM port associate with your Arduino (there will even be an icon next to the name to indicate that there is an open reference to it), and then click run.  This will run a VISA close on the COM port and allow you to re-open it when you run your main VI again.

That is good to know.  Thanks.

0 Kudos
Message 4 of 4
(3,831 Views)