12-18-2011 12:22 PM
I have some instrument which communicate with PC via RS232. So I use VISA write, read...
It's working OK, but have next problem
I want to compare two strings, one is constant other one will come out from VISA read. If I use indicator, it's show "hex"(for example 3E04 4B73 ) value from VISA, but if I use same wire to "equal?" to compare two strings it's return strange values...
Let's see all together to see what's my problem:
Solved! Go to Solution.
12-18-2011 12:40 PM
I don't know the definition of "strange values", especially for a boolean that can only be false or true. Can you explain?
What is the display format of the diagram constant? (normal or hex?)
Once you have the right valuue in the indicator, you can right-click the terminal and "create constant". Now you have a diagram constant that is guaranteed to be identical to the current value of the indicator.
12-18-2011 12:50 PM
o, you don't understand it's not problem "case"... it's problem in READ visa, if I use "string indicator", it's show HEX numbers, but if I use same wire to anything else in this case for case strocture it's show strange values...
12-18-2011 01:10 PM
The probe uses normal display while the indicator uses hex display. Since you have a binary string, some values are unprintable characters and will not show anything useful in normal display. This is just a cosmetic issue.
There is nothing wrong with that, the underlying data is the same.
12-18-2011 01:16 PM
But why then if I use for example "equal", and compare "wire string" and "string" which is equal to those which show in indicator it's never same? For these reason I check with probe and see what you can see on picture..
12-18-2011 01:37 PM
You did not answer my question about the display format (right-click) of the diagram constant.
12-18-2011 01:47 PM
It's "hexadecimal"
Soo ">Ks" means "3E04 4B73" ?? I still don't get it; It's string indicator...
12-18-2011 01:51 PM
The question altenbach asked was not the display format of the read indicator but the display format of the constant "3E04 4B73" connected to the = comparison on the block diagram. By default string constants display in normal mode. Did you change it to hex?
Lynn
12-18-2011 01:55 PM
Why I should do that, the constant "3E04 4B73" it's as "normal display", but value "3E04 4B73" is already HEX !! If I choose to "hex display" it's show me "3345 3034 2034 4237 33".
12-18-2011 02:05 PM
A string is an array of bytes interpreted as text characters.
So the string which displays as "3E04 4B73" in normal mode consists of the ASCII characters "3" "E" "0" "4" "<space>" "4" "B" "7" "3". The hex values of those ASCII characters are "3345 3034 2034 4237 33". ASCII 3 = hex 33. ASCII E = hex 45.
If you want to type in the hex values to a string control or constant, you must set it to hex display.
To see what is in a string wire it to a String to Byte Array conversion primitive and then wire the output of that to an array indicator. This will show the numeric vaules of each byte in the string. You can set the numeric display for decimal, hex, octal or binary.
Lynn