From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Record Button timing

Solved!
Go to solution

I am trying to incorporate a "record" button that when pressed, will save data from my USB-6009 to a spreadsheet. I have two voltage inputs, and I want my spreadsheet to have their values vs. time. The following is the VI I came up with after looking at some suggetsions on this forum, but it doesn't behave quite right:

  • The VI seems to only update every second (so if I hit the button, a second later the light comes on, and my waveform graph only updates once a second)
  • When I hit record, it saves my Excel file, but the time isn't right. Sometimes it will save data from 0-2 seconds (which is my default), but then there will be other stuff in that excel file from 6-9 seconds, or just 13 seconds, etc. And the "save to spreadsheet" is set up so it saves as a new file upon each activation (so I know those extra times aren't from that). 
  • I am using Labview 10 on windows XP. 

If anyone has any suggestions on how I could improve this, that would be great!

Thanks

Download All
0 Kudos
Message 1 of 4
(2,858 Views)
Solution
Accepted by topic author auditt241

@auditt241 wrote:
  • The VI seems to only update every second (so if I hit the button, a second later the light comes on, and my waveform graph only updates once a second)

You have your DAQmx task to read 100 samples at a rate of 100S/s.  It will therefore take 1 second to read the data from the DAQ Assistant.  That is what is limiting your loop rate.

 

You do not need those two inner loops.  Put the shift register on the outter loop and initialize it to FALSE.  This will also eliminate the need for your First Call and Select.

 

I also recommend you use an actual Stop button instead of the one created from the DAQ Assistant.

 

Here is a quick cleanup of your code.  See if this helps any.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,802 Views)

This looks great, thank you! One thing I am not sure about - can you expand the Elapsed time VI? I am not sure how things connect. I tried wiring everything up, but when I hit "record", it doesn't stay recording. 

 

0 Kudos
Message 3 of 4
(2,750 Views)

An update: In case anybody else has the same problem as me: This works perfectly, you just need to connect "Set Time" to "Time Target" and you need to connect the input from the TF button into "Reset". The "time has elapsed" output from the VI goes into the Boolean "Not".

0 Kudos
Message 4 of 4
(2,720 Views)