Shop OBEX P1 Docs P2 Docs Learn Events
Working with Pocket Watch B — Parallax Forums

Working with Pocket Watch B

TimNTimN Posts: 32
edited 2006-01-20 04:25 in BASIC Stamp
Can any provide me with some guidance regarding how to set the time on the Pocket WatchB and turn the alarms on and off?

Thanks

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-01-14 16:35
    There's an on-line PDF at www.parallax.com and it's loaded with examples.

    Here's how to Set the Time, you send the following to the PocketWatch FM pin, this will get you 9:00:00 AM, Jan 14, '06·--

    SEROUT·14, 84, [noparse]/noparse][color=blue]$55[/color], $00, [color=red]$00, $00, $09,[/color] [color=green]$0E, $01, $06[/color

    All that data is hexadecimal
    • $55 Sync Byte -- all COMMs to Watch·Begin w/ 'sync byte'
    • $00 Tells it Time Data will follow
    • $00 secs·
    • $00 mins
    • $09 hrs·
    • $0E·day
    • $01·month·
    • $06 year

    ********

    I'm assuming that you're using a BS2 (you didn't mention).· Also, the·SEROUT is going out P14 at 9600 bps.·

    ********

    I see that there is also a Set Time Extended, so the above may result in an 06 for the year instead of 2006

    The Extended is similar --

    SEROUT·14, 84, [noparse]/noparse][color=blue]$55[/color], $10, [color=red]$00, $00, $09,[/color] [color=green]$0E, $01, [/color][color=purple]$05, $20[/color
    • $55 Sync Byte -- all COMMs to Watch·Begin w/ 'sync byte'
    • $10 Tells it EXTENDED Time Data will follow
    • $00 secs·
    • $00 mins
    • $09 hrs·
    • $0E·day
    • $01·month·
    • $05 year low
    • $20 year high

    Since they use 20 & 05, then I guess it's sort of BCD, unlike the other bytes which are HEX.

    I think you can use "U" instead of $55, too, if you find that easier to remember --

    SEROUT·14, 84, [noparse]/noparse][color=#0000ff]"U"[/color], $10, [color=red]$00, $00, $09,[/color] [color=green]$0E, $01, [/color][color=purple]$05, $20[/color

    I've also noticed that in the examples in their PDF they switch baudrate settings (no explanation.)· But it has an auto-baud detector (which is the stated use·for the $55/"U"/SyncByte.)



    Post Edited (PJ Allen) : 1/14/2006 6:08:07 PM GMT
  • TimNTimN Posts: 32
    edited 2006-01-15 06:12
    Sorry.· I forgot to mention that i am using a BS2pe.· Will that change anything?· Also, i can set the alarm and the clock, but i can not read the clock or alarm.· Any tips?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-15 06:52
    Tim -

    Just make sure you are using the proper number for the baudmode parameter in SEROUT.

    Regards,

    Bruce Bates
  • TimNTimN Posts: 32
    edited 2006-01-15 08:02
    what would the proper number for the·baudrate be?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-15 08:12
    Tim -

    You can use the PBASIC Help File to answer questions like that. Here is what that would tell you:

    9600 baud 8, N, 1, INVERTED = 16468
    9600 baud 8, N, 1, TRUE = 84

    Regards,

    Bruce Bates
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-01-15 15:16
    Yep.

    Before you read from it, you have to tell it that you want some data from it.· Their example is -- SEROUT 14, 84, [noparse][[/noparse]$55, $12].· I would use 4800bps, instead, so -- SEROUT 14, 188, [noparse][[/noparse]$55, $12].·

    It will send the data requested (i.e., $12 = extended time data) from its TM ("To Master") pin·at the baudrate used in the request (84 = 9600bps, true; 188 = 4800bps, true.)

    Have you read any part of the PDF?
  • Vern GranerVern Graner Posts: 337
    edited 2006-01-16 15:40
    TimN said...
    Can any provide me with some guidance regarding how to set the time on the Pocket WatchB and turn the alarms on and off?

    Thanks

    I found the demos that were bundled with the PWB a bit confusing myself, so as an excercise I wrote some code for the BSII that would turn the PWB and a Parallax Serial LCD panel into a very basic clock. The code is attached. Hope that helps! smile.gif

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • TimNTimN Posts: 32
    edited 2006-01-20 04:25
    After trying all of the above suggestions, I still cannot get the PocketWatch B to work. When I use the example program that is included in the PDF file, I get the message "Alarm Read 1 Bad" message. Is there any way to test the PocketWatch B to see if it is not working properly?

    Thanks
    Tim
Sign In or Register to comment.