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
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
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.
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
This is the current Display Code...
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 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.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
Hello, You can send I code to me of olympic to timer of melanie to prove it. Thanks
Leonard
Originally Posted by Macgman2000
Search for 'Olympic Timer' on this forum and you can download it for yourself.
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
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.
Thank you, but then which is the section to ask the question, my compiler is PBP and the pic it is PIC16F628.
Thank you
Originally Posted by Melanie
Bookmarks