LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I am looking to write a single line of data every 4 hours.

I have a display where I am sending data via USB to a 4 digit display. I write the time pause and then write the barometric pressure. A request was made to write a single line of the string and data to a LVM file every 4 hours. I am not sure just how to enable and disable the ENABLE line. I don't want to write more than one line on the write cycle.

 

Any Ideas.

 

 

Thanks

 

Philip

 

0 Kudos
Message 1 of 10
(3,523 Views)
An Elapsed Time function could be used. Just wire the Time Has Elapsed output to the Write to Measurement File and be sure to set the function to automatically reset when the target is reached.
0 Kudos
Message 2 of 10
(3,500 Views)

Thank you for the fast response. I starting taking the hour and divide by 0,4,8,12,16,20,24. If equle to 0 then write.

 

Thank You,

 

Philip

0 Kudos
Message 3 of 10
(3,487 Views)

Why not just use the modulus function?  The Quotient of the division isn't as useful as the Remainder for something like that.  For example

 

4 hrs = 14,400 secs

 

0 % 14,400 = 0

1 % 14,400 = 1

2 % 14,400 = 2

...

14,399 % 14,400 = 14,399

14,400 % 14,400 = 0

...

28,799 % 14,400 = 14,399

28,800 % 14,400 = 0

 

Everytime the result = 0, it has been 4 hours.

 

0 Kudos
Message 4 of 10
(3,481 Views)

That is exactly what I did. I tested the VI at 1 minute and 5 minutes. Now I have it set for 4 hours. I will leave it overnight and verify the results.

 

Thanks for your help. It did not work at first! I was off by one 0.

 

Thank You

 

 

Philip Nielsen

0 Kudos
Message 5 of 10
(3,475 Views)

If you use Nickerbocker's suggestion, make sure that you test the time at least once per second.  For example suppose that you test at 28799 (remainder = 14399) and then do not test again until 28802 (remainder = 2).  In this case you would never have remainder = 0 and would miss the write to file.  Of course you could test for current remainder < previous remainder to indicate a rollover.

 

Lynn 

Message 6 of 10
(3,474 Views)

Now that I did not think of at all. Excelent point to consider. I have my VI running with 14400 seconds right now. I will check on it in the morning. This data is for the FAA records.

 

Thank You,

 

 

Philip

0 Kudos
Message 7 of 10
(3,470 Views)

Good catch Lynn!

 

 

There is an express vi called "Elapsed Time" which might make the problem simpler.

Time Elapsed Snip.png

Message Edited by Nickerbocker on 09-30-2009 03:28 PM
0 Kudos
Message 8 of 10
(3,464 Views)

Nickerbocker wrote:

Good catch Lynn!

 

 

There is an express vi called "Elapsed Time" which might make the problem simpler.

Time Elapsed Snip.png

Message Edited by Nickerbocker on 09-30-2009 03:28 PM

 

Isn't that what I said? I don't think you want the shift register. It will automatically reset after the target and not go high until another 4 hours have elapsed.
0 Kudos
Message 9 of 10
(3,461 Views)

So you did.  I read the authors last post and saw something with divisors = 0 and thought that the simple answer was overlooked.

 

BUT, did you provide a snippet?

0 Kudos
Message 10 of 10
(3,453 Views)