Shop OBEX P1 Docs P2 Docs Learn Events
Real time clock as a Virtual Periperal — Parallax Forums

Real time clock as a Virtual Periperal

LoopyBytelooseLoopyByteloose Posts: 12,537
edited 2005-09-22 15:08 in General Discussion
Well, I have a bunch of Sx-18s and I am wondering if anyone has created a real-time clock VP for the SX.

I am thinking this would be independent of the main microcontroller.

From what I can see, having a clock on its own chip that can send and receive interrupts is better than having it included in your main microcontroller.· Without having a dedicated device, it seems that sooner or later, you have problems with interrupts throwing the clock off the correct time.

And,
Does anyone have a suggestion on a·prefered frequency for such an application?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
G. Herzog in Taiwan

Comments

  • John CoutureJohn Couture Posts: 370
    edited 2005-09-20 20:54
    Kramer,

    Check out the PCF8583 chip. Pretty cool and cheap.

    http://www.semiconductors.philips.com/acrobat_download/datasheets/PCF8583_5.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • BongoBongo Posts: 65
    edited 2005-09-21 07:49
    Greetings Kramar



    Real time clocks need very accurate xtals, as a very small error results in big changes.· Based on a 4mHz xtal that is good for driving a micro, can easily result in time gain/losses of 10 minutes per day.

    The 32.768kHz watch xtal is the one to use, if you do not want to adjust your "clock" every day.· This introduces some limitations.

    The more flexible approach is to use the Dallas time/date chip.· Drive this with the 32.768kHZ xtal and then use whatever speed you want on the SX.

    Many years ago I saw very good information·in the app notes for the basic stamp.· Suggest you have a look.

    Greetings from queensland.

    bongo
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-09-21 15:10
    I have the Dallas time/date chip, but I thought it might be useful to use up my SX-18s as time pieces.

    Now I see the dilemma is not just about sharing the clock cycles, but sustaining a good tic at low power. Clocks must run 24/7 while the rest of the unit might be put into sleep mode.

    The above Virtual Peripheral designated a 50mHz crytal [noparse][[/noparse]lots of milliamps drain]. Even the 32.768 [noparse][[/noparse]this is a bad assumption, see Bean's email·below]·would create a bit of a power drain, but at least the accuracy would increase quite a bit.

    I· took a look at the PCF8583 and it is 50ma. The Dallas Chip seems to come in at 2ma !!! WOW and micro amps in standby with an optional backup battery.

    Of course there could be some occasions where having an SX be the clock could be a big advantage - a customized, shared format for waking up the main micro-processor.

    Also, if the SX is on an RS-485 network, one reliable clock could routinely reset all the others as a regular maintanance cycle.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan

    Post Edited (Kramer) : 9/21/2005 3:29:31 PM GMT
  • BeanBean Posts: 8,129
    edited 2005-09-21 15:25
    The SX current draw at 32.678 KHz is pretty low (less than 1mA I think).
    If you only need seconds or tenths of seconds it should be doable.
    You can do alot in 3267 cycles...
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available soon!! Video overlay(OSD) module...

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-09-21 15:31
    Excuse me, I got Kilohertz and Megahertz confused. It makes a whole world of difference.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-09-21 15:47
    Dont forget that the SX-Key debugger has problems operating below a few hundred kilohertz. You may want to develop with a 3.2678 MHz crystal so the debugger will work properly, just keep in mind that the program execution will be 100 times faster when debugging over final operation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • BeanBean Posts: 8,129
    edited 2005-09-21 16:43
    Paul,
    The sx-key will work at 327_680 too. Which would be only 10 times faster.

    P.S. Has anyone tried to make a clock that is syncronized by the 60Hz power mains ? From what I understand they have excellent long term stability.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available soon!! Video overlay(OSD) module...

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-21 16:55
    Bean,

    ·· Such a clock was in a recent issue of Nuts & Volts I believe...It used the 60hz from the AC line for it's clock base.· The part I didn't agree with was that they used the DS1302 or similar as a backup device for when poewr was lost, but maintained that the AC line was much more accurate than the DS chip.· I think it's funny the people that have the DS1302's and DS1307's that say they're inaccurate.· I have used several, and in a week they're never more a second off from the clock I set them by, so I don't see the problem with just using them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • BeanBean Posts: 8,129
    edited 2005-09-21 17:20
    Chris,
    I would assume that the DS1302 and DS1307 xtals are affected by temperature by possibly 50PPM or more. Where the 60Hz is monitored and adjusted to provide a very accurate timebase over the long term.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available soon!! Video overlay(OSD) module...

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-22 15:08
    I suppose, but my experiences with these RTC chips is that there hasn't been sufficient reason for me to think they are any less accurate than my PC RTC, or my wrist watch.· So I continue to use them.· The only thing I ever used the 60hz pulse from AC for was as an NMI interrupt on my Z80 controller boards for updating the displays and clock information in RAM.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.