LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

start/stop data acquisition

Solved!
Go to solution

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 😄

0 Kudos
Message 1 of 13
(4,141 Views)

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.

 

Simple State Machine.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 13
(4,135 Views)

@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.

 

Simple State Machine.png


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)

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 13
(4,131 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 13
(4,125 Views)

you can also try this.....forgot to include in the text:  OFF-0000 to 0400?     Smiley Sad

 

START STOP_VI_BD.png

0 Kudos
Message 5 of 13
(4,122 Views)

also?....this _VI_BD.png

0 Kudos
Message 6 of 13
(4,116 Views)

@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

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 13
(4,115 Views)

@apok wrote:

you can also try this.....forgot to include in the text:  OFF-0000 to 0400?     Smiley Sad

 

START STOP_VI_BD.png


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.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 13
(4,078 Views)
Solution
Accepted by topic author U_hend

ok, ok....im just a padawan! btw, take care of your coercion dots....Smiley Wink

start stop_VI.png

0 Kudos
Message 9 of 13
(4,058 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 13
(4,039 Views)