LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creat new files at the beginning of every hour

Solved!
Go to solution

@masterwho wrote:

Thank you very much for your reply. I tried to use time stamp to control the creation of the files. However, it seems that the wait function isn't stable enough, it didn't sample as expected. For example, I set the wait function to wait for 10ms, but it delays for about 12ms. It's really weird! Do you know how to fix it?

 

Thanks a lot!


The Windows operating system has overhead that Labview cannot control.  So it is possible that setting a wait for 10ms may result in a longer execution time.  There is nothing that can be done about that.  However, there is a Timed Loop function within Labview that will casue the code to be executed in the exact time specified (well, almost exact).  So if you are worred about timing that much, use the timed loop and set it for 1 minute (60 seconds or 60000ms).  Put all the code inside the timed loop but delete the wait function.

 

If you read my last sentence below my diagram, you would have seen that I made a mistake with the wait time.  It should be set to 60000 ms.  This is one minute.  With this modification, the code will check every minute for the minutes part of the time string to be 00.  It isn't time critical.  It can check every 60000ms or every 60012 ms, it will still catch the beginning of the hour. 

 

If the wait is a lot more than 60000ms, there could be a scenario where the code runs at 5:59:59.999pm and the wait is a little more than one minute and the next time it runs will be at 6:01:00.000001, then it will miss the beginning of the hour.  A timed loop would fix that for sure.  Also, code can be written to check the hour portion of the time string and store it into a shift register.  Continue to check the time string every minute.  When the hour is no longer equal to the stored hour, then you create a new file.  This method will guarantee a new file every hour even though the wait time may be slightly more than one minute.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 14
(706 Views)

Hi, I tried to make same block diagram as you given but my function always goes to false, without any new file creation. 

0 Kudos
Message 12 of 14
(463 Views)

@awaisfarooqi wrote:

Hi, I tried to make same block diagram as you given but my function always goes to false, without any new file creation. 


Is his just a statement of fact?

 

If you are trying to ask for help, then perhaps you can help us help you by attaching your code so we can see what you did wrong.

0 Kudos
Message 13 of 14
(460 Views)

@awaisfarooqi wrote:

Hi, I tried to make same block diagram as you given but my function always goes to false, without any new file creation. 


Crosspost


GCentral
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 14 of 14
(456 Views)