View Full Version : Will my BS2 Stamp work for prototyping an automotive ignition circuit?

Dan M
04-28-2006, 10:14 PM
Hello, I'm new to microcontrollers and I just picked up a Basic Stamp kit from radioshack. I bought it to interface with a GM 7 pin HEI module (actually 2 of them).

I know the stamp can send and recieve the signals I need, but I don't know if it can do it fast enough. Here's what has to happen:

sense trigger signal from pickup coil one (this is already a TTL logic level)
sense trigger signal from pickup coil two
calculate miliseconds between them
do a table lookup to determine how long to delay the next event
send TTL low to HEI module one (based on table lookup)
sense trigger signal from pickup coil one and calculate miliseconds between the previous signal
calculate miliseconds between them
do a table lookup to determine how long to delay the next event
send ttl low to HEI module two

lather, rinse, repeat http://forums.parallax.com/images/smilies/smile.gif

I have maybe 2-6 milliseconds to work with at maximum RPM (I think, I haven't measured this out yet)

Eventually there will be a third input, a vaccum (MAP) sensor that gets included in the table lookup portion.

Can my basic stamp handle prototyping something like this?



04-28-2006, 10:20 PM
Not really.

This particular application has a 'hard' real-time goal. The BS2 takes about 500 uSec per instruction executed. So you could execute MAYBE 12 instructions in your 6 millisecond time window.

If you were really-really lucky, this application MIGHT be do-able. But you're operating on the hairy edge of what the BS2 is capable of.

On the other hand, an SX based solution should work fine.

Dan M
04-28-2006, 10:58 PM
oh...bummer. The SX solution, I've seen that advertised on the main parallax site. Is that something user friendly to program like the stamp?


PJ Allen
04-28-2006, 11:04 PM
The BS2p is the fastest -- 12,000 instructions / sec (84 usec / instr.)

Yes? No?

Dan M
04-28-2006, 11:23 PM
You know, I could just slow the rpms down in the test phase and do development that way.

How hard would it be to move my code to the SX chip?


PJ Allen
04-29-2006, 12:19 AM
SX isn't STAMPing, it's not PBASIC, it's pretty much different.

Chris Savage
04-29-2006, 02:12 AM
PJ Allen said...
The BS2p is the fastest -- 12,000 instructions / sec (84 usec / instr.)
Yes? No?
BS2px is fastest...19,000 instructions/second.

Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

PJ Allen
04-29-2006, 02:50 AM
Well, sink me. http://forums.parallax.com/images/smilies/blush.gif

19,000 -- OK, that's 53 usec / instruction, that's almost 19 in 1msec.

Is that enough for Dan M's project? Over to you, Dan M.

Dan M
04-29-2006, 04:35 AM
well I need to read and write to the control lines a total of 4 times in 5 mSecs - but at that speed I don't need to do a table lookup because I'm past a threshold - which happens when the duration between pulses is 6 mSecs.

So basically at my highest rpm point with the table lookup I'll be doing this:

time pulse 2 relative to pulse 1
determine that it is within range to do the needed table lookup
read in from map sensor
do table lookup
begin the ouput pulse and hold it until x amount of time passes (the time I looked up in the table)

Now I don't know what the definition of an instruction is for the stamp - is it something like a table lookup or a math function? sounds like with 1/2 mSec per instruction I probably can't do this. It'll still give me something to play with for a while.

I was also wondering if this is the type of application that would benefit from interrupts?