Olympic Timer MPH readout


Closed Thread
Results 1 to 13 of 13
  1. #1
    Macgman2000's Avatar
    Macgman2000 Guest

    Default Olympic Timer MPH readout

    Hello,

    I want to display miles per hour rather than seconds or milliseconds using Melanie's Olympic timer. Has anyone modified the code to do that? I would appreciate any help!

    Best Regards,
    Nick

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


    Did you find this post helpful? Yes | No

    Default

    Kinda vague question...

    If the Start and Stop Buttons are sensors between a known set distance, then all you need is the addition of a bit of math to give you mph.

    If however you're counting pulses from a tacho or other sensor, then that code is probably not suitable.

  3. #3
    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

  4. #4
    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.

  5. #5
    Macgman2000's Avatar
    Macgman2000 Guest


    Did you find this post helpful? Yes | No

    Smile

    Thanks Melanie !!!!

    Best Regards,
    Nick

  6. #6


    Did you find this post helpful? Yes | No

    Talking Olympic Timer

    Hello, You can send I code to me of olympic to timer of melanie to prove it. Thanks

    Leonard





    Quote Originally Posted by Macgman2000
    Hello,

    I want to display miles per hour rather than seconds or milliseconds using Melanie's Olympic timer. Has anyone modified the code to do that? I would appreciate any help!

    Best Regards,
    Nick

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


    Did you find this post helpful? Yes | No

    Default

    Search for 'Olympic Timer' on this forum and you can download it for yourself.

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Hello Melanie,

    Thank you for their answer, I have this code and I want that when it is I number 1 blink, I number 2 blink and I number 3 blink but I cannot make it you can give me some suggestion.

    Thank you

    SYMBOL LED1 = PORTB.0 'PIN 6
    SYMBOL LED2 = PORTB.1 'PIN 7
    SYMBOL LED3 = PORTB.2 'PIN 8



    SYMBOL SW1 = PORTA.0 'PIN 17
    SYMBOL SW2 = PORTA.1 'PIN 18
    SYMBOL SW3 = PORTA.2 'PIN 1



    LOW LED1
    LOW LED2
    LOW LED3

    LOW SW1
    LOW SW2
    LOW SW3

    TRISA = 1 'PUERTO A COMO ENTRADAS
    TRISB = 0 'PUERTO B COMO SALIDAS

    PAUSE 5000 'TIEMPO DE ESPERA PARA ARMAR LA ALARMA




    LOOP:
    IF SW1 = 1 THEN
    PAUSE 3000
    PORTB = %00000110
    ENDif




    IF SW2 = 1 THEN
    PAUSE 6000 'TIMER 10 SEG
    PORTB = %01011011
    ENDIF


    IF SW3 = 1 THEN
    PAUSE 8000
    PORTB = %01001111
    ENDIF
    GOTO LOOP








    Quote Originally Posted by Melanie
    Search for 'Olympic Timer' on this forum and you can download it for yourself.

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


    Did you find this post helpful? Yes | No

    Default

    Your question isn't exactly anything to do with the topic being discussed here Leonardo. Please post in the appropriate section adding which compiler you are using PBP or PBC and what PIC you are programming for.

  10. #10


    Did you find this post helpful? Yes | No

    Default Upss

    Thank you, but then which is the section to ask the question, my compiler is PBP and the pic it is PIC16F628.

    Thank you




    Quote Originally Posted by Melanie
    Your question isn't exactly anything to do with the topic being discussed here Leonardo. Please post in the appropriate section adding which compiler you are using PBP or PBC and what PIC you are programming for.

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


    Did you find this post helpful? Yes | No

    Default

    If you are using PBP, then I question why you are using PBC instructions like 'SYMBOL'?

    I have absolutely no idea what you are trying to achieve, but the code below will at least do something... whether it is what you want is another matter.
    Code:
    	LED1 var PORTB.0 'PIN 6
    	LED2 var PORTB.1 'PIN 7
    	LED3 var PORTB.2 'PIN 8
    
    	SW1 var PORTA.0 'PIN 17
    	SW2 var PORTA.1 'PIN 18
    	SW3 var PORTA.2 'PIN 1
    
    	TRISA=%00000111
    	TRISB=0
    	CMCON=%00000111
    
    	LOW LED1
    	LOW LED2
    	LOW LED3
    
    	PAUSE 5000 'TIEMPO DE ESPERA PARA ARMAR LA ALARMA
    
    LOOP:
    	IF SW1 = 1 THEN
    		PORTB = %00000110
    		Pause 3000
    		ENDif
    
    	IF SW2 = 1 THEN
    		PORTB = %01011011
    		Pause 6000
    		ENDIF
    
    	IF SW3 = 1 THEN
    		PORTB = %01001111
    		Pause 8000
    		ENDIF
    
    	PORTB=0
    	GOTO LOOP
    	END
    I don't know how you have your switches connected, but you should ensure the PIC pins on PORTA are not left floating at any time.

    Next time, if it is PBP you are using, post your question in the Mel PICBASIC Pro category as a New Thread.

  12. #12


    Did you find this post helpful? Yes | No

    Talking Upsss

    Hello, I feel much to bother Mellanie but until now I am learning to use the PBP and I need to make these questions to be everything an expert in PBP as you are it.

    What attempt is the following thing:
    When sw1 is on to timer by 3 seg digit to number 1
    When sw2 is on to timer by 6 seg digit to number 2
    When sw3 is on to timer by 8 seg digit to number 3

    If when igniting pic is other pin in 0 then shows it immediately according to his I number, but if all sw1, sw2, sw3 are 0 they are in delay to timer. Also I want that when anyone of the digit ignites this seg does blink 1.

    Thanks again

    Code is:
    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2005 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 16/08/05 *
    '* Version : 1.0 *
    '* Notes :FOR PIC16F628, *
    '* : USE PBP *
    '************************************************* ***************

    SYMBOL LED1 = PORTB.0 'PIN 6
    SYMBOL LED2 = PORTB.1 'PIN 7
    SYMBOL LED3 = PORTB.2 'PIN 8
    SYMBOL LED4 = PORTB.4 'PIN 9

    SYMBOL SW1 = PORTA.0 'PIN 17
    SYMBOL SW2 = PORTA.1 'PIN 18
    SYMBOL SW3 = PORTA.2 'PIN 1

    LOW LED1
    LOW LED2
    LOW LED3

    LOW SW1
    LOW SW2
    LOW SW3

    TRISA = 1 'PUERTO A COMO ENTRADAS
    TRISB = 0 'PUERTO B COMO SALIDAS

    LOOP0:
    IF SW1 = 0 AND SW2 = 0 AND SW3 = 0 THEN LOOP
    IF SW1 = 1 AND SW2 = 0 AND SW3 = 0 THEN LOOP1
    IF SW1 = 1 AND SW2 = 1 AND SW3 = 0 THEN LOOP2
    IF SW1 = 1 AND SW2 = 1 AND SW3 = 1 THEN LOOP3


    LOOP:
    IF SW1 = 1 THEN
    PAUSE 3000
    PORTB = %00000110 'DIGIT NUMBER 1
    ENDif

    IF SW2 = 1 THEN
    PAUSE 6000 'TIMER 10 SEG
    PORTB = %01011011 'DIGIT NUMBER 2
    ENDIF

    IF SW3 = 1 THEN
    PAUSE 8000
    PORTB = %01001111 DIGIT NUMBER 3
    ENDIF

    GOTO LOOP

    LOOP1:

    PORTB = %00000110 ' DIGIT NUMBER 1
    GOTO LOOP1

    LOOP2:
    PORTB = %01011011 'DIGIT NUMBER 2
    goto LOOP2

    LOOP3:
    PORTB = %01001111 'DIGIT NUMBER 3
    GOTO LOOP3


    GOTO LOOP0

















    Quote Originally Posted by Melanie
    If you are using PBP, then I question why you are using PBC instructions like 'SYMBOL'?

    I have absolutely no idea what you are trying to achieve, but the code below will at least do something... whether it is what you want is another matter.
    Code:
    	LED1 var PORTB.0 'PIN 6
    	LED2 var PORTB.1 'PIN 7
    	LED3 var PORTB.2 'PIN 8
    
    	SW1 var PORTA.0 'PIN 17
    	SW2 var PORTA.1 'PIN 18
    	SW3 var PORTA.2 'PIN 1
    
    	TRISA=%00000111
    	TRISB=0
    	CMCON=%00000111
    
    	LOW LED1
    	LOW LED2
    	LOW LED3
    
    	PAUSE 5000 'TIEMPO DE ESPERA PARA ARMAR LA ALARMA
    
    LOOP:
    	IF SW1 = 1 THEN
    		PORTB = %00000110
    		Pause 3000
    		ENDif
    
    	IF SW2 = 1 THEN
    		PORTB = %01011011
    		Pause 6000
    		ENDIF
    
    	IF SW3 = 1 THEN
    		PORTB = %01001111
    		Pause 8000
    		ENDIF
    
    	PORTB=0
    	GOTO LOOP
    	END
    I don't know how you have your switches connected, but you should ensure the PIC pins on PORTA are not left floating at any time.

    Next time, if it is PBP you are using, post your question in the Mel PICBASIC Pro category as a New Thread.

  13. #13
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Leonardo
    Hello, I feel much to bother Mellanie but until now I am learning to use the PBP and I need to make these questions to be everything an expert in PBP as you are it.
    Leonardo,

    first of all you should make yourself familiar with the "Forum Rules"

    Melanie has already asked you twice to start a new thread in an appropriate category.

    Please see: THIS
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



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 : 1

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