Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

timing execution

Solved!
Go to solution

Hello

I will build a real time aplication and i want to work for few minutes every one hour automatically. Does anyone has any idea how to do that?

Thank you

Regards

0 Kudos
Message 1 of 8
(4,554 Views)

Use Get Date/Time function to get the current time, run your code, set a shift register with the absolute time at which to next run your code (add one hour to the current time). In every loop compare the current time to the shift register. When current time is equal/greater than shift register time, run your code and update the time in the shift register.

 

Run code every hour.png

 

In the False case the current value from the shift register is passed straight through.

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
Message 2 of 8
(4,546 Views)

Hello Christian,

thank you for the reply i will need a little more explanation.. the constant 3600 indicates the seconds (total one hour ) which i want my code to ''wake up'' and run?  for example if i want my code to run for 2 minutes every one hour where i have to insert the 2 minutes and how, as an input of the greater/equal ?

 

 

0 Kudos
Message 3 of 8
(4,529 Views)

Hi Zaxos,

 

You will then need to add more logic to the example. I hope this does not add to the confusion, but I have elected to use the Elapsed Time VI:

timing.png

Message Edited by DiscoBall on 05-03-2010 09:32 AM
Joshua B.
National Instruments
0 Kudos
Message 4 of 8
(4,513 Views)

Hello Joshua,

I tried that method and i think is working proberly only the first time. In the second cycle of the elapsed time 1 (at the second hour in this example) the case structure become true again but the internal while loop is not working because has already been stopped.

Do you have any idea how to fix this problem?

 

Regards

Zaxos

 

0 Kudos
Message 5 of 8
(4,509 Views)
Solution
Accepted by topic author Zaxos

Hi Zaxos,

 

You can add a bit of logic so that during the first iteration of the inner loop the Elapsed Time VI is reset. If you are not wanting the first Elapsed Time VI to keep counting while the inner loop is executing then you may need to add similar logic.

 

timing_2.png

 

Since it sounds like you are new to LabVIEW I recommend going through a LabVIEW Training Course. They range from free self paced training to instructor led training.

Joshua B.
National Instruments
Message 6 of 8
(4,498 Views)

Thank you Joshua,

This is what I needed...

I need a solution to another one problem to finish my senior project. If you have any link that could help me you can post it here. I would be very thankful.

I want to send a spreadsheet through a crio gsm module ( tcp communication ) to a static server.

 

I am new in labview, but I am hurry now because I have to finish my project to take my degree!

 

Regards 

0 Kudos
Message 7 of 8
(4,491 Views)

Hi Zaxos,

 

You should make a new forum post for you next question.

Joshua B.
National Instruments
0 Kudos
Message 8 of 8
(4,487 Views)