basic stamp vs rabbit

Apr 14, 2004 22 Replies

Hi,



I am looking for a microcontroller with a 32bit architechture. That is I want to be able to do Z = X*X where X's are 16 bits and Z is 32 bits. The basic stamp doesn't do this... the rabbit doesn't seem to either (i could be wrong)... does anyone know of a 32bit microcontroller?



Thanks! juliabean


Hi juliabean,

I don?t think you need a microcontroller with 32 bit architecture but rather a language that supports a 32 bit variable.

I use ATMEL microcontrollers, and there are many languages available. You could use ?C?, ?C++?, Basic, Pascal or Forth. All of these support 32 bit variables.

You could probably find all these languages available for the PIC.

Jay

-------------------------------------------------------------------- "I'm pullin' for you; we're all in this together", Red Green

--------------------------------------------------------------------

The TI MSP430 family has members with a hardware multiply of two 16-bit arguments and a 32-bit result.

formatting link
or touch the search on the TI site for slau049d.pdf.

32bit processor? Then you really want a ARM based chip. Or a Hitachi/Renasas 32 bit processor. A Motorola 68832 would probably work too.

A number of C compilers have floating point libraries for doing this with other 8 and 16 bit MCU's so it really isn't a issue. Unless your wanting to do it in assembler?

You are confusing microcontroller-based products such as the Basic Stamp with microcontrollers.

Any microcontroller can multiply two 16 bit values and get a 32 bit result. That's what the carry bit is for. The calculator in your purse runs on a 4-bit microcontroller.

BTW, you should also look at the BasicX line of products. See

formatting link

Absolutely correct. I use PIC micros with the CCS C compiler that supports 32-bit integers and 32-bit floating point numbers.

+brw

I use a clever programming trick known as "multiprecision arithmetic" in which I can code 16X16 bit multiplies with 32 bit results on an 8-bit processor with no multiply instruction at all, using only adds, shifts and branching instructions, and it runs in a millisecond or so. If you want it a lot faster than that, you probably need a processor with a built-in multiplier and/or a wider bus.

Well, maybe it's not that clever, but it's a standard technique, almost certainly used since the first digital computer. Multiprecision arithmetic can be expanded to whatever number of bits you like, limited by the amount of memory available.

Sounds awfully slow to me. A midrange 20MHz PIC (200ns instructions) would take around 55usec (~270 instructions) for a 16 x 16 -> 32 signed multiply (no hardware multiplier, no microcoded "8051 style" multiply instruction).

An MSP430 with 16 x 16 hardware multiplier will do it in one clock cycle (125nsec).

Best regards, Spehro Pefhany

Actually you can do it with a Basic Stamp too. You can use one of the math coprocessor chips from AWC

formatting link
PAK-I and PAK-II should do this quite nicely.

TI MSP430.... That's pretty slow too, you know the TI DSP 32 bit processors just smoke all the other ones. Let's see at 300 mhz it can do 2 multiplies in one clock cycle or thereabouts. What's that maybe 1.5ns for a 16x16=32? My math isn't working good at those speeds. Heck we haven't even got to the evil 1ghz DSP chip yet either, I always start droolling when I see that one.

formatting link
at 225 MHz, the TMS320C6713C6713B delivers up to 1350 million floating-point operations per second (MFLOPS), 1800 million instructions per second (MIPS), and with dual fixed-/floating-point multipliers up to 450 million multiply-accumulate operations per second (MMACS). Operating at 300 MHz, the TMS320C6713B delivers up to 1800 million floating-point operations per second (MFLOPS), 2400 million instructions per second (MIPS), and with dual fixed-/floating-point multipliers up to 600 million multiply-accumulate operations per second (MMACS).

formatting link
Embedded software/hardware/analog Info for designers:
formatting link

Anyone who is using a Basic Stamp isn't concerned about speed...

Ha! Yes... sometimes I use words that I don't know the meaning of: architecture. I don't know that I need 32bit architecture... but I would like to be able to perform 32bit calculations with ease, and a C compiler if possible.

Basically I want to be able to do Z = X*Y where X,Y are 16bit and Z is

32bit. I don't care about how the hardware does it, I just want to be able to use Z as one variable and not separate it into high-16 and low-16.

Is there a place I can buy these AMTEL controllers in a nice package like the basic stamp?

Thanks! julia

Hi Julia

The rabbits do 32 bit integer math without any problem. They get you easy going. Personally I think that there are not many so trouble free kits out there. I was up and running after 15 minutes.

Markus

So if you write a program for a BS that reads a few switches (push to make button type) and updates an LCD display in response you don't care if the button presses are missed or the response is awful.

Regards Sergio Masci

formatting link
- optimising structured PIC BASIC compiler

Hi Julia,

For Info on AVR check out;

formatting link
There are links to free Basic and ?C? compilers, programming software and much more.

Olimex makes simple programmers and development boards.

formatting link
And here?s the Atmel AVR site.
formatting link

For more Info, do a Google search for "AVR microcontroller". I got nearly

8,000 matches.

Since many of the posts haven't responded directly on the Rabbit's abilities, I'll toss in my (longish) $0.02:

Others' comments on HLL support (e.g. C compilers, FORTH) are quite apt. The Rabbit *does* have a hardware multiplier, and some other opcodes (find leading 1 in word, I think) that speed up math considerably. Some benchmarks are posted at

formatting link
course, benchmarks can be manipulated, and I don't know exactly how they ran them. They post the code + some details at the above-mentioned site, which I take as a good sign.

There is a C compiler for the Rabbit 2000/3000. (Actually 2, one from zworld/rabbit semi, the other from

formatting link
-- which claims to be ANSI compliance.) A good resource is yahoo newsgroup rabbit-semi:
formatting link
Zworld's compiler "Dynamic C" (aka DC) isn't ANSI C, but it's (IMHO) usable, albeit imperfect (the error messages are often unhelpful, to put it kindly.) The default int size in DC is 16 bits, but long int is 32. The rabbit C compiler also has respectable (for an *8* bit cpu) single-precision floating point, see benchmark site above. Rabbit CPUs have a 16 bit logical/20 bit physical address setup (similar to the Z180) Most data +interrupt code can only be in the first 64K, but this is still bigger than the PICs I've looked at (am I out of date on PICs?)

Another poiint in the rabbit's favor are the many *SOURCE CODE* libraries and examples that come with DC. The on-chip peripherals (RTclock, counters, serial ports, etc.) are fairly-well supported in the libraries and examples. A TCP/IP stack comes with starter kits that include Ethernet (not part of the lowest cost kit, sadly.) The

3000 has encoder interfaces and PWM, which are handy for motor control. IMHO, the rabbit boards (and the starter kits) are pretty good bang/$ (though more than entry-level PIC kits, from what I've seen.) Depends on your budget, and what level of performance and expandability you want. IMHO, a Zworld starter kit like the jackrabbit, may well be worth the extra $ because of the software and the expandability (compared to a PIC.) There are many other choices. So I'd listen to what others say about the AVR, TI (430?) etc. But think hard about your software: do you want to code strictly in assembly, or would you rather have C/FORTH/pick-another-HLL available where utmost speed isn't required? I value my time and my hair, so I want the option of a HLL. (Plz don't start another flame-war about the merits/demerits of FORTH, or whether it's an HLL. It's *useful* in resource-limited apps.)

Having said all this, there are some 32-bit alternatives, that I'm pondering for heavier comptational lifting. E.g. the ARM7-based offerings from Atmel and Philips (LPC2000)

HTH,

Larry

Where can I find a description of this technique?

---kjl

Not ATMEL, but this might interest you. See our NMI TiniARM(TM). Here is a more modern solution which has a 32-bit architecture and a 60 MHz operating speed, based on the ARM 7 processor, with a free GCC compiler. So you can have native 32 x 32 multiplies giving 64 results. 64K of RAM

128K Flash. It's just a bit larger than a Stamp, but with many times more features, about the same cost. If you want native 16 x 16 multiples for 32, we have that in a similar package great for robotics and motor control in the TiniPod(TM), but only a Small C compiler for it (plus other non-C languages). Follow the link in my sig for more info.

I was thinking of a 1 MHz 6502 on which I first did this sort of thing. It sure seemed fast in 1977.

There are lots of them.

ARM and Motorola ColdFire are some of the major ones. Here's a typical 32-bit ARM board, for $99 or so.

formatting link
John Nagle

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required