Shop OBEX P1 Docs P2 Docs Learn Events
day counter — Parallax Forums

day counter

dbjdbj Posts: 75
edited 2006-11-17 06:32 in General Discussion
How would you convert this to sxb? there is no dedug command how would you see the time and·days? David


' {$STAMP BS2p}
' {$PBASIC 2.5}
days VAR Word
hrs VAR Word
mns VAR Word
sec VAR Word

START:
PAUSE 1······················· '968 ' Adjust this to 'tune' the clock.
DEBUG HOME, "mns = ", DEC2 mns , "hrs = ", DEC2 hrs , "days = ", DEC3 days' ,· "days = ", DEC3 days
sec = sec + 5 * 500
IF sec < 60 THEN START
sec = 0
mns = mns + 1
IF mns < 60 THEN START
mns = 0
hrs = hrs + 1
IF hrs < 24 THEN START
hrs = 0
days = days + 1
IF days < 365 THEN START
days = 0

·

Comments

  • YendorYendor Posts: 288
    edited 2006-11-16 18:26
    You could use a 'watch' of those var's at the beginning of the code.

    Also, look in the Example projects in the help file - there's a nice timer in there that you could adapt. You'd have to put in the Day variable.

    This also a nice assembly version in Gunther's book.
  • PJMontyPJMonty Posts: 983
    edited 2006-11-17 06:32
    dbj,

    Are you working on a project or just trying to understand some code? If you're working on a project, I assume you'll have some sort of output device that you'll need to write code to support. If not, then the "watch "commands will work. Just be aware that if you're running the program in the debugger, you'll need to periodically hit the "Poll" button to update the watch window. It will automatically update if you stop the code execution, but it will not update while running. That's what the "Poll" button is for.
      Thanks, PeterM
Sign In or Register to comment.