Shop OBEX P1 Docs P2 Docs Learn Events
I don`t find a timer regirter into BS2p40 — Parallax Forums

I don`t find a timer regirter into BS2p40

ArchiverArchiver Posts: 46,084
edited 2002-12-18 20:15 in General Discussion
I need a information about the registers, where i can find nformation
about TIMER or Cycle to program my clock and Date..... Because i need
a internal signal with 1 sec or 1msec to programing my specific
application (Big Clock and Date with 7-segment (Very big)24 led per 7-
segment)...

If you have a program for similary applocation... I appreciate that
you send my by email or you will tell me about what book to read....

Note:
I red the STAMP BASIC BOOK and I didn`t find this information and It
is impossible this chip don`t have this TIMER...

I appreciate your prompt response

Best Regards

Ing Damian Trujillo G.
Venezuela, Caracas

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-12-18 17:17
    Unfortunately, you can't do accurate timing with a Stamp without using
    external components. Not completely true - you can use the PAUSE statement
    to generate a delay, but then you have to make sure all the various paths
    through your program are the same length (in terms of instruction timing)
    so that the delay plus the instruction timings are a constant. The to
    calibrate the whole thing, you need access to a frequency counter/timer so
    you can measure the period of the loop, and adjust the PAUSE delay until
    you come up with a 1 second period for the loop. Messy indeed.

    If you look on the Microchip web site, you will find application notes for
    the Stamp. Appnote 20 describes how to use a 32768 hz watch crystal and a
    divider chip to generate accurate time intervals, such as 1 second. This
    works - I've done it.

    Larry

    At 04:51 PM 12/18/2002 +0000, you wrote:
    >I need a information about the registers, where i can find nformation
    >about TIMER or Cycle to program my clock and Date..... Because i need
    >a internal signal with 1 sec or 1msec to programing my specific
    >application (Big Clock and Date with 7-segment (Very big)24 led per 7-
    >segment)...
    >
    >If you have a program for similary applocation... I appreciate that
    >you send my by email or you will tell me about what book to read....
    >
    >Note:
    >I red the STAMP BASIC BOOK and I didn`t find this information and It
    >is impossible this chip don`t have this TIMER...
    >
    >I appreciate your prompt response
    >
    >Best Regards
    >
    >Ing Damian Trujillo G.
    >Venezuela, Caracas
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and
    >Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

    Larry Bradley
    Orleans (Ottawa), Ontario, CANADA
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-18 17:21
    Damian:

    Since the BASIC Stamp interpreter controls all the internal registers, your
    best bet is to use an off-chip RTC like the DS1302 or the PCF8583. Both will
    save you the trouble of synthesizing the time and date. You can find lots of
    demo code for each at our web site.

    Happy Holidays.

    -- Jon Williams
    -- Parallax


    In a message dated 12/18/2002 10:54:56 AM Central Standard Time,
    dtrujillo_riese@c... writes:

    > I need a information about the registers, where i can find nformation
    > about TIMER or Cycle to program my clock and Date..... Because i need
    > a internal signal with 1 sec or 1msec to programing my specific
    > application (Big Clock and Date with 7-segment (Very big)24 led per 7-
    > segment)...
    >
    > If you have a program for similary applocation... I appreciate that
    > you send my by email or you will tell me about what book to read....
    >
    > Note:
    > I red the STAMP BASIC BOOK and I didn`t find this information and It
    > is impossible this chip don`t have this TIMER...
    >
    > I appreciate your prompt response
    >
    > Best Regards
    >
    > Ing Damian Trujillo G.
    > Venezuela, Caracas
    >



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-18 20:15
    Yes, it is true about needing an external real time clock but this is the
    code I came up with. Though I wouldn't actually use it but it should get you
    started Sounds like I will be able to read your clock from where I stand.
    Keep us posted.

    seconds var byte
    minutes var byte
    hours var byte
    days var byte
    curhr var byte
    curmin var byte

    gosub update
    for seconds = 0 to 60
    if seconds = 60 then zerosec
    if minutes = 60 then zeromin
    if curmin = 60 then zerocurmin
    if curhr = 24 then zerocurhr
    pause 928 'calibrate here. last time i ran this
    'program it lost 3 minutes in 2 hours

    debug home, ? seconds, ? minutes, ? hours, ? days, cr, "Time is now ", dec
    curhr,":",dec2 curmin
    next


    zerosec:
    seconds = 0
    debug cls
    minutes = minutes + 1
    curmin = curmin + 1
    return


    zeromin:
    minutes = 0
    hours = hours + 1
    if hours = 24 then zerohrs
    return

    zerohrs:
    hours = 0
    days = days + 1
    return

    update:
    if seconds + minutes + hours + days = 0 then currentime
    return

    currentime:
    curmin = 8 'put current minutes here
    curhr = 10
    return


    zerocurhr:
    curhr = curhr - 24 'put current hour here
    return

    zerocurmin:
    curmin = curmin - 60
    curhr = curhr + 1
    return


    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.