LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ASCII to decimal conversion

That does look closer to what I am expecting! (A sine wave with mvolt range amplitude). What is ultra edit? Also, which palette has the correct SGL array control? I'm really new to labview- I'm sure these are pretty basic questions.

0 Kudos
Message 11 of 24
(1,507 Views)

I'm not exactly sure what values should come up, but it's supposed to be a sine wave of some sort with mvolt amplitude. It may vary  a lot- I'm putting together the diagram to check what you got. Thanks!

0 Kudos
Message 12 of 24
(1,505 Views)

Brilliant, crossrulz.  It is entirely unclear how a binary file got additional characters added, except when the file got "text-ified", perhaps the routine saw <CR>, which is just a Hex character (0x0D) and said "Oops, that needs to be turned into <CR><LF> for this PC" and added the extra "noise".

 

We each have our own "text editing" tools that can open a file and do "interesting" things to it.  I don't know UltraEdit, but it clearly has the Search-and-Replace capabilities to find the <CR><LF> pattern and replace it with <CR>.

 

If you transform the data file by removing those extraneous <LF> (you can't remove <LF> by itself, since it is also a potentially valid Hex binary quantity, 0x0A, and, indeed,  0x0D0A is also valid, but statsistically unlikely in a pure non-Ascii Binary File), and then run the (corrected) Read routine I posted, it now gets a very nice and consistent set of data, ending just at the "Stanford Research Systems" Ascii string at the very end of the file.

 

Bob Schor

Message 13 of 24
(1,496 Views)

@ab7643 wrote:

 Also, which palette has the correct SGL array control?

 There is no SGL Array control in that snippet.  There is a SGL Array constant.  You drop an empty array constant container on the block diagram.  Drop a SGL constant (or any numeric constant and change the representation to Single).  Then drag that constant into the array container.

0 Kudos
Message 14 of 24
(1,493 Views)

@ab7643 wrote:

That does look closer to what I am expecting! (A sine wave with mvolt range amplitude). What is ultra edit? 


UtraEdit is a text file editor much like the Windows Notepad application, but on steroids and cryptonite. I used to use it years ago but the licensing got somewhat a hurdle. Since then we use Notepad++, an Open Source text editor that can do most of the things UltraEdit can do, and is highly extensible.

Rolf Kalbermatter
My Blog
0 Kudos
Message 15 of 24
(1,484 Views)

@Bob_Schor wrote:

Brilliant, crossrulz.  It is entirely unclear how a binary file got additional characters added, except when the file got "text-ified", perhaps the routine saw <CR>, which is just a Hex character (0x0D) and said "Oops, that needs to be turned into <CR><LF> for this PC" and added the extra "noise".

 

...

 

If you transform the data file by removing those extraneous <LF> (you can't remove <LF> by itself, since it is also a potentially valid Hex binary quantity, 0x0A, and, indeed,  0x0D0A is also valid, but statsistically unlikely in a pure non-Ascii Binary File), and then run the (corrected) Read routine I posted, it now gets a very nice and consistent set of data, ending just at the "Stanford Research Systems" Ascii string at the very end of the file.

 

Bob Schor


Please see reply #8 were crosrulz posted...

 

"

@Ben wrote:

Please note the flavor of "write" he was using that could be corrupting the file.


Very nice catch!  And there are a bunch of 0x0D0A in that file.  So the value got converted quite a bit.

 


@Ben wrote:  Maybe better to use a straight out write binary.

Just make sure the "prepend array or string size" is set to FALSE.  Or you can just turn off the "Convert EOL" on the string write.  works the same either way.

"

Read the help for the write text to file and the options.

 

Back in the day ASR-33 teletypes, it was possible to get "bold" text by just doing a <CR> and type the line again. TO move the paper to the next line you would do a <LF>. SO when you wanted to print something normal (no bold) each line would end in <CR><LF> to return to the left side of the paper and advance the paper one line. That option on the write text to file was intended for that situation.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 24
(1,470 Views)

Notepad++, Textpad and UltraEdit are 3 powerful text editors of which you simply need to have one. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 17 of 24
(1,460 Views)

@Ben wrote: That option on the write text to file was intended for that situation.

Actually, the option is for platform interopability.  If you write a text file in Windows, you want the code running on a MAC to treat the <CR><LF> as the end of line character instead of just the <LF>.  The teletype history is why Windows uses the <CR><LF> as the end of line.

 

I have a corporate license for UltraEdit.  Where I really like UE is for the hex view since I have had to deal with a lot of binary data files.  Also useful for catching non-printable characters that hide in some text files and mess everything up.  Not sure if Notepad++ has this option (not that I was able to find when messing around with it for 10 minutes).


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
0 Kudos
Message 18 of 24
(1,455 Views)

@ab7643 wrote:

Hello there! I have an SR860 lock-in amplifier, which returns ascii data packed as a 4-byte single precision binary block in little endian format. I am controlling it completely through VISA, since there is no official driver for this instrument. Is there a way to add in something to convert the data to decimal numbers? I have my VI set up to create a text file of the data. Although I can change the read buffer to show the data in hexadecimal form, the text file is still in ascii form. I've attached my VI and a text file of the data. 


I suggest you try the driver for the SR865, as I think the SR860 is compatible.

0 Kudos
Message 19 of 24
(1,446 Views)

 wrote:
Not sure if Notepad++ has this option (not that I was able to find when messing around with it for 10 minutes).

It sure has but not out of the box. It is one of the many possible plugins you can download and install right from the Plugin Manager within Notepad++. The only drawback is that after an update of Notepad++ it tends to disable most plugins that have not been vetted for the new release by the plugin author and the Hex Viewer is one of them. But I had never any problems to reinstall it afterwards.

Rolf Kalbermatter
My Blog
0 Kudos
Message 20 of 24
(1,434 Views)