Well, the clue was that the encoding is BCD, i.e. Binary Coded Decimal. (See e.g. http://www.webopedia.com/TERM/B/BCD.html ) for a definition. Is the string you have in your latest example exactly the raw string you get from the machine? Your sample string is length 70 and contains spaces, probably meaning the spaces should be ignored and it is a hexadecimal formatted representation of the original string, which should be only 24bytes, right?
Please capture the raw string from your device and include it without any formatting (Just aquire, stop, then righ-click on the terminal and select "create constant, then save the VI). Your current example string does not look right.
> Hi guys, > > I am writing you back because I tried the two solutions that you > offered to me (with and without loop) and I think the problem still > exists. This time I attached simpler example and you can see what I > mean. > > I am trying to read all the pressure levels at all 8 channels of my > multi-gauge. Inside of the loop you will see the string constant that > represents the pressure levels read from the VISA read. > > Now that I have read all pressures I have to display all 8 gauges > seperatelly so that's why I am using String Subset and storing data in > 8 different indicators. This mechanism works well but the only problem > that remains is how to display string eg. 1435 00 as 1.435E+00. > > If I use the two examples that you suggested it will convert it > properly only if the input string is set to hex display and then the > 1435 00 is typed in. In this case it does convert it right into > 1.435E+00. > > But the string that I receive from VISA read or the string constant > that I use in this example can not be changed between normal and hex > display. Therefore when 1435 00 enters the convert subVI it converts > it to 3.134E+33.
If the string in the example is exactly what you get from VISA this means you are not getting binary strings from your instrument but simply text strings. The difference between these are double the number of bytes. As you have always claimed that the numbers you say were the ones needed when the string control was set to show hex Display we did assume that that was what you wanted. If the string you have in your test example is really what you get then of course our assumption was all wrong.
So the question is if you use VISA Read and display the received string in a string indicator which has been configured to show "Normal Display" what do you see? If you see all numbers you are receiving a text string with hexadecimal formated numbers. If you see lots of squares and spaces and a few normal characters you receive a binary string.
I am so glad you replied guys because the actual output string is not in the form of 0E00 030E 0003 0E00 030E 0003 0000 0000 0000 1435 0014 0300 0000 0000 as I said before it is in the form that you assumed it will be. See my example now. Here I did exactly what you told me to do. When you open attached VI you can see what is read at the output of VISA Read in Normal and Hex Display.
You are right that there should be 24 bytes (8x3) but in reality there is 30 bytes. Extra 6 bytes come from last two readings (see Front Panel: Error 1 & 2) which represent the error in the software of the multi-gauge so we can ignore it.
I am sorry for making confusion. You guys are the best.
The first four channels are showing E03 if we convert it to better format. That just means error 3 which corresponds to level at the gauge being too low or basically nothing is connected to it. So just ignore those first four channels. I should have mentioned it earlier it would be much easier for you to think.
I looked at the new VI and it looks perfect. That was basically the goal to display it in the exponential form. However the only one thing remains and that is to convert 0E00 03 error code into E03 form.
These error codes are quite important for the vacuum chamber system I am writing the program for. It is because the user can know what went wrong at any point in time and act accordingly.
I was thinking to simply sort of take the strin g as it is and then make it up like trim it and then cut extra digits out and things like that... I am not sure.
I just have to thank you for who knows what time for your time.
Now I just want to display 8 elements of an array as 8 indicators but I am thinking now how to link Status array and Numbers array. I basically want to combine the two into one because when error occurs the E03 will be displayed, when there is no error then the reading is displayed.
I wanted to check for NaN and if Numbers are receiving NaN then I would write Status to an indicator but they are different types...
I know there is a way to do it I just wanted to know if there is a fast way that you have in mind.