Olympic Timer MPH readout


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Macgman2000's Avatar
    Macgman2000 Guest


    Did you find this post helpful? Yes | No

    Question

    Hello Melanie,

    I guess the question would be, where in your Olympic timer code can I add the math to calculate the speed d/t=s. Since it will be over a 10 foot distance I would want to use the hundredths of seconds variable you have in the code. I am expecting no slower than 5mph and no faster than 30mph.

    Best Regards,
    Nick

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    This is the current Display Code...
    Code:
    DisplayLoop:
    	If ButStart=0 then RunningFlag=1
    	If ButStop=0 then RunningFlag=0
    	LCDOut $FE,$80,DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds,".",DEC2 Hundredths
    	If OverflowError=1 then
    		If Seconds.0=1 then
    			LCDOut $FE,$8C,"ERR"
    			else
    			LCDOut $FE,$8C,"   "
    			endif
    		endif
    	If RunningFlag=1 then goto DisplayLoop
    	If ButReset=1 then goto DisplayLoop
    	Disable
    You could completely rehash it, or simply tack-on the math and display like so (assuming a 2-lince LCD screen)...
    Code:
    DisplayLoop:
    	If ButStart=0 then RunningFlag=1
    	If ButStop=0 then RunningFlag=0
    	LCDOut $FE,$80,DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds,".",DEC2 Hundredths
    	If OverflowError=1 then
    		If Seconds.0=1 then
    			LCDOut $FE,$8C,"ERR"
    			else
    			LCDOut $FE,$8C,"   "
    			endif
    		endif
    	If RunningFlag=1 then goto DisplayLoop
    
    	' *** perform math here - assume resultant variable mph is in tenths of mile/hour
    
    	LCDOut $FE,$C0,#mph DIG 2,#mph DIG 1,".",#mph DIG 0," mph  "
    	If ButReset=1 then goto DisplayLoop
    	Disable
    that way you get the elapsed Time ticking, with the mph only being displayed (to one decimal place per my above example) after the clock has stopped.

  3. #3
    Macgman2000's Avatar
    Macgman2000 Guest


    Did you find this post helpful? Yes | No

    Smile

    Thanks Melanie !!!!

    Best Regards,
    Nick

Similar Threads

  1. Olympic Timer
    By Melanie in forum Code Examples
    Replies: 47
    Last Post: - 17th September 2008, 19:46
  2. About olympic timer..
    By Eng4444 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th June 2006, 09:16
  3. Melanie's Olympic Timer
    By nedtron in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th January 2006, 14:41
  4. Help with scroll text in Melanie Olympic Timer
    By jorge in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th November 2004, 14:52
  5. Melanie Olympic Timer -> Banner....scroll text...
    By jorge in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th November 2004, 22:11

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts