November 22, 2024, 06:51:14 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


DC-16 and ULN2803/ULN2003 increasing current capacity

Started by jukingeo, March 12, 2008, 10:40:06 AM

Previous topic - Next topic

jukingeo

Quote from: JonnyMac on March 23, 2008, 06:21:08 PM
It's not apples and apples.  The Prop-SX runs machine code; the Prop-2 runs an interpreter which has to fetch instructions from an external EEPROM.  I think it's safe to say that the Prop-SX is better than 1000 times faster than the Prop-2; using the available bandwidth wisely one can create true multi-tasking programs.

1000 times, huh?   Yeah, I think this would be more suited for my pinball project.  I don't think I should even try it with the Prop-2.  The Prop-2 is just too slow.

Jon, is the Prop SX the fastest variant of the Basic Stamp?  Is the SX even considered part of the Basic Stamp series or is it an entirely different animal?

Thanx,
Geo

JonnyMac

The SX is not a BASIC Stamp; in fact, all BASIC Stamps except the stock BS1 and BS2 (what we use in the Prop-1 and Prop-2) use the SX chip as the core that runs the PBASIC interpreter.  To give you an idea of the speed difference, let's say we have this line of code that is valid in PBASIC and SX/B:

  Led = IsOn

(We'll assume Led is defined as an output and IsOn is a constant value of 1).

In the BS2 that instruction will take 187 microseconds (0.000187) according to my 'scope.  In SX/B this instruction will compile to a single line of machine code (SETB Led) that runs straight out of the processors.  At 50 MHz, a single instruction takes 20 nanoseconds (0.00000002) -- this is a factor of 9350x speed improvement.  Now, this is just one instruction and not all will have the same speed factor improvement, though I believe it is safe to say that my 1000x improvement is probably very conservative.

As Sean points out, learning to harness all of this power can take a little time, but to me it's worth it.  Have a look at any of our accessory products.  The common denominator?  An SX chip as the core processor, and all of them are programmed in SX/B.  Some of our simple boards, the RC-4 for example, are pure high-level SX/B and don't use any assembly in the source program.  The FC-4 is the most complicated of the group as it uses "background" processes (written in assembly for efficiency) for receiving and sending serial data, as well as monitoring the zero-cross of the AC line so that the triacs can be phase switched appropriately.

I've written several articles on programming the SX in my Nuts & Volts column; they are available for download at www.parallax.com.
Jon McPhalen
EFX-TEK Hollywood Office