LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what's wrong with my vi

Solved!
Go to solution

What's wrong with my VI?

When i'm using a string control to select on the case structure, my vi  is working as expected. But when i'm using the output of the read visa which outputs exactly the same string as the one i used in control string, the vi is not working as i expect it.

The output of the read visa string is "HP8593E", an id query from agilent spectrum analyzer.

 

thank you for your help..

JLS

SA_SELECT.JPG

0 Kudos
Message 1 of 10
(3,254 Views)

Attached VI

 

tnx

0 Kudos
Message 2 of 10
(3,242 Views)

Wire it up to read the VISA and put a probe on the string or look at the display mode for your indicator.

I'm guessing there are some extra/different characters in the VISA read that you're not accounting for.

Step through and see which case gets exercised and what data you actually have on the wire.

 

Post your VI with how you've wired it to read VISA and we might be able to help more. (i.e. knowing how you've configured your case structure would help here.)

 

EDIT: Saw that you just posted the VI. Thanks.

0 Kudos
Message 3 of 10
(3,241 Views)

I think this is what you meant to post.

VISA Read Snippet.png

Does this work as you expect it?

0 Kudos
Message 4 of 10
(3,233 Views)
Solution
Accepted by topic author Juls

I'm willing to bet that your instrument is putting out a termination character, usually and End Of Line character (0xA).  I recommend using a Trim Whitespace on the string going into your case selector to remove this End Of Line.


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
Message 5 of 10
(3,216 Views)

Or just make the case selector "HP8593E\00..HP8593E\FF"  Hint type Alt+0000 and Alt+0255 for the escaped ASCii chars to set "the range of any string that begins with HP8593E"


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

@crossrulz wrote:

 I recommend using a Trim Whitespace on the string going into your case selector to remove this End Of Line.


I agree that trim whitespace should be all you need. For good measure, you should also set the case structure for case insensitive matching.

0 Kudos
Message 7 of 10
(3,182 Views)

@altenbach wrote:

@crossrulz wrote:

 I recommend using a Trim Whitespace on the string going into your case selector to remove this End Of Line.


I agree that trim whitespace should be all you need. For good measure, you should also set the case structure for case insensitive matching.


The instrument's FW has a 50 char buffer for the ID response.  Without knowing the exact FW on the device the ranged case is recommended.   HP has a nasty habit of adding fields where buffers exist (And sometimes even entire alternate language support SCPI) so, a response of "ModelID, FWVER, SER" is to be expected in later FW  "HP8593E..HP8593E\FF" permits this flexibility.  (Especially since the instrument is obsolete and you don't know what FW is on the next device you can buy.)   It may cost just a bit in performace Really? a nanosecond or two for each ID?  we don't ID? the device a million times, it will not impact test cycle time.  Yes a Case insensitive match would be perfered.  Match pattern may be better.

 

Its not all that often I would disagree with the two of you...But in this instanceSmiley Wink


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

Hi Crossrulz

 

Trim whitespace worked perfectly. THANKZ!!!!

0 Kudos
Message 9 of 10
(3,125 Views)

Hey,

 

and don't forget to close the Visa Connection in the end.

Regards,

CMW...

0 Kudos
Message 10 of 10
(3,120 Views)