PIC / Basic Stamp comparison

I'm thinking of switching over to PICs from the BS2. Take a PIC with a basic compiler, a 5V regulator, and an external eeprom... is there any major difference between that and a basic stamp 2? (other than speed, price, and memory capacity?)

Thanks, Dave

Reply to
David Harper
Loading thread data ...

It looks like the BS2 IS a PIC, and external EEPROM and a regulator.

So I don't really see ANY difference between the two situations.

Reply to
Alan Kilian

The PIC is considerably cheaper, and if you use a compiler, considerably faster. You can also use a higher end PIC and get MANY more features (true A/D, I2C, SPI, etc), more I/O lines and much more speed than would be the case with a Stamp. The two situations are actually quite different. Moreover, the stamp is an interpreter -- but you can get a BASIC compiler for the PIC that is largely compatible with Parallax's variant of BASIC, but produces fully compiled code. C (very much non-ansi) compilers are also available from at least three sources. All of these will support inline assembler as well.

The downside is that you will need a compiler and a programmer, but these aren't too hard to come by. If you use a PIC that supports writing to its own flash program memory area (for example the 16F874/6/7), you can use a bootloader and, after burning the bootloader with your programmer, you can doenload code to the PIC via an RS-232 connection just like the Stamp -- no programmer necessary after burning in the bootloader. I do this pretty routinely for my robotics projects, and it works like a champ. I can even upgrade the firmware wirelessly.

Obviously, you also have to be comfortable with building the circuit, but for most of the common parts, this is pretty trivial.

Hope that helps -- tAfkaks

Reply to
The Artist Formerly Known as K

But that's not what the original poster was asking about.

He asked about taking a PIC "with a basic compiler", an external EEPROM and a 5 Volt regulator.

Maybe I misunderstood.

Of course, using a PIC with a C compiler and programming tool will be faster than a BASIC Stamp. There you are completely correct.

It's also a bazillion times more complicated than a BASIC Stamp.

Reply to
Alan Kilian

also have a read through:

formatting link
Dave.

This may give you a few leads.

Don...

Reply to
Don McKenzie

Thanks for the input guys. The motivation behind my question is that I'm thinking of switching to PICs from the BS2.

I'm mainly wondering if there are any disadvantages to doing that, other than having to buy a programmer and a compiler...?

Thanks, Dave

Reply to
David Harper

You do NOT NEED to buy a programmer or a compiler.

Several of the PICs can write to their own program memory and once they have been programmed with a BOOTLOADER you no longer need a programmer. You can buy PICs which have been preprogrammed with a bootloader for a small free from places like glitchbuster.com and voti.nl Depending on the bootloader you may need an RS232 buffer such as the MAX232 (this is available from the same place as the PIC).

Two good PICs to start with are the 16F88 and the 16F876A. The 16F88 has a built-in oscillator which you can use. This eliminates the need for an external crystal and capacitors (which might cause a newbie using solderless breadboard a bit of trouble initially) so this is a plus for a newbie. The

16F876A of the other hand has twice the code space of the 16F88 and a lot more I/O pins. The bootloader for the 16F88 is much more complicated than for the 16F876A so it eats much more code space. I have yet to see a good free one. There is a good commercial one which comes with the XCSB Standard and Pro compilers.

The biggest problem with going the bootloader route is that you cannot change the config bits of the PIC so you need to specify a reasonable config for the supplier to burn into the PIC before he sends it to you (you can change the config yourself if you ever get yourself a programmer later on). A good programmer that I would recommend is the Wisp628 from voti.nl. This is cheap and works well. It uses a serial interface so you will need a serial port on your PC or a USB to serial converter.

Compilers come in all forms: good, bad and ugly :-) Most compilers are available in a LITE or DEMO version. These are generally free to use for non-commercial purposes and have some restrictions on the code they will generate. The Proton+ compiler for example will only accept 50 source statements while the XCSB lite compiler will only generate a maximum of 1900 machine code instructions (not really an issue since it generates really optimised code - the 4 servo / LCD demo shown on the circuits page actually fits in this space).

Conclusion: You could be up and running with PICs for less than $15 including shipping and handling. Once you get your feet wet you will get a feel for what you are missing and which way you want to procead.

Regards Sergio Masci

formatting link
- optimising PIC compiler FREE for personal non-commercial use

Reply to
Sergio Masci

By far, there is. Maybe 10X or 100X in speed, depending upon the app, and many times in available cpu RAM. The B.stamp uses interpreted tokens read from eeprom, which slows it down to 2-10K instructions/sec, even though the instructions execute as assembled code once read/interpreted. With a compiler and PIC, the instructions do not have to be read from eeprom or interpreted. With B.stamp you're limited to only 30 or so available RAM addresses, with PIC/compiler you have almost the entire RAM space of the cpu at your call.

Reply to
dan michaels

I'd say a bazillion might be a tad high.

Actually, if you had a bootloader already loaded on the pic and didn't have to deal with getting a programmer to burn it in in the first place, it's only slightly more complicated than a Stamp. Really, the only extra stuff is that you have to add are the required external components for the PIC.

If the OP is doing any kind of project that involves circuitry external to the stamp, he can probably handle this, although I wouldn't recommend this approach to a complete newbie -- the stamp is probably a better teaching tool. Also, there don't seem to be any sources for PIC's preloaded with bootloaders (maybe my next project in my non-existent spare time).

Programming is just a matter of compiling and downloading. As I mentioned before (or maybe not), the PicBasic compiler is pretty much directly compatible with Parallax's basic variant.

It's also nice for those of us that insist on not using polarized connectors; replacement cost for fried parts isn't too onerous.

Cheers -- taFkaks

Reply to
The Artist Formerly Known as K

Barebones PIC with bootloader ($8.00):

Complete controller kit ($30.00):

Free BASIC compiler (OK, shameless plug):

Reply to
kyle york

Whoops -- and a complete google search even turns up a couple more. My bad.

Reply to
The Artist Formerly Known as K

And the rest?

More like 100X to 1000X difference in speed :-)

Something that many people fail to realise is that interpreters often need to execute several high level instructions (BASIC tokens) to execute one BASIC statement.

e.g. A = B + C - D

could actually be inplemented at LET = A B + A C - A D

here "LET", "=", "+" and "-" are seperate instructions that need to be executed by the BASIC interpreter. 10K instructions / second starts to look really slow when you look at it from this perspective.

Regards Sergio Masci

formatting link
- optimising PIC compiler FREE for personal non-commercial use

Reply to
Sergio Masci

Like the man said, speed, price, and memory capacity.

Speed: compiler vs. interpreter. Price: Pay for parts instead of parts+parallax profit. Memory capacity: he can use a PIC with more memory.

The idea of using a EEPROM is not a good one. Quite suitable for an interpreted program, not suitable for a compiled program.

speed, price, and memory capacity

Reply to
Guy Macon

What exactly do you mean when you say using an EEPROM isn't a good idea? I assume you mean for things not related to datalogging...?

Dave

Reply to
dave.harper

...serial...

I mean that it's a good match for a basic stamp BASIC program, but not for a compiled program. With a basic stamp, the serial EEPROM is the only thing you need to be able to modift - it holds program and any saved data. With a PIC and a compiler it is no longer feasable to keep everything in serial memory. You need to be able to load your executable in regular memory.

Reply to
Guy Macon

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.