

What programming language to use for microcontrollers - drallison

What programming language would you use for a microcontroller with very limited processor and memory resources.  Would you write in assembler?  in FORTH? or what?  What microcontroller would you use?
======
dkersten
Depends on the microcontroller and the task. Most microcotnrollers these days
support C, so unless there is a specific requirement that cannot be solved in
C (for example, if it is not fast or small enough), then assembly.

If the microcontroller does not have a C compiler or has other high level
languages, then obviously you would want to evaluate them to see what the best
option is for your project. The same goes for the decision of which
microcontroller to use. It depends on what you need: unit cost, performance,
power consumption, available development
tools/compilers/languages/documentation, available I/O pines etc etc.

As for what microcontroller I'd use - if I wanted to do somehting simple as
inexpensively as possible and don't require high performance or many I/O pins,
I would use a PIC [1] microcontroller, as they are well known (therefore are
reliable, have tools and documentation), extremely cheap and low power.

If I need something more powerful, need more I/O pins, need 32bit integer
support (or generally can deal witht he fact that they cost maybe 15x the
amount of a PIC), I would use a Parallax Propeller [2] microcontroller. Its a
great architecture, is easy to program (in its own interpreted high level
language, Spin, in assembly, in C and in Forth - possibly other languages too
now), has good documentation, sample code and an active community and is quite
powerful. Its funky 8 core interrupt-free architecture is interesting too.

If I needed something even more powerful than a microcontroller, I'd use an
ARM Cortex A8 [3] based processor.

If you need support for peripherals or otherwise want a more complete package
than a microcontroller or processor, I'd use either a Propeller-based
Chameleon [4] or a Cortex A8 based BeagleBoard [5].

[1] PIC - <http://en.wikipedia.org/wiki/PIC_microcontroller>

[2] Parallax Propeller - <http://www.parallax.com/propeller/>

[3] ARM Cortex A8 -
[http://www.arm.com/products/processors/cortex-a/cortex-a8.ph...](http://www.arm.com/products/processors/cortex-a/cortex-a8.php)

[4] Chameleon - two models, 16bit PIC & Propeller:
<http://www.xgamestation.com/view_product.php?id=52> and 8bit AVR & Propeller:
<http://www.xgamestation.com/view_product.php?id=51>

[5] BeagleBoard - <http://beagleboard.org/>

------
Chico
Hi,

A while ago I bought 'Arduino' and 'PIC', they both provided a microcontroller
and the cord that goes from your PC to the microcontroller so you can update
the code in the chip etc. I tinkered a little bit with Arduino and you can
build quite a few little well working things such as robots.

So, I would use Arduino. The coding part is a lot like C, which is good even
for a MC with limited memory resources and processor.

I'm still a beginner in that area though.

