09-18-2018 03:22 AM
Hi,
I have written a program that serial reads from arduino the Dallas DS18B20 two sensors data as well as the stepper motor position data. I ran my setup for 24 hours but end up having a 70GB .txt file which I cannot open easily. What i ask help here that if possible someone can help me with how can I generate a new .txt file after every 30mins. So my log files are still able to open easily by any test editor.
Please find my .VI attached.
Thanks.
Solved! Go to Solution.
09-18-2018 05:35 AM
The simple way is to use the Elapsed Time express VI in the Timing palette. When the time has passed, close your current file and create a new one. If you dig into the File IO->Advanced File Functions, you will find a VI in there called Create File With Incrementing Suffix. That will help keep unique file names.
09-18-2018 05:57 AM
thank for the reply.
I able to get new files but they are empty , i want my serial data captured it to be in it as well. is there any example to use this feature. Thanks.
09-18-2018 06:21 AM
Are you storing your file reference in a shift register?
09-18-2018 09:22 AM
First question, do you need to save that much data? Second thought would be if you do, you should be using a database and not files.
If you must use files that you need to open/close/create your file within your loop. In your current code you are opening the file outside your loop so you end up with a single file. I would recommend that you look at using a state machine or a producer/consumer pattern for your application.
09-19-2018 03:52 AM
Hi,
No I guess, I am not familiar with this technique. please find in attachment the .VI i did, its incomplete coz i am not getting any idea how to use it in line with my codes. It runs but goes to False.
09-19-2018 03:59 AM - edited 09-19-2018 04:05 AM
Hi awaisfarooqi,
I ran my setup for 24 hours but end up having a 70GB .txt file which I cannot open easily.
This is because you are constantly duplicating data (!) with that FeedbackNode inside the case structure.
And then you write that duplicated data to your file.
Stop duplicating the data to reduce the filesize!
09-19-2018 04:32 AM
I tried it but it only runs once, time stamp appears and other all in block diagram simulation i see error and data from serial port is not being read.
09-19-2018 06:51 AM - edited 09-19-2018 06:59 AM
@awaisfarooqi wrote:
I tried it but it only runs once, time stamp appears and other all in block diagram simulation i see error and data from serial port is not being read.
And what error are you seeing?
EDIT: Just looked at your last posted VI. The FALSE case is completely empty. So when your "Start Reading" control is FALSE, you a losing your reference to the serial port. My recommendation is to just get rid of that control and case structure. If data is coming in, you really need to be reading data from the port or you will get errors.
Additionally, you do not need any of those waits. Even if you leave the case structure, just put the wait in the FALSE case. The VISA Read waiting for data will limit your loop rate.
09-19-2018 08:56 AM - edited 09-19-2018 08:57 AM
Hi awais,
time stamp appears and other all in block diagram simulation i see error and data from serial port is not being read.
Which error did you receive?
Is there a problem with your serial port?
Can't you handle the serial port problems?
Do you need to wait for your device to send data (as I deleted the "Read" button and the case structure)?
Why does it only "run once"? The only stop condition is that stop button in the loop!
All I did was simplifying your VI to a reasonable state. Only YOU have the hardware connected to let your VI run and debug!