Shop OBEX P1 Docs P2 Docs Learn Events
SX28 Oscillator/Resonator DEVICE info ?? — Parallax Forums

SX28 Oscillator/Resonator DEVICE info ??

T&E EngineerT&E Engineer Posts: 1,396
edited 2005-12-16 02:24 in General Discussion
I am a bit confused at how or why we have to use external resonators. I have had a 4 MHz resonator plugged into my Professional Development Board (Y1) for sometime now and found out that the SX28 must have an internal oscillator built in (as I can take it out and it still runs my program).

How does one know what resonator to use (or even at all). I have a·few 4 MHz, 20 MHz and 50 MHz from Parallax thinking they were required for use with the SX28.

I have a SX28 LED Moving display sign project that I can change internal SX28 settings to 32 KHz or 4 MHz and it does NOT speed up or slow down my display.

DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000

or

DEVICE········· SX28, OSC32KHZ, TURBO, STACKX, OPTIONX
FREQ············ 32_000

How does one know what to use to speed the SX28 programs up or slow them down?

I don't quite·see my·answer from the SX Key Development System manual v2.

Any direction would be helpfull.

Thanks,

Timothy Gilmore

Comments

  • BeanBean Posts: 8,129
    edited 2005-12-15 19:00
    Tim,
    "DEVICE OSC4MHZ" tell the SX to use it's own internal 4mhz clock. But it is NOT accurate enough for serial communications.

    Your display probably didn't speed-up or slow-down because SX/B "knows" the clock speed by the "FREQ" command and adjusts the code so the delays are correct for that clock speed. For instance so that a "PAUSE 1" takes 1millisecond no matter what the clock speed is.

    If you code doesn't need accurate timing and go ahead and use the internal clocks (either 4MHZ, 1MHZ, 128KHz, or 32Khz) via OSC4MHZ, OSC1MHZ, OSC128KHZ, OSC32KHZ.

    Bean.

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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Forget about the past, plan for the future, and live for today.
    ·
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-12-15 19:19
    I was always under the impression or thought I read that the resonators were not accurate for serial communications so that is why one would use a crystal oscillators.

    I wasn't aware that the SX28 had it's own internal programmable oscillator (32 KHz to 4 MHz). Thats fine and now I know.

    What I am still not clear about is the following:

    How does one know what value to use (32 KHz or 4 MHz internal setting or external resonator) if it automatically adjusts pause / timing statements?

    Do I just NOT use the DEVICE statement if I want the program to run faster. This means I must use either an external Parallax·4, 20 or 50 MHz resonator.

    Thanks,

    Timothy Gilmore
  • BeanBean Posts: 8,129
    edited 2005-12-15 19:36
    Tim,
    Resonators are plenty accurate enough for serial communications. The internal clock is something like +/- 8% a resonator is probably something like +/- 0.1%

    Of course a fast clock will run faster. But "PAUSE 1" will always be 1millisecond. If you want less than that then use PAUSEUS.
    You MUST have the DEVICE line.
    Bean.

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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Forget about the past, plan for the future, and live for today.
    ·
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-12-15 19:57
    Timothy,

    If your questen is,·why you have external·resonators. The best answer that I have is, if you run a program without the SX-Key installed, you need a resonator on board. I was under the impression that the processor had an internal resonator, but on my SX-28 tech board, once the SX-Key is removed nothing happens, even when the setting is set to freq 4_000_000. So, I have to plug in the freq specific resonator.

    Ray
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-12-15 20:06
    Ray,

    You must set the DEVICE line to enable the internal resonator -- use OSC4MHZ in the DEVICE line and that will turn it on. As Bean has pointed out, don't try to use the internal resonator for serial communications.· Download the attached program (connect a LED to RA.0) to prove it to yourself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 12/15/2005 8:11:30 PM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-12-15 20:33
    Thanks for the good info.

    Now that we know that external resonators are generally used for Serial communications - otherwise don't use external resonators.

    Next question that is still unanswered...What value should one use internally (32 KHz or 128 KHz or 1 MHz or 4 MHz, etc..)?

    or if you are doing a serial comm project such as 2400 - 9600 baud...what value of external resonator should be used (4 MHz, 20 MHz or 50 MHz or 75 MHz)?

    Thanks,

    Timothy Gilmore
  • Mike CookMike Cook Posts: 829
    edited 2005-12-15 20:37
    A 4 MHz resonator should be adequate for serial data @ 2400 to 9600 baud

    SX/B will raise an error if the baud rate specified exceeds the ability of the target FREQ.

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OEM NMEA GPS Module" Now available on ebay for only $19.99, FREE shipping until 2006!

    Product web site: http://www.allsurplus.net/Axiom/

    Post Edited (Mike Cook) : 12/15/2005 8:40:10 PM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-12-15 20:46
    OK

    However 4 MHz is good for serial communications, when do you use 20, 50 or 75 MHz external resonators?

    Also what about internal values (non serial comm projects - 32 KHz, 128 KHz, 1 MHz or 4 MHz)? Why are there so many values to choose from if timing statements (e.g. PAUSE, PAUSEUS, etc..) are auto adjusted. Speed in the program statements??

    Thanks,

    Timothy Gilmore
  • BeanBean Posts: 8,129
    edited 2005-12-15 22:56
    Tim,
    I'm not sure I follow your question... Instructions are executed at the clock frequency, so 4Mhz code will run 4 times faster than the same code at 1Mhz.
    But the downside is that the faster the clock the more power the SX chip uses. So for battery powered project you want to use the slowest clock possible.
    Bean.

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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Forget about the past, plan for the future, and live for today.
    ·
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2005-12-16 02:24
    You answered my questions for the most part. I just have to trust and believe.
Sign In or Register to comment.