12-29-2021 06:38 PM
I’m a newbie at LV, so bare with me. I’m trying to setup a vi to grab data for 10-20 seconds every 24 hours. I’ve been trying to use an elapsed timer that triggers every 24 hrs, which will then trigger another elapsed timer that will run a while loop to grab data. Any help is much appreciated. Attached is an image of what I have.
12-29-2021 09:49 PM
First of all whenever you need to help regarding your code in discussion forum you need to upload your code to help your properly.
You really need modifications in your code.
The second while loop should be inside an additional case structure and its case elector should be wired to timer elapsed of first timer.
Why are you connecting elapsed time of first timer to set start time of second timer?
You also need to set the target time for the second timer.
You need a shift register in your first loop which should be connected to reset and timer elasped output to the shift register.
In the same way you need to add another shift register for reset in you second loop.
12-30-2021 10:44 AM
Please attach your actual VI (one or more files with the extension ".vi"). If you send a few minutes just browsing the LabVIEW Forums, you will find almost every New Message that includes a picture of LabVIEW code is followed by a request to post your code. We cannot closely examine a picture, and certainly can "click" and make it run to see what happens. [There actually is a way to submit a picture that can be run, but you are not ready to learn about it ...].
Bob Schor
12-30-2021 11:00 AM - edited 12-30-2021 02:22 PM
@loc713 wrote:I’m a newbie at LV, so bare with me.
Sorry, I think I'll keep my pants on for this 😄
As others have said, please attach your VI. We cannot run or debug photographs of your monitor.
@loc713 wrote:
I’m trying to setup a vi to grab data for 10-20 seconds every 24 hours. I’ve been trying to use an elapsed timer that triggers every 24 hrs, which will then trigger another elapsed timer that will run a while loop to grab data. Any help is much appreciated. Attached is an image of what I have.
No, this is way to complicated and convoluted. All you need is one loop and once case structure (hint: simple state machine") that does different things depending on the current state (idle, grab data) and some simple timing on how much time has elapsed in each to decide when to go to the other state (simple template). It should also monitor user interactions at all times, e.g. to stop the program..
Do you want to grab data at a certain time of day (noon? midnight? etc.) or 24 hours after the program has been started, no matter what time that is? A duration of "10-20 seconds" can differ by a factor of two but computers tend to like exact numbers better. Is this a user setting? Should the process repeat every 24 hours or every "24hours+10-20seconds")
Please clarify!
12-30-2021 09:18 PM
Ok, so it seems like the state machine is the way to go? Attached is the code that I started with, I didn't think it was necessary to attach it since I knew this wouldn't be the right direction to go in. For the program, I would like it to grab data around midnight if that makes it easier though if it's possible to make it variable that would be helpful. Also, for the time, I would like the main loop to iterate every 24 hours, every day, but I want to start grabbing data at midnight for a set time of 20 seconds, but if this can be varied that would be helpful too.