Shop OBEX P1 Docs P2 Docs Learn Events
Clock code need to modify to use as timer — Parallax Forums

Clock code need to modify to use as timer

tronmovertronmover Posts: 2
edited 2006-08-25 23:28 in BASIC Stamp
I recently used alarm clock (BS2CLOCK.BS2) ON A BASIC STAMP2.
http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv33.pdf
I would like to use and modify·the code·now for a project that requires additionally a timer to be active every 15 min for a few secs. The timer would have to be in sync with the correct time. In other words after setting the correct time the timer would be active at 15 min intervals. With this project I would not need the standard alarm and could use the OUT15 pin for this. Also it would not be necessary to set the 15 min interval with the buttons, set in the code is ok.
My job is designing mechanical items and I am new to the microcontrollers. Do you have any suggestions for me? Any help would be greatly appreciated.
·
Thank
David

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-24 14:37
    David,

    ·· The need for a timer was discussed in the following thread.· I would see if this is along the lines of anything you're trying to do.· I hope this helps.· Take care.

    http://forums.parallax.com/showthread.php?p=568430

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-24 15:55
    Hi David,

    Use the value of rawtime calcluated in the program. It is a value that goes from 0 to1439, the number of minutes since midnight each day.
    rawTime = (hr10 * 600) + (hr01 * 60) + (mn10 * 10) + mn01

    Then every 15 minutes the value of rawtime // 15 will equal zero. There is also a value of seconds, calculated from secs = sc10 * 10 + sc01

    IF rawtime // 15 = 0 AND secs < 3 THEN 
        HIGH 15
        PAUSE 2000
        LOW 15
      ENDIF
    



    Including the value of seconds keeps it from repeating the pulse.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2006-08-25 02:44
    Tracy Allen

    I like this little routine i tried this and i works very good· Thanks for Posting it······· ·idea.gif


    Sam········ smile.gif
  • tronmovertronmover Posts: 2
    edited 2006-08-25 23:28
    Hello Tracy
    Thanks for the rawtime code. I inserted it into the BS2CLOCK.bs2 and pulses every 1 min, I can't seem to get it to work for 15min. Im sure I have something off.
    Possibly the wrong place. I had to use the code with PBASIC 2.5. any suggestions woul be helpful.

    Thank you
    David
Sign In or Register to comment.