Shop OBEX P1 Docs P2 Docs Learn Events
SX newbie questions — Parallax Forums

SX newbie questions

Robert SchwartzRobert Schwartz Posts: 141
edited 2005-02-28 01:59 in General Discussion
Hey, I am trying to make a really low power consumption robot using the SX's. I was wondering how I would configure a 32khz resonator. The SX manual gives the diagram, and capacitor/resistor settings for most resonators, but not 32khz. Also, I am not sure what additional settings I shoul use. I am not using turbo, for slightly less power consumption, but I don't know about settings like STACKX and OPTIONX. What are they used for and will they have any affect on power consumption? I'm using the SX18 (probably).

Comments

  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-24 22:00
    Does anyone know where I can even get a 32khz resonator? I can't seem to find one.
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-02-24 22:10
    Robert,

    I never tried to hook up a 32 kHz resonator to an SX, but it should work. If you have one on hand, just give it a try without adding additional components, like a parallel resistor, or any caps to ground, and see if it works. If you have a scope available, check if there is a clock signal on the OSC pins, or run a simple program, like blinking an LED to verify that the SX operates at that clock rate.

    STACKX and/or OPTIONX (including one in your code automatically activates the other one, so there is no need to include both - but it does not cause trouble if you do so), activate the SXes 8-level subroutine stack (there are only two levels w/o this directive), and also allows to make use of the eXtra bits in the option register (this is what the X stands for) that you will need to activate the RTCC overflow controlled interrupt. IMO, this is one of the greatest features of the SX.

    Besides this, I suggest to activate the TURBO mode as this effectively allows the SX to execute programs four times faster compared to non-TURBO without dramatically increasing power consumption.

    You are right, the SX "eats" less power, when clocked at low frequencies. On the other hand, dealing with robot applications usually means that you will have to control some servos, or motors, and with a clock frequency as low as 32 kHz, it might be impossible to generate the required RWM signals to control the servos with sufficient resolution.

    I prepared some servo-controlling code for my SX book, and I found that even the 4 MHz clock I used did not allow for a good resolution.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-24 22:31
    Thanks, G
  • James NewtonJames Newton Posts: 329
    edited 2005-02-24 22:46
    You should look into running at lower voltages as well as slower frequencies. Also, put it to sleep as often as possible. See:

    http://www.sxlist.com/techref/ubicom/power.htm

    http://www.sxlist.com/techref/ubicom/turbopower.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-24 23:29
    Thanks for the links James! I plan on running it at about 3V, so it looks like I will only be able to hit about 4mhz. It doesn't seem that turbo really takes that much extra power. Definately not proportional to the speed drop. For only about 1mA, I may as well just use it. Also, does it matter if the volatge isn't regulated?

    Post Edited (Robert Schwartz) : 2/24/2005 11:32:19 PM GMT
  • BeanBean Posts: 8,129
    edited 2005-02-24 23:31
    I would just use the internal 32KHz oscillator, but "OSC32KHZ" on the device line.

    You have internal option of 4MHz, 1MHz, 128KHz and 32KHz. They are about +/- 8% so don't use the internal osc if you need to do serial comm or anything.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-24 23:37
    I don't need serial communications. Do you need any external components when using an internal oscillator? If not, do you just leave OSC1 and OSC2 open, or should I tie them high/low?
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-02-25 00:43
    Robert,

    just leave'em open. As Bean said, this internal clock is not very accurate. Although the SX-Key IDE allows for "IRC" calibration (internal RC Clock), chip temperature, supply voltage, etc. still have an impact on the frequency.

    When running the SX with an unregulated power supply, make sure that the supply voltage does not drop below the minimum, which is 2.7 V @ 32 kHz clock, according to the SX data sheet, and also make sure that brownout detection is turned off (add DEVICE BOROFF to your code, just to be sure).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-25 01:05
    Thanks guys, once my parts come in, I should be able to get a prototype working pretty quickly.
  • KenMKenM Posts: 657
    edited 2005-02-25 22:43
    One other note when running at internal 32khz.

    I have found that if you are using the SX key, I cannot use the debug feature.

    I think that is 'normal'

    ken
  • BeanBean Posts: 8,129
    edited 2005-02-26 01:25
    Right the SX-Key can only debug from 300KHz to 100MHz.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-26 02:31
    Thats alright, my circuit is pretty simple and straightforward. For testing I plan on using a few LEDs to make sure everything is going right, then Im going to remove them so I can switch to solar power. Thanks for all the help guys!
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-27 08:31
    since you aren't using it in a time sensitive application, you can always debug it at a higher speed and drop it down for the application. Just be sure to scale any delays you may use accordingly.
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-28 01:59
    Thanks Paul, thats a good idea.
Sign In or Register to comment.