Shop OBEX P1 Docs P2 Docs Learn Events
repost of the repost, I don''t know what went wrong....Clock Help — Parallax Forums

repost of the repost, I don''t know what went wrong....Clock Help

ArchiverArchiver Posts: 46,084
edited 2003-01-05 19:51 in General Discussion
I think you are almost there. The number modifiers have to
coordinate at the two ends of the transmission. If you use this
syntax to receive the data:

> SERIN 3\12, 16468, [noparse][[/noparse] hours]
> SERIN 3\12, 16468, [noparse][[/noparse] minutes]
> SERIN 3\12, 16468, [noparse][[/noparse] day]

then on the transmit end, you would use

SEROUT 3\12, 16468, [noparse][[/noparse]HEX $15]
SEROUT 3\12, 16468, [noparse][[/noparse]HEX $00]
SEROUT 3\12, 16468, [noparse][[/noparse]HEX $02]

to transmit the example numbers. The receive end then would program
the DX1302 for 3:00 pm on day 2.

On the transmit end, you will probably have variables for the hours,
minutes, and day? If they are already in hex (=BCD) format (as they
might be if you are having someone enter them at a keyboard), then
you would use

SEROUT 3\12, 16468, [noparse][[/noparse]hours]
SEROUT 3\12, 16468, [noparse][[/noparse]minutes]
SEROUT 3\12, 16468, [noparse][[/noparse]day]

but if they are not already in hex (BCD) format, then on the transmit side use

SEROUT 3\12, 16468, [noparse][[/noparse]HEX hours]
SEROUT 3\12, 16468, [noparse][[/noparse]HEX minutes]
SEROUT 3\12, 16468, [noparse][[/noparse]HEX day]

Play around with it, and one or the other of those options on the
transmit end should work.

-- Tracy



>The DS1302 real time clock sourse code from the app notes sets the
>clock using this code:-
>
>Day = $02 'Monday
>Month = $05 'May
>Date = $18 '18th
>Year = $98 '1998
>Hours = $15 '3:00 PM (in 24-hour mode)
>Minutes = $00
>Seconds = $00
>'GOSUB SetTimeAndDate
>
>I want to set the time from a separate bs2 set up as a programmer,
>using serin command.
>
>My code looks like this :-
>
>SERIN 3\12, 16468, [noparse][[/noparse] hours]
>SERIN 3\12, 16468, [noparse][[/noparse] minutes]
>SERIN 3\12, 16468, [noparse][[/noparse] day]
>'hours = $13
>'minutes = $14
>'day = $7
>Month = $12
>Date = $03
>Year = $02
>Seconds = $00
>GOSUB SetTimeAndDate
>
>and it doesn't work.
>
>I have noticed that the original code makes the time for the clock
>setting a HEX number by preceding the constants with a $ sign,
>so i tried the following :-
>
>SERIN 3\12, 16468, [noparse][[/noparse]HEX hours]
>SERIN 3\12, 16468, [noparse][[/noparse]HEX minutes]
>SERIN 3\12, 16468, [noparse][[/noparse]HEX day]
>'hours = $13
>'minutes = $14
>'day = $7
>Month = $12
>Date = $03
>Year = $02
>Seconds = $00
>GOSUB SetTimeAndDate
>
>I also tried this at the serout end.
>
>Nothing Works [noparse]:([/noparse]
>
>Can anybody help me
>
>Regards,
>
>Dwain.
>
>
>
>
>
>
>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/
Sign In or Register to comment.