Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Find Doesn't Pass Found Items

Can someone please explain why the attached subVI (why_oh_why.jpg) does not work when called through a series of other subVIs?

 

The bottom of the help page for VISA Find reads, "...this function does not necessarily return all strings that you pass to the VISA Open function."  which is exactly what is happening.  When I run the app and launch the debugger I see that #0 strings are passed but when I run the subVI alone or run my entire program from the IDE it works fine and returns the list shown in "why_oh_why2.jpg."

 

Here's the dealio:  Program starts, tests a VISA I/O control for emptiness; if empty, call my "getCOMPorts" VI through two other subVIs, then start scanning for known equipment.  The "get-all-serial-ports" part is where it breaks.

 

There are other problems with my code and rest assured I will entertain you with additional posts regarding them in the near future, but for now the very first thing I'm doing ain't woikin and I'd like to know why.  This particular symptom is not exactly intuitive so I am turning to the experts.  Thanks in advance for any assistance.

Download All
0 Kudos
Message 1 of 7
(3,069 Views)

Well, "search mode" is a control. So, what value are you actually passing to it when you are calling it as a subVI? If you leave it unwired, the default value is used, and I don't know what you set the default value to.

 

Also, the initialization you are doing is not necessary, and when used as a subVI is completely pointless since the front panel of subVIs is not visible. However, if you must clear the indicators, a better way to do it is to:

  1. Open the VI Properties. 
  2. Change to the "Execution" tab.
  3. Place a checkmark in the "Clear indicators when called".
  4. Remove local variables and sequence frame.
0 Kudos
Message 2 of 7
(3,057 Views)

The "search_mode" control was set to "Aliases Only" as shown in the "why_oh_why2.jpg" attachment.  I set that value as the default.

 

I am initialising vars because I did not know if later I would reuse this subVI and then have stale data in the returned list of strings and the count var.

 

Do default value assignments made in the IDE not propagate through to the application builder?

0 Kudos
Message 3 of 7
(3,052 Views)

Default value assignments do propagate through to the application builder. The default of "search_mode" is Canonical Names so if you set the default to Aliases Only (Right Click>>Data Operations>>Make Current Value Default) and wire it in, that should be the same in an application.

 

The way smercurio_fc mentioned how to clear the indicators when called is a better way to to initialize. 

 

Would you mind posting a screenshot to show how you are calling into this subVI? These VISA resource strings should propagate through to the top-level VI, even in an application.

Peter E
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,024 Views)

Here is a very brief summary of what is going on in the program.

 

Basically, getCOMPorts returns all serial ports; an array of those names is passed to getEquipment which then does some reading/writing to find an expected ack.  The port that ack comes back on is associated with a resource handle which I use then in main for many items going forward; if no ack is received then I put up a message asking whassup.

 

I should mention once again that this works find in the IDE; only when I build an *.exe does it fail.

 

I did remove the init sections of the sequence and I did change the VI properties as suggested and I did not see any difference (works in IDE, fails in exe).

 

My next attempt is just to remove the subVI and put the VISA Find directly into the main program, or at least one layer up.

0 Kudos
Message 5 of 7
(3,008 Views)

I found my problem(s) -- an error was generated in my getCOMPorts VI.  It was being suppressed (because of something I did not know about property nodes until recently) and that was causing my error codes DLL to not load properly.  The error apparently disabled passing the I/O resource handle back up to the main VI.

 

When I fixed the directory structure and made sure I was processing errors correctly the app now works the same as the IDE.  One of my problems was I did not use a relative location for my DLL file and somehow that was fine in the IDE but not okay once the app was constructed with a new path, but my primary issue was property nodes don't function as intended when an error is passed through them.

 

I appreciate the comments and assistance from all who posted.

0 Kudos
Message 6 of 7
(2,984 Views)

In short

 

On passing an error into a subvi or propertynode the subvi or propertynode should not do anything except passing the error.

This to prevent errors to build up and hide the first error.

greetings from the Netherlands
0 Kudos
Message 7 of 7
(2,972 Views)