-->
Stopwatch program help
-->
-->
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
-->
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
Stopwatch program help
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Stopwatch program help (Read 3304 times)
0 Members and 1 Guest are viewing this topic.
dinhotheone
LV6
Super Member (Next: 500)
Posts: 410
Rating: +2/-1
Stopwatch program help
«
on:
January 05, 2007, 10:55:00 am »
I have a problem, my science teacher wanted me to create a stopwatch prgram on the ti 84. This has proven far more difficult than i initially expected. i have tried aaround 6 methods and only one has been any good. the only problem is that it doesnt work for timing's less than one secong. ill explain my code.
BTW if you only know how to prgm on 83-83+SE the functions in the program you dont know are....
Starttimer - returns the value of the clock the calculator is on. This number is usually really big,
Checktimer(variable) - when you store the starttimer value to a variable and put it into the checktimer, this returns the amount of time that has
elapsed.
Thats it
Here is some pseudo code-ish stuff of my code becuase i know of no other way to display code.
Starttimer STO B
Repeat untill the time changes from B
End
"this is to ensure that i start calibration at the start of the second and not in the middle"
Repeat untill 3 seconds have passed
A+1 STO A
end
A/2 STO A
"that was calibration ^"
pause
starttimer STO B
repeat untill the time changes from B
C+1 STO C
end
"this records the time it takes before the first second is hit, to make up for starting timer with fraction a second gone by in timer"
repeat ans
getkey
end
checktimer(B ) - 1 STO S
repeat untill time changes from S
D+1 STO D
end
A-D STO D
"this is to check how many fractions of a second passed after the last full second"
From here i add D and C and divide that by A and then add that to S and get the total number of seconds. The Reason the program doesnt work for fractions of a second is because the timer on the calc is always going so when i press endter after the pause, it checks to see how much time goes by before the first second change. if the person tries to stop the time here it wont react, if i input some getkey stopping in here then the speed in the calibration and the timing loops will differ, if i add getkey to both then i have to add it to the third iteration counter and make each iteration slower making the prog more imprecise.
So, can anyone help? I hope i didnt confuse you ... I hope i didnt miss something obvious. Also if anyone knows of a way to Start the timer so that i will not have to deal with fractions of a second except at the termination of the program... that would do.
Logged
misirlou
Guest
Stopwatch program help
«
Reply #1 on:
January 05, 2007, 05:05:00 pm »
Instead of using the clock commands on the calc, try using a for loop instead.
->X
->K
repeat K=22
For(T,1,*number you need to get one hundreth of a second*
End
X+.01->X
Output(1,1,X
getkey->K
End
With this it stops when you press 2nd. The only problem with this is itll be really tough to time it right. I would plug in numbers and try to get it accurate to ten seconds, then to a minute, and so on depending on how accurate you want it to be. I actually think this is probably too long to take a hundreth of a second even without the for loop. Idk maybe if you did tenths of a second it would work.
Logged
dinhotheone
LV6
Super Member (Next: 500)
Posts: 410
Rating: +2/-1
Stopwatch program help
«
Reply #2 on:
January 15, 2007, 10:23:00 am »
ya, i figured it out, i changed alot of stuff and set the calibration for like 4 seconds, instead of 1 or 2. The problem misirlou, is that i need to calibrate the program each time it is executed and i don't know how to do it for that code.
Logged
elfprince13
Guest
Stopwatch program help
«
Reply #3 on:
January 15, 2007, 11:01:00 am »
no, do not use the calibrated for loop, thats horrid
c1-->
CODE
ec1
Disp "Press 2nd to start"
Repeat getKey=21
End
checkTimer->T
Disp "press 2nd to stop"
Repeat getKey=21
End
Disp checkTimer(T
c2
ec2
Logged
dinhotheone
LV6
Super Member (Next: 500)
Posts: 410
Rating: +2/-1
Stopwatch program help
«
Reply #4 on:
January 16, 2007, 01:30:00 pm »
i need it to keep track of up more than just seconds though, and if im not sorely mistaken, the timer only keeps track of whole seconds, not hundredths or even tenths. also this is for use in a physics classroom so it will be timing multiple times per program execution, it only calibrates at the start the program, not at each timing.
Logged
elfprince13
Guest
Stopwatch program help
«
Reply #5 on:
January 16, 2007, 03:58:00 pm »
well, if you want less than a second, learn asm.
Logged
necro
LV9
Veteran (Next: 1337)
Posts: 1295
Rating: +17/-2
+3 vaporal mustache
Stopwatch program help
«
Reply #6 on:
January 16, 2007, 05:46:00 pm »
QuoteBegin-misirlou+6 Jan, 2007, 4:05-->
QUOTE
(misirlou @ 6 Jan, 2007, 4:05)
Instead of using the clock commands on the calc, try using a for loop instead.
->X
->K
repeat K=22
For(T,1,*number you need to get one hundreth of a second*
End
X+.01->X
Output(1,1,X
getkey->K
End
With this it stops when you press 2nd. The only problem with this is itll be really tough to time it right. I would plug in numbers and try to get it accurate to ten seconds, then to a minute, and so on depending on how accurate you want it to be. I actually think this is probably too long to take a hundreth of a second even without the for loop. Idk maybe if you did tenths of a second it would work.
problem is, that would vary with the battery power Id think
i don't have an 84 so I am unsure how the clock drystal functions work but look at your manual to see if there are any ways to make a smaller interval (assuming it comes with one)
Logged
I'm like a woot burger with awesome fries
VB.Net, C#, C++, Java, Game Maker
elfprince13
Guest
Stopwatch program help
«
Reply #7 on:
January 16, 2007, 07:20:00 pm »
QuoteBegin-necro+16 Jan, 2007, 23:46-->
QUOTE
(necro @ 16 Jan, 2007, 23:46)
QuoteBegin-misirlou+6 Jan, 2007, 4:05-->
QUOTE
(misirlou @ 6 Jan, 2007, 4:05)
Instead of using the clock commands on the calc, try using a for loop instead.
->X
->K
repeat K=22
For(T,1,*number you need to get one hundreth of a second*
End
X+.01->X
Output(1,1,X
getkey->K
End
With this it stops when you press 2nd. The only problem with this is itll be really tough to time it right. I would plug in numbers and try to get it accurate to ten seconds, then to a minute, and so on depending on how accurate you want it to be. I actually think this is probably too long to take a hundreth of a second even without the for loop. Idk maybe if you did tenths of a second it would work.
problem is, that would vary with the battery power Id think
i don't have an 84 so I am unsure how the clock drystal functions work but look at your manual to see if there are any ways to make a smaller interval (assuming it comes with one)
the 84 manual is s***ty, and there is no way to use Basic to get more accurate than a second with the built in clock functions. however I believe the clock does tick more frequently than that so I would write one in assembly, and use that.
Logged
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
Stopwatch program help
«
Reply #8 on:
January 17, 2007, 03:08:00 am »
it is very hard in basic to have accurate clock,even with for loops, especially if there is lot of functions in the main loop
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
Stopwatch program help
\n\t\t\t\t\t\t\t\t\t
<' + '/div>\n\t\t\t\t\t\t\t\t\t
%body%<' + '/textarea>
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
Max characters: 20000; characters remaining:
...<' + '/span><' + '/span>
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t<' + '/div>\n\t\t\t\t\t\t\t\t<' + '/div>', sTemplateSubjectEdit: '
', sTemplateBodyNormal: '%body%', sTemplateSubjectNormal: '
%subject%<' + '/a>', sTemplateTopSubject: 'Topic: %subject% (Read 3304 times)', sErrorBorderStyle: '1px solid red' }); aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "display_jump_to", sJumpToTemplate: "
Jump to:<" + "/label> %dropdown_list%", iCurBoardId: 70, iCurBoardChildLevel: 1, sCurBoardName: "TI-BASIC", sBoardChildLevelIndicator: "==", sBoardPrefix: "=> ", sCatSeparator: "-----------------------------", sCatPrefix: "", sGoButtonLabel: "go" }); aIconLists[aIconLists.length] = new IconList({ sBackReference: "aIconLists[" + aIconLists.length + "]", sIconIdPrefix: "msg_icon_", sScriptUrl: smf_scripturl, bShowModify: true, iBoardId: 70, iTopicId: 1878, sSessionId: "c34694c94e3911c2e716beed3c9507d6", sSessionVar: "f34423e", sLabelIconList: "Message Icon", sBoxBackground: "transparent", sBoxBackgroundHover: "#ffffff", iBoxBorderWidthHover: 1, sBoxBorderColorHover: "#adadad" , sContainerBackground: "#ffffff", sContainerBorder: "1px solid #adadad", sItemBorder: "1px solid #ffffff", sItemBorderHover: "1px dotted gray", sItemBackground: "transparent", sItemBackgroundHover: "#e0e0f0" }); } function tick2() { if (typeof(document.forms.quickModForm) != "undefined") { calcCharLeft2(); setTimeout("tick2()", 1000); } else setTimeout("tick2()", 800); } function message_onkeyup() { if (typeof(document.forms.quickModForm) != "undefined" && typeof(document.forms.quickModForm.message) != "undefined") { document.forms.quickModForm.message.onkeyup = function onkeyup(event) { storeCaret(this); calcCharLeft2(); }; } else setTimeout("message_onkeyup()", 800); } message_onkeyup(); function calcCharLeft2() { var maxLength = 20000; var oldEditor = "", currentEditor = document.forms.quickModForm.message.value; if (!document.getElementById("editorLeft2")) return; if (oldEditor != currentEditor) { oldEditor = currentEditor; if (currentEditor.replace(/\r/, "").length > maxLength) document.forms.quickModForm.message.value = currentEditor.replace(/\r/, "").substring(0, maxLength); currentEditor = document.forms.quickModForm.message.value.replace(/\r/, ""); } setInnerHTML(document.getElementById("editorLeft2"), maxLength - currentEditor.length); } // ]]>-->