LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array subarray question

OK, my example is pretty basic and not yet polished. 

 

It is a first step in reading data from a custom device, viewing the raw data,

dumping a header and performing calculations on the data.

 

I don't have the custom device built yet but wanted to get the code feasibility figured out first. 

thanks

 

strin_exp.jpg

0 Kudos
Message 21 of 24
(1,363 Views)

As of right now, your U1 through U4 will never change.  There values are going to be set by that "header" data you created.  Even then, you are only reading 16 bytes, which would be just enough to read your cluster.  You did not include any more data for your channel data.

 

Since you said this is coming from a customer device that you are in control of, you should be able to set the data format being sent.  I would recommend using all ASCII data.  So your U1 through U8 can be represented by 4 bytes each in an ASCII format to represent the hexidecimal values.  Just to be consistant, seperate them by spaces.  Then send the data stream with a Line Feed (0xA).  If you configured VISA to use that as a termination character, then the read will finish when it finds that character.  You just have to tell the VISA Read to read a large number of bytes.



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 22 of 24
(1,344 Views)

Thanks Crossrulz

 

You wrote: "As of right now, your U1 through U4 will never change.  There values are going to be set by that "header" data you created.  Even then, you are only reading 16 bytes, which would be just enough to read your cluster.  You did not include any more data for your channel data."

 

I guess I was too quick putting that VI together but I could fix this if  I changed the first part to read 32 bytes in order to display 16 Uints of data, and add the 8 bytes for the header in the cluster, right?

 

Your suggestions for setting up the custom device sounds feasible but what I am really interested in knowing is, if I connect this to a device that is just pumping out a data stream consisting of 16 bit 2's compliment big endian hexidecimal data without any delimiters, then how can collect that stream of data and perform some calcuations on it. 

 

In following up with my initial questions in this thread about using the string data as an input, I  was looking to understand how to impliment the examples that you gave earlier with the string data in order to collect and convert the data with the calculations.  So I put together the front part of the VI  to accomodate your request, "This is when we again ask for an exact example of your input data and exactly what you expect for an output.  Please include the cluster type as well."

 

In another reply, Altenbach wrote, "A binary string is not a spreadsheet string. You description is insufficient to solve the problem", but I am not sure what he means by that...

 

Sorry if I sound confused guys but I am new to this and seeking to understand how to collect a stream of data and perform some calcuations on it.

 

Thank you for your patience and help with this.

0 Kudos
Message 23 of 24
(1,319 Views)

are there any LabView examples out there showing how to read a stream of binary data  from a device into an array where the values can be converted or calculated?

 

I have been searching online and in my labview examples folders but am not finding anything,,, 

0 Kudos
Message 24 of 24
(1,278 Views)