10-12-2015 11:25 PM
Hi all. Need a little help with a project.
So I am reading in a string of 8-bit bytes, for example "10101010 11111111 01010101" etc. I need to extract each byte and then display it as a decimal. I tried using String to Byte Array and a few others but coudnt figure it out. Any help would be most grateful!
10-12-2015 11:43 PM - edited 10-12-2015 11:44 PM
All bytes are 8 bit, but you need to clarify how they are represented in the string. Is your example a binary formatted string consisting exclusively of the two characters 0 1nd 1? It also looks like ther is a delimiter after each group of eight characters. What is the delimiter (space, tab, etc.)?
If you want help, please attach a small VI that contains a typical string as default data so we get a better idea what this is all about. So far the problem is quite ambiguous.
10-13-2015 01:08 AM
There are actually 2 options Im looking at.
The first is just like i wrote. Binary formatted string of 8-bit bytes seperated by a space.
The other option. the more preferrable one which i haven't had much luck figuring out it is reading in 48 8-bit bytes continously one after the other. and then sorting and displaying each of them
10-13-2015 01:24 AM
@sout23 wrote:
The first is just like i wrote. Binary formatted string of 8-bit bytes seperated by a space.
Use "Spreadsheet string to array" with space as delimiter, an integer U8 1D array type, and a binray format specification.
@sout23 wrote:
The other option. the more preferrable one which i haven't had much luck figuring out it is reading in 48 8-bit bytes continously one after the other. and then sorting and displaying each of them
This sentence makes little sense? A "fixed size" (48) and "continuously" are contradictory. Sorting by what (e.g. alphabetical by binbary formatted text? Numerically by scanned value?) Displaying each or displaying all? Display how?
10-13-2015 01:44 AM
Sorry, "continously" was a poor choice of words. Basically, i am reading data from a serial port. There are 48 bytes (8-bits in binary format) being "dumped" into a serial port and I have to read them. I am using the VISA read function in Labview to read them all, but this function reads the data as a string not an array. so i have been having trouble trying to figure out how to display each byte seperately.
Apologies if this is too confusing.
10-13-2015 06:59 AM
I had the same problem, and here's how I solved it:
Bob Schor
10-13-2015 07:14 AM
Thanks, any chance you could attach a picture or the VI itself?
10-14-2015 08:37 AM
Or could you perhaps explain in a little more detail how to use autoindexing Byte Out tunnel and use it to create the array of Bytes you need, and also how you passed the array of bytes into another function that combined the bytes and displayed them. Thanks
10-14-2015 08:51 AM
@sout23 wrote:
Or could you perhaps explain in a little more detail how to use autoindexing Byte Out tunnel and use it to create the array of Bytes you need, and also how you passed the array of bytes into another function that combined the bytes and displayed them. Thanks
Sounds like LabVIEW tutorials are needed. http://www.ni.com/getting-started/labview-basics/
10-14-2015 09:15 AM
Tried that before i posted in the forum.