Shop OBEX P1 Docs P2 Docs Learn Events
Switching to SX chips — Parallax Forums

Switching to SX chips

achilles03achilles03 Posts: 247
edited 2004-11-30 17:09 in General Discussion
I was considering switching over to SX chips from the BS2 series.· I had two questions though.

1.· Is the SX chip, compiled from a BASIC program, that much faster than a similar BASIC program running on a BS2p?

2.· I heard the SX chip and some PICS were drop in replacements for each other.· Is that true?· If so, could you program a PIC with·the SX starter/development kit?

Thanks in advance!
Dave

Comments

  • PJMontyPJMonty Posts: 983
    edited 2004-11-27 18:22
    Dave,

    I think the SX running a compiled BASIC program is approximately one bazillion times faster. All right, I may be exaggerating, but it's is way, way faster than an interpreted BASIC program running on a BS2p. In fact, I think Bean or Jon should (if they haven't already) run some sort of benchmark to see just how much faster it is.

    As for being a replacement, I know that the SX was designed to be code compatible with some models of PICs, but I don't think they were pin for pin compatible, just code compatible. Anyone have the exact details on this?
      Thanks, PeterM
  • BeanBean Posts: 8,129
    edited 2004-11-28 04:10
    Dave,

    The SX is much faster, but there are some trade-offs. The SX chip doesn't have EEPROM so your running program cannot store any data that is retained when the power is off. Also SX/B doesn't have WORD variables, or some of the more advanced functions (like one-wire stuff).

    On the plus side you get, incredible speed (I don't like to give numbers because it VERY much depends on the code), you also get TRUE interrupts.

    As for being PIC compabible I think it is Pin-For-Pin compabible with one of the very old PIC processors 12C54 or something like that.

    Bean.
  • achilles03achilles03 Posts: 247
    edited 2004-11-28 15:20
    Thanks for the info!

    However, if it doesn't have an eeprom, does that mean you have to program it everytime you power up?

    Secondly, how hard is it to incorporate a peripheral eeprom for datalogging for the SX?

    Thanks in advance!
    Dave
  • BeanBean Posts: 8,129
    edited 2004-11-28 19:35
    No you only have to program it once. It has flash memory that can be changed with the SX-Key, but the SX cannot change it's own flash memory.

    It is not hard at all to connect an external eeprom.

    Bean.
  • achilles03achilles03 Posts: 247
    edited 2004-11-29 13:44
    Bean,
    Ok, I think I got what you're saying. I did some reading, and basically what it boils down to is that the BS "effectively" has a 2-way von-Neumann memory setup, which is what I'm used to....correct? Does the SX have a Harvard setup, and the data side of the memory is lost on power-down? Or does it not have any data memory at all?

    Thanks again for the help,
    Dave
  • Paul BakerPaul Baker Posts: 6,351
    edited 2004-11-29 15:50
    The SX is a harvard architecture, partly because program word size is 12 bits.·All SX's·with 28 pins or below have 16 bytes of global·data memory and 128 bytes·subdivided into 8 banks of 16 bytes, of the global memory 8 bytes are special purpose (PC, Status, etc) and 8 are general purpose. The SX 48/52 has the same 16 bytes of global memory and 16 banks of 16 bytes for 256 bytes of banked registers.·All on-board data memory is volatile, so if you need non-volatility for your data you'll have to add an external eeprom.

    -Paul
  • BeanBean Posts: 8,129
    edited 2004-11-29 15:50
    Yes the SX is a havard architecture, at power down all RAM (variables) are lost, but the program remains.

    The SX18-28 has 136 bytes of RAM and the SX48-52 has 262 bytes of RAM.

    Bean.
  • BeanBean Posts: 8,129
    edited 2004-11-29 15:55
    The thing that thows alot of people with the Harvard memory structure is that you can have a program instruction at address $000 AND have a variable at location $000 and they are totally seperate.

    ORG $000
    JMP Start ' This is at location $000 in program space

    ORG $000
    MyVar DS 1 ' This is at location $000 in RAM space


    Bean.
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-29 18:29
    And, for speed:
    The BS2 runs at about 10,000 IPS (100 uS per instruction, roughly).

    The SX28 runs at 50,000,000 IPS (20 nSec per instruction, roughly).

    Note the BS2 is running 'PBasic' instructions, while the SX28 is running 'Assembly' instructions. The SX/B lets you program in a simplified 'PBasic', where each keyword is expanded into multiple SX28 assembly instructions, so your throughput may drop some there.

    Still 50 Meg divided by 10 K is 5,000 times faster. Quite a jump in performance, I'd say. And an external 24LC256 EEPROM doesn't cost that much.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2004-11-30 17:09
    A quick comment on Bean's most recent post, I typically use 3 hexidecimal digits for program and 2 for data space, that way I know $FE is a data location and $0FE is a program location, I don't claim inventing this, I'm pretty sure I picked it up from somewhere (perhaps Gunther's book).
Sign In or Register to comment.