Jump to content



Photo
- - - - -

Time counting, pls help


  • Please log in to reply
2 replies to this topic

#1 Satoshi

Satoshi

    Newbie

  • Members
  • Pip
  • 10 posts

  • Calculators:
    CFX 9860GII SD

Posted 19 November 2017 - 11:07 AM

Is it possible to count time while program is running? I wanted to add screen with score and how long it toke to beat the game, but I don't know how to do this. 



#2 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Gender:Male
  • Location:Tokyo, Japan
  • Interests:programming, smooth Jazz and 4-wheel driving.

  • Calculators:
    FX-502P, FX-602P, FX-603P,
    fx-4000P, fx-7000G,
    fx-4500P, fx-4800P
    fx-5800P,
    CFX-9850G,
    CFX-9850GC PLUS
    fx-9860G,
    fx-9860G AU,
    fx-9860G Slim
    fx-9860GII SD,
    fx-9860GII-2,
    fx-9860GII-2 SD,
    fx-CG20, fx-CG50,
    fx-CP400

Posted 03 December 2017 - 11:27 AM

Hi Satoshi

 

Casio Basic does not have timer commands.

So if you do not need to measure exact time, just using loop with incremental variable may help;

 

0->C

Do

Getkey->K

Isz C

[some process]

LpWhile K≠[keucode of key that you want to get out of this loop with]

 

then use C to refer count of loop.

 

Good luck!


Edited by Krtyski, 03 December 2017 - 11:28 AM.


#3 Rhodie

Rhodie

    Casio Fan

  • Members
  • PipPip
  • 35 posts

  • Calculators:
    fx9750gii upgraded to fx9860G<br />EX995 Classwiz <br />

Posted 21 June 2019 - 12:40 AM

In short, no, not accurately.

Time calculations are created based upon loop routines.

Each line of code consumes time and therefore creates a speed bump in the loop which needs a comparator to rectify it.

Another issue is battery voltage. As voltage decreases the program slows down resulting in longer calculation cycles.

Thermal variation also plays havoc with calculation speed and is a known factor in computer performance. The warmer the device the slower the calculation.

The closest approximation is a program I wrote as a countdown timer based upon real world timings over extended periods.

ClrText
"Countdown timer duration in seconds"?->A
7.18A->A
For 1->B To A Step 0.01
Next
ClrText
Locate 7,4,"Time up!"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users