LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time delay and button reset

Hi,

 

I am a labview 7.1 user and I am trying to do some analog input and digital output operation with an usb6009. I have generate the following program so far (see the picture file). With this program, I am able to generate a digital ouput (5V) when I press the "start" button and back to 0 V when i press it again. i can also read a analog voltage input continuously and the data will be saved when I press "collect data 2". The recording with stop if I press "collect data 2" again, or if I press "stop".

 

What I want to implement are the following:

1. I want to combine the function of the buttons "start" and "collect data 2" with a time delay. To be specific, I want to click "collect data 2" and the program will start to record the data. Then, 2 seconds later, the digital output will be changed from 0V to 5V. 

2. When the user press "collect data 2" again, it will stop the recording and the digital output will be changed back to 0V at the same time. If the user pressed stop instead, I want the "collect data 2" button to be reset to the original value (which is set to "switch when pressed).

 

Can someone offers some advices to me on how to accomplish these 2 tasks? What functions/commands can I use (for the time delay between events and reseting the value of the button)?

 

Thanks in advance,

 

Cheers,

 

Anson

Download All
0 Kudos
Message 1 of 2
(2,348 Views)

Anson,

 

I would recommend looking into using a State Machine within LabVIEW. This type of design pattern will allow you to perform the actions that you desire with your program. You can find documentation on State Machines here.  You could also use event structures in combination with the state machine but it may not be necessary depending on how you write your code. Let me know if you have any questions regarding State Machines.  In your state machine you could check and see if one of your inputs is selected then once the input is selected you could use the state machine to perform the tasks that you need. Hope this gives you some guidance into how you can begin to program your application. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 2 of 2
(2,308 Views)