Shop OBEX P1 Docs P2 Docs Learn Events
SX button timer program — Parallax Forums

SX button timer program

CapdiamontCapdiamont Posts: 218
edited 2008-06-12 06:26 in General Discussion
I've put my other cat door program on hold for now. In prep for a irrigation timer, which I'm waiting on a batch of real time clock chips. In the mean time, I wanted to know what real time vs internal clock was, for reasonable timing.

The idea is to hit a button, to start the count, and hit it again to end it, send the results to the pc, hopefully via the sx-key. I still have to figure out the sending to pc, will look further, thinking of the watch variables. I use eight word variables to hopefully do it. The idea is DelayTemp0 is the 1st variable to be updated, and the fastest(recursive?) The DelatTemp7 is the last and slowest to be updated.

This is as yet untested. I'm using sx48.

The only problem with learning, is I'm so good at forgetting.

Comments

  • CapdiamontCapdiamont Posts: 218
    edited 2008-06-12 06:26
    it seems to be working great, I didn't use the led output after all. This mainly interacting with the debug windows and the button anyhow.

    at 4_000_000

    1 Min:
    DelayTemp0=25,341
    DelayTemp1=41
    0's for the rest


    at 400_000
    2.5 Min: (I was a little slow and distracted)
    DelayTemp0=3,337
    DelayTemp1=10
    0's for the rest

    so each DelayTemp var is a word, so it would hold a max 0f 65535 plus 0 place

    so the 1st was 2,712,317 cycles through total and per min

    the second was 658,697 cycles through total and 263,478.8 cycles per min.

    720 min in 12 hours:

    1st for 12 hours would be 1,952,868,240

    / 65536 = 29,798.859235523002975509269855802 so two word variables would do it?

    2nd for 12 hours would be 189,704,736

    / 65536 = 2,894.66455078125


    I'm thinking this one is complete.
Sign In or Register to comment.