LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to count occurences of a certain string in incoming real-time data? Also displaying RTC data. Current VI included

I use LabView student Express 7 on a Windows XP system.

Time-frame: we are doing final integrations for our balloon experiment today. We just got told that the press wants to view real-time data, which we haven't programmed for. I need help to get a working VI at the latest by 25.02.2004 before 0800(morning) (GMT+1).

Note on license
It is a student balloon flight, and the data will not be used in scientific work, so the I am not breaking any license agreements (I hope).


Problem synopsis:
The balloon continually transmits data at 9600baud. The data is a semi-repeating header followed by a constant lenght data-package arranged like this:
BEXUS[h][m][s]BEXUS[h][m][s]
[Raw binary data, 7channels*8sub-channels*8bits]

What the groundstation is doing right now:
Take all incomming data and save (append) the data to a file without any data-handling. (We figured we would go post-processing).


What I need to change in less than 24 hours:
- Add a "package" counter
- Add a display of the clock data (RTC)


How I planned to implement the changes:
-RTC display:
The RTC data is in BCD format, since that means that if you look at the data as hex numbers, you get the hours and minutes and seconds out in "clear text". That is 12 hours is 0x12hex. I figured that I can do a match pattern BEXUS and pass the "after substring" to another match pattern BEXUS from which I feed the "before substring" to a type-cast VI (casting string to u8) and displaying that, which should give me a display of "123000" for the time 12:30:00... I couldn't get it to work at all when I tried out the supplied "beta" vi.

- Package counter:
Counting how many BEXUS that gets detected and dividing by 2. I don't know how to do this. I've looked on the forum (a good thread on the problem: "how do I count the number of *'s in a string") but these use either loops or arrays... and I'm not sure how this works when I'm getting the data in at realtime. I cant make an array and then count it, since then the array would grow fast and possibly interfere with saving of the data??? Saving the data is critical.. without that file we cant do post-processing.


Since my time is so limited (I'm not even supposed to do the groundstation software but they called on me in the last minute because no-one else had time/wanted too/could do it) I hope that you could make an exception and provide me with working VI's (based on the one I have attached) so that I can show something to the press! (Free comercial for NI!! Since the student version shows the National Instruments water-mark on all VI's!!! Possible TV time!!)

Thanks!

PS: even if you are to late (after 25) post anyway!
Why:
-I can learn from it
-the launch might be delayed due to weather conditions
-others might find it amusing!

Thanks again!
0 Kudos
Message 1 of 9
(3,484 Views)
See if the attatched vi solves your problem. You need to replace some of the top loop with the bottom one. How many bytes are after each BEXUS string? 3? It would be better to provide some sample strings.

Joe
Message 2 of 9
(3,484 Views)
I didn't explain the incomming dataformat all that clearly, so I will do it again.
Incoming serial data format is the text within quotes. It is repeated in a while(1) loop on the balloon.
"BEXUS[h][m][s]BEXUS[h][m][s][7*8*16bits of data]"
[h]=8bits [m]=8bits [s]=8bits

So that means, that after the first "BEXUS" you have 3 bytes (containing the hours, minutes and seconds) while after the second BEXUS you have 112 bytes of raw data then it "wraps around" and repeats. (The raw data and the clock data changes from each iteration.)

Right now the gondola have been taken appart for some final adjustments so I cant get a test-file for you right now. I will post it within 1 or 2 hours though.


Regarding your VI, I don't really understand all you are doin
g, and I don't know what in your bottom loop should replace what parts in my modified loop. I could probably figure it out given some time that I don't have..

I must say that I really appreciate your input and help though, and I hope that with this new information and a test file you can help me even further. I'll refer to you in the project report for your help and input on this, I don't want to steal any credit.
0 Kudos
Message 3 of 9
(3,484 Views)
I hope this VI is OK. Need to test and maybe some modification.

Joe
0 Kudos
Message 4 of 9
(3,484 Views)
There were some mistake in the previous update, here is a new one.
0 Kudos
Message 5 of 9
(3,484 Views)
... ... There is yet another mistake! More of this will certainly kill my confidence.
0 Kudos
Message 6 of 9
(3,484 Views)
Well, thats it, the launch is in T -2.5 hours and counting. Me and some core members have been out in the hangar working all night to weed out some minor problems that crept up during final integration, but I think we got it.

For some weird reason, neither the original VI (barebone save data to file) or the visually nice VI created by Joe Guo in express time, works on the computer we had available. The thing is, I know that the simple one works on another laptop, I'll see if I can get my hands on it before the flight and test the software on that one.

I'll report back here during the day if I get more interesting and relevant information.

A HUGE thanks goes out to Joe Guo for IMPRESSIVE speed and feedback! From a
ll of those in the ground-station crew and myself (Housekeeping), Thank you!
0 Kudos
Message 7 of 9
(3,484 Views)
I have a valid example data file attached to this thread.

If you open BEXTEST.bin in a hex-editor of your choice, you'll see the BEXUS as 42 45 58 55 53 and then the time as 00 28 09 etc.

I couldn't get Joe Guo's VI to work. It doesn't count packages correctly, and the time is not displayed correctly either.

The file was saved using a straight save to file VI.

The data is from actual launching area tests performed a few mintues ago. The time displayed is "On time" e.g. how long the gondola has been powered up.

I have a spare T-junction, so I can hook into the balloon real-time data as we fly, in case anyone care to see if they can figure out why the latest version of Joe Guo's program is not displaying correctly.

I will monitor this
thread during and after flight to see if anyone can make it in time!

Thanks for the great effort!!
0 Kudos
Message 8 of 9
(3,484 Views)
The package count I used was to count # of BEXUS, not the complete package, replace the 2 with 1 should count each data package.

The data file shows the time from 00:28:09 to 00:28:59, then went to 00:00:01 and then to 00:03:59. The VI assumes the package format as (each complete package is about 128 bytes long):

BEXUS H M S BEXUS H M S Data (112 bytes)

If this is not the case, then the VI need to be modified.

Joe
0 Kudos
Message 9 of 9
(3,484 Views)