Shop OBEX P1 Docs P2 Docs Learn Events
Ds1302/emic — Parallax Forums

Ds1302/emic

NewzedNewzed Posts: 2,503
edited 2004-07-28 15:00 in BASIC Stamp
I have just completed the incorporation of my EMIC progrm into my DS1302 program.

EMIC now says:
"The time is fifteen twenty-eight"

then one second later she says:
"Today is Sunday the twenty fifth of July"

It is a pretty tricky program in a couple of respects - if you are planning to do something like this and need a bit of help, I'll be happy to oblige.
The hardest part was getting her to say the day of the week.

I did this one all by myself but I have to thank Jon Williams for an education in data handling.yeah.gif

Sid

Comments

  • NewzedNewzed Posts: 2,503
    edited 2004-07-26 14:03
    I want my EMIC to announce the time every five minutes.· I came up with this routine:

    mins = $10m (or $42 or something, from DS1302)
    IF· mins.lownib = 5 or mins.lownib = 0 THEN
    (display mins)
    GOTO start
    ELSE
    DEBUG "no go", cr
    GOTO start
    ENDIF

    Is there a better way to do it?

    Sid
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-07-26 15:33
    You might want to add the seconds to your logic so you don't get multiple announcements during the one-minute period when the LOWNIB of minutes is five.· Try this:

    Check_Announce:
    · IF (mins.LOWNIB = 5) AND (secs = 0) THEN
    ··· ' announce the time here
    · ENDIF


    ·This should cause the announcement to happen just once.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • NewzedNewzed Posts: 2,503
    edited 2004-07-26 16:27
    I had the 'duplicate announcement" problem - I added a 45 second pause between clock reads and that took care of it - put the time into a non-read backet, so to speak.

    I've added an ADC/LM34 serin input to the program and now she tells me time, date and temperature.

    This is really a cool gadget !yeah.gif

    Sid
  • Bruce RBruce R Posts: 4
    edited 2004-07-27 00:46
    I agree with you Sid. The EMIC is definitely a lot of fun. We have one setup with our new 4-digit seven-segment serial LED display modules. The display switches between time & temperature every few seconds,·while the EMIC module announces the time & temperature every hour.

    We have alarms set for certain times of day, and high temperature values. The temperature alarms trigger a routine that cranks up the EMIC volume before announcing the alarm temperature, and the display goes into full-brightness mode to be seen from a greater distance.

    Pretty nifty considering the whole setup still leaves plenty of Stamp I/O-pins available for other gadgets.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards,


    Bruce
    tech@rentron.com
    http://www.rentron.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-07-27 01:09
    Sid,

    ·· Are you using Burst Mode to read/write to the DS1302?
    Just curious...



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777
  • NewzedNewzed Posts: 2,503
    edited 2004-07-27 12:55
    Yes.· Here is the snippet for reading the 1302:

    GetClk:
    · HIGH Rst
    · SHIFTOUT Dio,Clkc,LSBFIRST,[noparse][[/noparse]191]
    · SHIFTIN Dio,Clkc,LSBPRE,[noparse][[/noparse]secs,mins,hrs]
    · SHIFTIN Dio,Clkc,LSBPRE,[noparse][[/noparse]date,month,day,year]
    · SHIFTIN Dio,Clkc,LSBPRE,[noparse][[/noparse]CTRL]
    · LOW Rst
    · RETURN

    I use 191 instead of $BF

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    check out our 4-digit serial LED

    http://hometown.aol.com/newzed/index.html
    ·
  • NewzedNewzed Posts: 2,503
    edited 2004-07-27 13:08
    Correct, Bruce.

    The EMIC uses 4 lines, the LED 3 lines and the 1302 3 lines, leaving 7 lines free.· The Dio line for the 1302 can often be used for other things so actually there are 8 lines free.· My temp info is serined from another module.· And even with the large number of variables required, especially for the 1302, I still have 3 bytes and 1 nibble left in RAM.wink.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    check out our 4-digit serial LED

    http://hometown.aol.com/newzed/index.html
    ·
  • NewzedNewzed Posts: 2,503
    edited 2004-07-28 15:00
    Jon, I wrote:

    if mins = $00 then

    serout Tx, T2400, [noparse][[/noparse]say, "The time is ", hex2 hrs, " hundred", eom]

    and it worked perfectly.· Thanks for the tip.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    check out our 4-digit serial LED

    http://hometown.aol.com/newzed/index.html
    ·
Sign In or Register to comment.