Shop OBEX P1 Docs P2 Docs Learn Events
Is the sx good enough? — Parallax Forums

Is the sx good enough?

P!-RoP!-Ro Posts: 1,189
edited 2008-08-24 05:42 in General Discussion
I want to make a project that is capable of reading an accelerometer and a compass module and send them wirelessly to another sx while also maintaining around 7+ pushbuttons and leds. At the receiving end of these signals I want the other sx to use these signals and the signal from another compass to make two servos position themselves accurately. It will also control 2 motors. Is the sx capable of this? I know I can do it with the propeller, but I want to make a couple of these and I figure it will shave off $20+ for each one I make (no eeprom, no 3.3v regulator, and it's a cheaper microcontroller). Can it do it?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Pi Guy

Post Edited (I LIKE PI) : 8/15/2008 9:34:48 PM GMT

Comments

  • ZootZoot Posts: 2,227
    edited 2008-08-15 22:45
    Sounds like that should be perfectly doable with a pair of SXes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-16 02:05
    How easy is it for them to comunicate, and can they share some parts like the oscilator? Another thing is size might be an issue.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • ZootZoot Posts: 2,227
    edited 2008-08-16 03:09
    Not sure about sharing an oscillator/crystal, I've seen a few circuits here and there, but others here can probably speak to that better than I can, but would you need two? I thought the micros were going to communicate wirelessly. Certainly what you are describing could be done on a single SX, so would need more than one on each installation. (In my earlier post, by pair, I meant one on either side of your wireless setup).

    In any case, you can get high speed comm. between (wired) SXes quite easily (serial, esp. and there are lots of examples including some fairly high baud rate VPs).

    Size -- surface mount. They are tiny. If you need to use DIP, then 28pins can be bit a long, but it's not *too* bad size-wise, esp. if you forgo the socket.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 8/16/2008 3:15:09 AM GMT
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-16 21:34
    If I just used one sx, how quickly would it still be able to transmit my data? I would like almost instant feedback to the second sx so there is no lag between the movement of the board (with accelerometer and compass) and the two servos on the other end.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • ZootZoot Posts: 2,227
    edited 2008-08-16 23:38
    I would think at 20MHZ or 50MHZ the SX will be significantly faster than your wireless link.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-16 23:46
    Ok, thanks. I guess I'll have to order that protoboard then.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-08-17 00:36
    Have a look at the demo code -- wrote it for fun while watching the Olympics. It shows you how to measure the accelerometer pulses (assuming a high-going pulse from each axis) and transmit characters in the "background." The serial output is 38.4K which is reasonably swift. Since accelerometer measurement and serial happens behind the scenes you can use the foreground for other processing.

    If you do a forum search you'll see that I've posted a bunch of SX code that shows how to receive serial data and maintain servos at the same time.

    [noparse][[/noparse]Edit] Program updated and re-posted below.

    Post Edited (JonnyMac) : 8/17/2008 10:12:21 PM GMT
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-17 21:42
    Thanks Jon. Is there a difference in programming the 48 vs the 28 pin SXs? I was just wondering when looking at the protoboards.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-08-17 22:06
    If you're using SX/B there is a subtle difference; the SX48 uses BANK $10 for globals and the SX28 uses BANK $00 -- if you're using assembly, like I do in the example, you need to account for that. I've updated the demo program with a constant called __DEFAULT (this is pre-defined in SX/B 2.0) that will let the program migrate easily between the SX28 and the SX48.

    Another thing about using the SX48 is that the two counter/timers can be used as set-and-forget servo controllers (see the help file for code). You said you want to control two servos, so you're in luck.

    Post Edited (JonnyMac) : 8/17/2008 10:11:50 PM GMT
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-18 05:18
    Great! I'm getting excited already. I've got some more questions for you though (sorry if you're getting tired of them).

    1. From my small experience with the propeller, I know you can work times off of clock counts and you can also count times even while instructions are being made by counting clock ticks. can you do the same thing or something similar when using the SX?

    2. What exactly changes when you use different oscilators? Does it change the speed of the processor, or just the speed of any delays?

    3. What is the difference between programming it in sx-b vs assemly? Is one faster than the other? Or is it just a matter of preference? I don't want to waist my time learning sx-b when assembly is going to be much better and much less restrictive.

    Thanks for your help, and if I don't answer for a while it's because I'll be gone for a few days. Again, thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • RS_JimRS_Jim Posts: 1,771
    edited 2008-08-24 05:42
    Th Pi Guy,
    Yes, changing the Xtal Frequency changes the speed of the Processor. The higher the frequency of the XTAL the faster the processor is running. SXB actually compiles to assembly so it runs at the same speed. You can sometimes optimize the assembly code after it is compiled so that it runs with fewer steps, but it is really pretty effecient. Some things like serial IO are best written in assembly, but there are several threads on the forum that have serial data I/O that runs in assembly under interupts.
    Radio Shack Jim
Sign In or Register to comment.