Shop OBEX P1 Docs P2 Docs Learn Events
32.768khz as Output on a Propeller Pin — Parallax Forums

32.768khz as Output on a Propeller Pin

Daniel BuerginDaniel Buergin Posts: 4
edited 2006-12-12 07:14 in Propeller 1
Hi

I would like to connect a Barometric Pressure Sensor (MS5534B from [noparse][[/noparse]http://www.intersema.ch]).
The Sensor is a 3.3V Device and it seems to be hard to connect it to my AVR Atmega128 Chip, so i'am
thinking about a change to the Propeller Device as the MCU. Also to keep my Brain up and running wink.gif

The Problem is now, the Sensor needs a 32.768khz Input as his MasterClock. One way is using a
Oscillator, but they are hard to get. The other way is, setting up a 32.768khz signal on one of
the pins of the MCU. That means, i connect one of the Propeller Pins with the MCLK Pin of the
Sensor and that's it.

Question:

Is this possible and does it make sense on a propeller chip ? If yes, does anybody have a snippet
of code for me ?

Regards,

Daniel

Comments

  • BeanBean Posts: 8,129
    edited 2006-12-12 00:11
    I would think you could use one of the 32-bit counters (there are 16 of them in the propeller, 2 per cog)·to do that with no problems at all.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
    ·
  • Daniel BuerginDaniel Buergin Posts: 4
    edited 2006-12-12 00:28
    You mean something like this:

        ctra := constant(%00100 << 26) | 16       ' single-ended nco mode on A16
        frqa := fraction(100, clkfreq, 1)                   ' set for 100 Hz
        dira[noparse][[/noparse]16]~~                                                       ' make a16 an output
    
    



    I've found this fragment of code somewhere in this Forum. I'll try to
    adept this for my need.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-12-12 00:37
    You could use the counters, however the closest you can get using an 80 Mhz clock rate is ~32.773 kHz signal and vast amounts of jitter will be in the signal. If however you operate at 67.108864 MHz using a 4.194304MHz crystal (availible from digikey), the Propeller will be operating exactly 2048 times faster than 32.768khz. Since this number is a power of 2, the output signal will be very pure and almost jitter free. BTW they also sell your 32.768kHz crystal for $0.27. So does Mouser and many other online vendors.

    Which way to go depends on how accurate you need the reference signal to be, if it were a time keeping chip, I would suggest a rock-solid clock, but I don't know with a barometric pressure sensor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 12/12/2006 12:41:26 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-12-12 00:44
    The Intersema clock signal doesn't have to be exactly 32.768KHz. It can range from 30KHz to 35KHz, with a 40% to 60% duty cycle. Given these generous constraints, the Propeller should be able to provide an adequate clock without difficutly.

    -Phil
  • Daniel BuerginDaniel Buergin Posts: 4
    edited 2006-12-12 00:51
    Ok, first part of the Answer is ok, i'll look for a 4.1MHz Crystal. Second Part, it's not so simple as
    far as i understand (i'am not a Hardware-Guy...) The Pressure Sensor has only one so-called
    MCLK Pin and not two Pins to connect a 32.768khz Crystal. You have to use a DS32khz from Dallas
    or a SG-3032JC from Epson, and they are all very hard to get here in Switzerland. And also
    i can save some Hardware (good for a Software-Guy burger.gif )
  • Daniel BuerginDaniel Buergin Posts: 4
    edited 2006-12-12 00:53
    Thanks to Phil, that sounds good.

    I'll try it.

    Thanks and Good night
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-12-12 07:11
    Daniel,

    I'd be interested to learn of your experiences with this device. I have some samples of both it and the newer MS5540B that I've been contemplating for a design. (BTW, if you haven't looked at the '5540, it's a little more PCB-friendly, in that it's flat on one side.)

    Thanks,
    Phil
  • Remy BlankRemy Blank Posts: 42
    edited 2006-12-12 07:14
    Daniel Buergin said...
    The Pressure Sensor has only one so-called MCLK Pin and not two Pins to connect a 32.768khz Crystal. You have to use a DS32khz from Dallas or a SG-3032JC from Epson, and they are all very hard to get here in Switzerland.

    You could make your own oscillator with the 32.768kHz crystal, a CMOS inverter and two caps (and possibly a resistor, I can't remember). You should be able to find a sample schematic on the web. And all components at Distrelec or Farnell.
Sign In or Register to comment.