Shop OBEX P1 Docs P2 Docs Learn Events
Recording Time — Parallax Forums

Recording Time

Dylan LandryDylan Landry Posts: 235
edited 2010-06-07 18:51 in BASIC Stamp
Could I ask what command would you use for PBASIC 2.5 to record time?

Could someone attach some sample code on how to display the amount of time elapsed since the program started on the debug terminal to appear like this?


Time Elapsed (sec)

1
2
3
4
....

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-07 03:30
    There's no direct way to record time (and do much of anything else). Really the only good time "tick" is the PAUSE statement which is quite accurate. You can put a PAUSE in a loop that doesn't do much else and keep a count of the number of times through the loop. You have to adjust the time to include the execution time of the other statements in the loop and that takes a little experimentation. The DEBUG statements particularly take time to execute, about 1ms per character.

    time var word

    time = 0
    debug "Time Elapsed (sec)",CR
    do
    pause 997
    time = time + 1
    debug time,CR
    loop
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-06-07 05:10
    I've posted some examples of doing this using a DS1302. You can search Google to find these posts by using keywords Chris Savage DS1302 timer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • sumdawgysumdawgy Posts: 167
    edited 2010-06-07 13:17
    I apologize for not actually speaking STAMP here.

    BUT wow 03/2005!
    Obviously, I really need to start googling you & my topic b4 posting questions!
    You've got some " illuminating " posts Chris!!!! Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Before you criticize someone, walk a mile in his shoes. That way if he gets angry, he'll be a mile away and barefoot. - unknown
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-06-07 16:42
    Dylan, assuming you're asking this because of the ARLISS project, you should know that the rocketeers have already built a real time clock (1307 chip, I believe) into the system. As others here have pointed out, the BS2 processors can't directly keep time, but it's easy to add a device that can, and your group already solved that problem for last year's flight.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-06-07 18:51
    Thank you. I have posted a few projects in the past. [noparse];)[/noparse] www.savagecircuits.com

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
Sign In or Register to comment.