09-19-2012 10:07 PM
Hi All
I'm new to LabVIEW
I want to create a program that can start data acqusition at 5AM and stop at 7PM and restart at 5AM in the next day and so on
The ilustration is as below:
05:00 AM 20 September 2012 Start data acquisition
07:00 PM 20 September 2012 Stop data acquisition
05:00 AM 21 September 2012 Start data acquisition
07:00 PM 21 September 2012 Stop data acquisition
and so on.....
Can anyone help me on this please?
I attached the VI below
Thanks in advance 😄
Solved! Go to Solution.
09-19-2012 11:06 PM
Use a simple state machine. Here is something to get you started. NOTE: The ENUMs used in this code should be a typedef. I did not do that for this simple example.
09-19-2012 11:16 PM - edited 09-19-2012 11:16 PM
@Mark_Yedinak wrote:
Use a simple state machine. Here is something to get you started. NOTE: The ENUMs used in this code should be a typedef. I did not do that for this simple example.
Mark I have a question for you. I feel there is no difference when we use the Get date/time in seconds or not and the stop button is inside the sequence structure that also I feel no difference if we don't use the structure. Is there any specific reason why you have done in this way? (just trying to understand)
09-19-2012 11:32 PM
Yes, the Get Time in Seconds is probably not required. The Stop button in the frame is missing a wire. I intended to have the state wire wired to the frame which would force the stop condition to be read after the state execution and not before. As written it would read as soon as the loop iteration starts. If read early it can result in an extra state being executed. I just whipped this up very quickly so it was easy to make a few simple mistakes.
09-19-2012 11:54 PM - edited 09-19-2012 11:59 PM
you can also try this.....forgot to include in the text: OFF-0000 to 0400?
09-20-2012 12:05 AM
also?....
09-20-2012 12:07 AM
@Mark_Yedinak wrote:
Yes, the Get Time in Seconds is probably not required. The Stop button in the frame is missing a wire. I intended to have the state wire wired to the frame which would force the stop condition to be read after the state execution and not before. As written it would read as soon as the loop iteration starts. If read early it can result in an extra state being executed. I just whipped this up very quickly so it was easy to make a few simple mistakes.
Yes simple mistakes always happen but I thought there may be hidden advantages. Thanks
09-20-2012 10:15 AM
@apok wrote:
you can also try this.....forgot to include in the text: OFF-0000 to 0400?
The case structure would not be a very good way to do this since the code would have to be modified in order to change the start and stop times. In addition, none of you solutions allow you to start/stop the system on anything other than on the hour. The comparision above and teh In Range comparision both are workable but should be expanded at least allow the start/stop time to include the minutes.
Implemented in the state machine it makes more sense to have states to explicitly check for the start and stop times rather than a single comparison for all of it. The code is a bit more clear with explicit states.
09-20-2012
03:37 PM
- last edited on
05-28-2025
08:00 AM
by
Content Cleaner
ok, ok....im just a padawan! btw, take care of your coercion dots....
09-20-2012 04:44 PM - edited 09-20-2012 04:53 PM
Actually coercion dots aren't always a bad thing. Removing them can actually decrease performance and not actually benefit you. There is generally no harm when the switch is basically between a signed and an unsigned value. Or when coercing a smaller number (U8) to a larger number (I32). As long as you fully understand why the dot is there and know the data types you are switching between you can safely ignore them.