LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Logging

I have a string a data I need to log eveyrtime I press a button and save to a file with a file name that includes the data/time of when it was logged.
 
I've created a basic VI with a random number generator to generate a number every second 20 times,as my data and i've successfully got that to log the data, but it doesn't log it everytime I press the button. It only logs for one cycle, but I'm not able to interrupt it and continue logging with a new file.
 
I've very new to labview, so any help and examples would be greatly appreciated.
0 Kudos
Message 1 of 6
(3,552 Views)
Look here for a simple example and some links.

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,540 Views)

Thanks for the link

I’m still having problems with this though, and I’ll try to explain it better.

 

I’m trying to save a string of hex data to a file. Now I’ve successfully got a single instance of data to save to the file I want, but the data won’t continuously write to the file. It will write once and close, then when I press the button again, it will write once in a new file.

 

I need it to start writing the data to a file when a button is pressed, continue writing the data until the button is released or another button is pressed, either or, then close the file it is being written to. Then when pressed again, start a new file and do the same thing.

 

I’ve read multiple tutorials and had a LabVIEW basics course prior to attempting this, but nothing I’ve seen has helped.

0 Kudos
Message 3 of 6
(3,503 Views)

Here's one simplistic example of how this can be done. The start boolean is set to a switched when pressed mechanical action and is reset after the loop in case the other boolean was used to stop the loop.

Note that this example is very quick and will not scale well. You might wish to search for material about state machines (for example, you should a couple of templates in the File>>New dialog). In this case, you could have a state for opening a file, one for closing the file and one for writing to the file. Monitoring the UI can be done in an idle state using the event structure and the data can be kept in a shift register. Shown is an example of what part of the idle state can look like. It's advisable to use typedefs both for the cluster and the enum so that you can change them more freely.


___________________
Try to take over the world!
Download All
0 Kudos
Message 4 of 6
(3,488 Views)

Thanks alot! I finally got it working correctly. I also talked to some friends here at work and the one suggested using a Queue, which ended up working for me once i figured it out.

The problem i have now is the format of the data when its written to a file. This is what i see when i view the file"

   q €    @0ÿÿÿÿ string       zEB 90 AA 21 22 00 18 2A 42 00 00 00 00 00 00 00 00 00 00 00 00 39 1F 00 00 00 1E 00 18 00 19 00 6C 01 31 01 47 01 4F 01

I have no idea where the characters marked in red came from. Everywhere I view the data prior to it being written to a file only dispalys the hex values, but when i view the file, those characters appear also.

I forgot to take a screenshot of what i did but i'll try to do that tomorrow

0 Kudos
Message 5 of 6
(3,456 Views)

My guess is that you are somehow saving the entire string (including the part which defines it) into the file instead of just saving the text part, but without seeing your code I can't tell for sure.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(3,449 Views)