06-17-2014 07:44 AM
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
Solved! Go to Solution.
06-17-2014 07:53 AM
Attached VI
tnx
06-17-2014 07:53 AM - edited 06-17-2014 07:54 AM
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.
06-17-2014 08:01 AM
I think this is what you meant to post.
Does this work as you expect it?
06-17-2014 08:39 AM
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.
06-17-2014 08:48 AM - edited 06-17-2014 08:49 AM
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"
06-17-2014 10:51 AM
@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.
06-17-2014 11:12 AM - edited 06-17-2014 11:27 AM
@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 instance
06-18-2014 01:19 AM
Hi Crossrulz
Trim whitespace worked perfectly. THANKZ!!!!
06-18-2014 01:30 AM
Hey,
and don't forget to close the Visa Connection in the end.
Regards,
CMW...