PDA

View Full Version : Working with Pocket Watch B



TimN
01-14-2006, 11:00 PM
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

PJ Allen
01-14-2006, 11:35 PM
There's an on-line PDF at www.parallax.com (http://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, [$55, $00, $00, $00, $09, $0E, $01, $06]

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, [$55, $10, $00, $00, $09, $0E, $01, $05, $20]

$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, ["U", $10, $00, $00, $09, $0E, $01, $05, $20]

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

TimN
01-15-2006, 01:12 PM
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 Bates
01-15-2006, 01:52 PM
Tim -

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

Regards,

Bruce Bates

TimN
01-15-2006, 03:02 PM
what would the proper number for theˇbaudrate be?

Bruce Bates
01-15-2006, 03:12 PM
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

PJ Allen
01-15-2006, 10:16 PM
Yep.

Before you read from it, you have to tell it that you want some data from it.ˇ Their example is -- SEROUT 14, 84, [$55, $12].ˇ I would use 4800bps, instead, so -- SEROUT 14, 188, [$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 Graner
01-16-2006, 10:40 PM
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! http://forums.parallax.com/images/smilies/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

TimN
01-20-2006, 11:25 AM
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