LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert Binary to ASCII?

Hi,
I read the data from instrument and got:
CURVE CURVID:"INDEX 0",%þùõð
I was told the the messy charactors are binary-coded numbers (4122 bytes long), how to convert it to ASCII and put them to an arry so I can view it? Thans.
0 Kudos
Message 1 of 11
(4,971 Views)
Is this from the Tek 3K scope that you asked a questiona bout a while ago? If it is, I would suggest you look at the LabVIEW driver for it and see how it's done there. There's function called tktds3K Read Waveform. There's a couple things that it does. One is to get the floating point values for intial x, x increment, y multiplier, and y zero. Then it gets the binary waveform in a subVI called tktds3k GetRawWaveform and converts the binary data to floating point. You should be able to cut and paster to do the same thing. If you are still using the non-NI GBIB board and feeling ambitious, the driver can probably be converted from VISA to whatever GPIB read and write functions the vendor has provided. It would mean replacing all of the VISA Reads and Writes with the different GPIB functions and replacing the VISA Session controls and indicators with whatever the new functions require for specifying an address (either a string or numeric would be my guess).
0 Kudos
Message 2 of 11
(4,954 Views)
Actually it is not a scope, it is Tektronix Curve Tracers 370B.
The returned data are correct and I just wonder how to read the binary data to ASCII.
thanks.
0 Kudos
Message 3 of 11
(4,947 Views)
The first thing you can do is to modify the display of your string indicator. Right-click and ask for Hex display.
The string you gave as example becomes
2510 0101 3F02 0101 9D02 0101 9B02 0101 3F02

You can convert the string to an array of U8 (String to Byte array function).
To go further, you'll have to know how the data were coded : are you waiting for a series of U8 numbers, or U16 or something else ?..
The Type cast function, in the Advanced>Data manipulation subpalette is a very usefull tool for that kind of problem.

Hope this helps,

CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 11
(4,929 Views)
An intrument driver is availabe at

http://sine.ni.com/apps/we/niid_web_display.download_page?p_id_guid=E3B19B3E9693659CE034080020E74861

The conversion is illustrated in the Vi named "370A Read Curve.vi" where the data is converted to numeric data and scaled.

It BTW use the version 4.X version of the typecast mentioned by CC.

Ben

Message Edited by Ben on 03-26-2005 03:06 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 11
(4,914 Views)
Thank you for your information. This driver is for Tek 370A but my model is 370B. The driver doesn't support my model.
From last reply, I have find out how to convert binary date to ascii. Appreicate it.
0 Kudos
Message 6 of 11
(4,904 Views)

Hello!

 

I am currently working with a Tektronix 370B and I am trying to transfer a curve from the 370B to my computer. However, I do not seem to manage to copy the curve data. Whenever i use the 'CURve?' query, the 370B returns the following character string 

CURVE CURVID:"INDEX  0",%ãܺ t_RA1"

Is this supposed to give me the coordinates of the 1024 points of the curve as said in the user manual? If it does, how can I obtain the X-Y coordinates array with this string? And if it does not, do you know what this string represents?

 

Thank you very much

0 Kudos
Message 7 of 11
(4,288 Views)

I recommend you download the driver for that oscilloscope.  You can download and install it through LabVIEW by going to Tools->Instrumentation->Find Instrument Drivers.  Do a search for Tektronix 370 and install the tk370 driver.  In that driver is a 370A Read Curve.vi.  That should do all of the work for you.


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 8 of 11
(4,276 Views)

Thank you very much for your answer.

I have downloaded the driver you advised me to download. However, the 370B doesn't seem to work quite well with this driver (made for the 370A I think). Do you know if there are any parameters I need to change in order to make it work?

Thank you again!

 

0 Kudos
Message 9 of 11
(4,244 Views)

@theojoy wrote:

Thank you very much for your answer.

I have downloaded the driver you advised me to download. However, the 370B doesn't seem to work quite well with this driver (made for the 370A I think). Do you know if there are any parameters I need to change in order to make it work?

Thank you again!


That would be a question for Tektronix.  I do not have the time to look up the programming manuals and compare commands.


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 10 of 11
(4,225 Views)