Setting up a stop watch

Hi, could somebody please help me with setting up a stopwatch in my program to count time? I've attached my VI and it includes my attempt at trying to set up a stopwatch. The problem is that it is counting but my program doesn't seem to stop and data is aqcuired when the VI is run once. SO I'm not getting continuous data acquisition. Also, I can't seem to stop the program. I have to abort it. I would really appreciate anyone's help on this.
Thanks
Attachments:
single channel, CV, amp v8.vi ‏875 KB

Hello,
thank you for your suggestions. I have made the changes and tidied up my block diagram. The stop watch works now but the only issue now is that the interface just displays the results the first time round the data is acquired i.e. when the Vi is run the first time round. The reason why I had put everything in a loop was because everytime  a new set of data was acquired, the interface would display the results and save all the data that is  acquired not only the first set.. Now, I can only save and display the first set of data. Any suggestions to this issue wil be appreciated. I've attached the modified Vi.
Thanks
Attachments:
single channel, CV, amp v9.vi ‏873 KB

Similar Messages

  • Problems with a simple stop watch program

    I would appreciate help sorting out a problem with a simple stop watch program. The problem is that it throws up inappropriate values. For example, the first time I ran it today it showed the best time at 19 seconds before the actual time had reached 2 seconds. I restarted the program and it ran correctly until about the thirtieth time I started it again when it was going okay until the display suddenly changed to something like '-50:31:30:50-'. I don't have screenshot because I had twenty thirteen year olds suddenly yelling at me that it was wrong. I clicked 'Stop' and then 'Start' again and it ran correctly.
    I have posted the whole code (minus the GUI section) because I want you to see that the program is very, very simple. I can't see where it could go wrong. I would appreciate any hints.
    public class StopWatch extends javax.swing.JFrame implements Runnable {
        int startTime, stopTime, totalTime, bestTime;
        private volatile Thread myThread = null;
        /** Creates new form StopWatch */
        public StopWatch() {
         startTime = 0;
         stopTime = 0;
         totalTime = 0;
         bestTime = 0;
         initComponents();
        public void run() {
         Thread thisThread = Thread.currentThread();
         while(myThread == thisThread) {
             try {
              Thread.sleep(100);
              getEnd();
             } catch (InterruptedException e) {}
        public void start() {
         if(myThread == null) {
             myThread = new Thread(this);
             myThread.start();
        public void getStart() {
         Calendar now = Calendar.getInstance();
         startTime = (now.get(Calendar.MINUTE) * 60) + now.get(Calendar.SECOND);
        public void getEnd() {
         Calendar now1 = Calendar.getInstance();
         stopTime = (now1.get(Calendar.MINUTE) * 60) + now1.get(Calendar.SECOND);
         totalTime = stopTime - startTime;
         setLabel();
         if(bestTime < totalTime) bestTime = totalTime;
        public void setLabel() {
         if((totalTime % 60) < 10) {
             jLabel1.setText(""+totalTime/60+ ":0"+(totalTime % 60));
         } else {
             jLabel1.setText(""+totalTime/60 + ":"+(totalTime % 60));
         if((bestTime % 60) < 10) {
             jLabel3.setText(""+bestTime/60+ ":0"+(bestTime % 60));
         } else {
             jLabel3.setText(""+bestTime/60 + ":"+(bestTime % 60));
        private void ButtonClicked(java.awt.event.ActionEvent evt) {                              
         JButton temp = (JButton) evt.getSource();
         if(temp.equals(jButton1)) {
             start();
             getStart();
         if(temp.equals(jButton2)) {
             getEnd();
             myThread = null;
         * @param args the command line arguments
        public static void main(String args[]) {
         java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
              new StopWatch().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JPanel jPanel1;
        // End of variables declaration                  
    }

    Although I appreciate this information, it still doesn't actually solve the problem. I can't see an error in the logic (or the code). The fact that the formatting works most of the time suggests that the problem does not lie there. As well, I use the same basic code for other time related displays e.g. countdown timers where the user sets a maximum time and the computer stops when zero is reached. I haven't had an error is these programs.
    For me, it is such a simple program and the room for errors seem small. I am guessing that I have misunderstood something about dates, but I obviously don't know.
    Again, thank you for taking the time to look at the problem and post a reply.

  • N95, where is the stop watch gone?

    I am missing a very usefull utility I have been useng ever since Nokia phones, it is the stop watch with rounds, spiltts etc...
    is there an extra aplication arround?

    There are a few, Handy Alarm I think is one, but when I looked it was like 20 bucks, which I think is way to expensive for what it is.
    A cheaper - but so far as I can tell - equally good option is The Time Machine:
    http://www.handango.com/PlatformProductDetail.jsp?siteId=1&jid=163CAFF2XC172B589EC6A675C43EB9CA&plat...
    It's only $5. I downloaded the 10 day trial yesterday and so far it seems pretty good with a pretty decent feature set.
    I had to fiddle about a bit to get the sounds working - there are instructions on the Description page at the above URL - but otherwise it works very well.
    Support seems pretty good too: being a fella, I hadn't read the instructions so I actually e-mailed the developer about my sound issue and got a response back the same day.

  • Add Stop Watch in Form using LiveCycle Designer

    Hi,
    How can I add a stop watch into a Form created with Adobe Live Cycle Designer 8.0?
    Basically I'd like the following:
    I am creating a read-out form for a radiologic study. So the reader should be able to push a button on the very beginning of the form which should trigger a stopwatch to start. At the very end of the form, there should be a 2nd button which the reader can push when he's finished reading and filling out the form to stop the stop watch which was running in the background. The resulting time should then be displayed and saved in a field for export to Excel later on. Is this possible using JavaScript?
    If this doesn't work, alternatively there could be a button to push in the beginning of the form which would put the actual Date/Time in a Field and at the bottom of the Form a second button which would again show the actual date/time in a field. This way I would export the two fields into Excel and then let Excel calculate the needed time to fill out the form.
    When I add a Date/Time Field, it updates, whenever someone makes a change to the form.
    Thank you for your help,
    Olivio Donati

    There is no stop watch per se.... but your technique of getting the time should work here. On the click event of the Start button you will need to record the time in a hidden field (so you can get at it later). On the Finish button you can record the time again and then get the difference between the stop and start time. FormCalc has some built in functions that will change a given time to the number of milliseconds that have elapsed from a specific epoch. You will need this to do the time calc.

  • I listen to a lot of live performances (house sets that are from 1 hour to 3 hours long) when I start to listen to a set and then stop to do something else on the iPhone when I go back to start to listen to the track it has started from the beginning.

    I listen to a lot of live performances (house sets that are from 1 hour to 3 hours long) when I start to listen to a set and then stop to do something else on the iPhone when I go back to start to listen to the track it has started from the beginning.

    It sounds like either your hard drive or the SATA cable that connects it to the motherboard are failing. This could be heat related in your case, which is why you see it after it runs awhile. You can take it to the Genius Bar for a free evaluation. If you decide to test it yourself, I usually suggest moving the hard drive to an external enclosure. If it works there for awhile, the cable is probably the issue.
    http://www.amazon.com/Sabrent-2-5-Inch-Aluminum-Enclosure-EC-TB4P/dp/B005EIGUD4/ ref=sr_1_3?ie=UTF8&qid=1397647657&sr=8-3&keywords=2.5+enclosure
    http://www.ifixit.com/Device/MacBook_Pro_13%22_Unibody_Mid_2009

  • LiveCycle form stop watch

    Is it possible to create a stop watch that the form user can start and stop as many times as needed. When finished, the total time recorded by the stop watch would be displayed.
    Example:
    User starts the stop watch at 08:08:00 stop watch displays 00:00:00
    User stops the stop watch at 08:45:10 stop watch displays 00:37:10
    User starts the stop watch at 09:15:00 stop watch displays 00:37:10 (when started but shows time accumulating)
    User stops the stop watch at 09:30:25 stop watch displays 00:52:35
    Total time recorded is displayed 00:52:35
    If someone has an example form, I would appreciate your help. I have seen a stop watch in an Acrobat form but do not know how to convert it to LiveCycle.

    I understand how to get the current time and the time when the clock is stopped. I also understand how to subtract the numbers and then convert them back to time. I have never used variables. I know where they go and how to create them but do not know how to use them in a script. Is there any chance to could create an example? I need to be able to start and stop the clock several times and end up with the total time recorded.
    Does anyone have an example LiveCycle form with a stop watch? Am I the only one who has ever needed this?

  • [svn:fx-trunk] 12909: Pre-FP10.1, set default tab stops in TLF.

    Revision: 12909
    Revision: 12909
    Author:   [email protected]
    Date:     2009-12-14 10:33:13 -0800 (Mon, 14 Dec 2009)
    Log Message:
    Pre-FP10.1, set default tab stops in TLF.  Without this, if there is a tab and TLF is measuring width, the tab will measure as the rest of the remaining width up to 10000.
    QE notes:
    Doc notes:
    Bugs: SDK-24589
    Reviewer:
    Tests run: checkintests
    Is noteworthy for integration: yes
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24589
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as

    SpryAccordion.css
    You have an error that is killing the rest of your code shown below in red.  Remove it.
    .AccordionPanelContent {
        margin: 0px;
        padding: 2px; /**suggest using 12px or more**/
        background-image: url(../infobkgd.png);
        background-attachment: fixed;
        background-repeat: repeat;
        font-family: Verdana, Geneva, sans-serif;
        font-size: 12px;  /**suggest using 16px or more**/
        color: #FFF;
        overflow: hidden;
        height: 40
    [x;
        height: 100%;
    Nancy O.

  • Completely new to lab view and need to get some stop watch help please

    OK I am new to lab view so please be patient with me. I have a need for a stop watch that is triggered to start when two voltage values differ by more than 0.110V and then stop counting when they return to within 0.110v my goal is to capture the total amount of time the two voltages differ and record it along with the rest of the data is this possible and how would I do it? Thanks I am running 8.5

    danger831 wrote:
    thanks for the quick response but thats not really enough info to help me as I am very very unfamiliar with lab view and have only been using it for a few days(mainly just plugging in copied sections) so hopefully someone can give me a little more help. But the good news is I am now looking into taking one of the Lab view courses but that probably won't help me with this problem this week. thanks again for your help
    For starters, try to write the name correctly. It is LabVIEW, not lab view.
    Seriously though, your best way of learning to is try some things yourself first. Look through the examples that ship with LabVIEW for the components Raven suggested (while loops, shift registers, etc.) We could give you a working example but you will learn far more by trying things for yourself. As suggested, try a few things and then post what you have done and what you are having trouble with. From there we can answer your questions rather than just do it for you.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Lost trying to create a stop watch

    I'm attempting the use the timer class to create a plain stop
    watch that counts down from 10 mins.
    I can't seem to find any tutorials for AS3. Can someone
    provide a link?
    Thanks for your assistance.

    peggy818 wrote:
    … I'm lost and I'm just starting.  Not sure I like the new version.  …
    have a read in the Manual:
    http://help.apple.com/imovie/mac/10.0/?lang=en#mov755717b21

  • N97 no stop watch or count down timer?

    There are some basic functions you expect on every phone, not least on the flag ship of Nokia. I havn't had a nokia for a while but my last one had both timer and stop watch, I was really surprised to find these functions were missing and that you have to pay for third party apps to get these functions.
    There are several threads on this forum about these apps missing from other S60 models. Are there any plans on releasing these apps or do I need to get the freeking egg timer? 

    Thanks for that, great app! Simple and functional.
    It has a bug in it though. When the counter gets down to 5 sec or so, the time changes to 9.59.59. It happened twice the first two minutes I tested the app but I haven't been able to reproduce it now for a while now. Hope it doesn't happen when the cake is in the oven
    Still, even though s60 never had these apps, I can't see why they couldn't just start providing providing them. Unless they want 3rd party application programmers to have a really simple app to start with and make some chash to keep them going for more advanced apps. 
    Message Edited by sidan77 on 15-Jul-2009 09:51 PM

  • Oh no! Not another stop watch question?!​?!?!

    Hi
    This question corresponds to the thread
    http://forums.ni.com/t5/LabVIEW/Stopwatch-without-​pausing-the-program/m-p/828959
    The stopwatch.vi cannot be used as a subVI.
    How do I get over this issue?
    I essentially want to keep the start/stop boolean control as/is as well as the reset boolean along with the "STOP WATCH" numeric indicator.
    Any feedback is greatly appreciated oh Knights of LabVIEW!
    A student intern cries out desperately for help!
    Attachments:
    Stopwatch[3].vi ‏34 KB

    Hi tbob thank you again for your reply
    Please refer to the attatched VI.
    I am trying to build a VI that will monitor the "ageing" of "lamps" in hours. There are two banks A and B, each having 6 Modules, each having 8 lamps each, for a total of 2 * 6 * 8 = 96 lamps.
    I essentially want to monitor the ageing of every single lamp. Which is why I believe using arrays would be an efficient way.
    Each module will go through a period of ON/OFF power cycles. All the while accumalating the total hours that the lamp was ON. During this time a lamp can fault (much like a fused bulb) and hence the timer will stop.
    The total time that the lamp in ON will be recorded and saved on an external file in the hardisk, so even if the LabVIEW program crashes, the data will not be lost. I should also be able to manipulate the external file in case I want to add/remove hours from that lamp.
    I hope this clarifies my purpose.
    Attachments:
    testing whole string.vi ‏46 KB
    Lamp Ballast Array subvi.vi ‏12 KB
    array of time.vi ‏12 KB

  • Can i set up the apple watch without an iphone

    Im looking to buy an apple watch but i dont have an iphone. I was wondering if i can set up my apple watch and use the basic features such as the watch face without it

    You must have an iPhone to use the apple watch, or at least set it up. After the setup, without the iPhone it can only do limited features

  • While erasing contact and setting my phone stop working showing round waiting circle and its not geting switched off also

    while erasing contact and setting my phone stop working showing round waiting circle and its not geting switched off also

    Try a Reset...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    If no joy...
    Connect to iTunes on the computer you usually Sync with and “ Restore “...
    http://support.apple.com/kb/HT1414
    If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/HT1808
    Note on Recovery Mode.
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    Once you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup
    http://support.apple.com/kb/ht1766

  • System stop watch accuracy

    Hi,
    I'm developing a stop watch on iOS. The elapsed time is calculated based on the system clock. I found that there is an inaccuracy of about 2sec per day compared to the mac system time. Mac system time should be correct as it it synced automatically. I also tested the integrated stop watch on iPhone and it also runs faster than the mac system clock.
    1. is this a bug?
    2. any ideas how to get better accuracy for stop watch?
    Thanks,
    Jonathan

    Hi,
    I'm developing a stop watch on iOS. The elapsed time is calculated based on the system clock. I found that there is an inaccuracy of about 2sec per day compared to the mac system time. Mac system time should be correct as it it synced automatically. I also tested the integrated stop watch on iPhone and it also runs faster than the mac system clock.
    1. is this a bug?
    2. any ideas how to get better accuracy for stop watch?
    Thanks,
    Jonathan

  • Stop watch function in N79

    I fail to find stop watch function in N79. Do I need to install it? If yes, how and from where? Please help. Thanks.
    Solved!
    Go to Solution.

    Many thanks for your help. I use the stopwatch and countdown timer at at work and also sometimes when Cooking!
    Does anybody know why Nokia decided to not include this feature? I would have thought this is now become a basic feature of a Mobile. I also used to use it to time xtra time when watching my team, Bury FC. I have bought a timer from the Ovi store but its not very good and seems to use a lot of battery power. I'm sure if Nokia design and create a timer and stopwatch it would be as good as in previous mobiles, being more integrated into the phone. Just my thoughts on what is otherwise a very good phone.

Maybe you are looking for

  • Media out or not loaded correctly when attempting to print since iOS 7 upgrade?

    Since ios7 upgrade my mini gives me "media out or not loaded correctly" when attempting tp print to Epson r2400. Apple support directed me through a new setup. It worked for a few days and on it's own reverted back to the original problem.

  • Intensity Pro to Flash Audio Problems

    Hi, I'm attempting to pull live video from the Blackmagic Intensity pro. I can generally pull video content (using component cables NOT hdmi in this case), but audio is a problem. It appears that the board is defaulting to 48kHz audio, which is confl

  • ETM: Customer Internal Settlement

    Hi every body, How I can create a correct "Customer Internal Settlement"? I want to create a recipient in /vd01 but this Error appear: Customer # is not a sold-to party this error is related to Cust.int.settl field what are the correct "reference typ

  • J2EE at Os level...

    Hello, How can I make sure that J2EE is running? It is regarding ABAP+J2EE for BW 3.5 NW04. I went to SMICM - Services and it will show the list of HTTP ports and there status. How will I be sure that J2EE is active. Because J2EE will be down but the

  • Embed java applet in web dynpro

    Hi experts, is it possible to embed a java applet into a web Dynpro application. Or have I to use a jsp / Servlet / AbstractPortalApplication / (JSP)Dynpage Regards Fllo