How close to C is Arduino (new user)

Hello, Hey my first post :slight_smile: I’ve just come across Arduino I want to learn C and wondered if Arduino is a good place to start ?. I 've looked at many AVR’s & PIC chip’s projects, I would like to learn ‘pure’ C not a version that may just going to confuse me in the future if I decide to use say an AVR using some other C compilier.


Arduino code is C, with some small usage of C++ and a couple of small preprocessing steps. The Arduino environment attempts to automatically generate prototype of your functions (i.e. a one line header that defines the type of its arguments and return values). It also adds an #include statement to the top of your sketch (to provide the core Arduino functions). Other than that, your code goes straight to the C/C++ compiler.

GREAT ! Thanks for that, so code I make for Arduino would tranfer to another AVR or PIC ?


Not really. The Arduino environment compiles for a AtMega168 chip. Even though C is supposed to be portable (and the language is) the libraries (at least for microcontrollers) are not.

Even is you used pure C (or C++) and the gcc compiler you would need to make changes (more or less depending upon the chips) when you switched between individual AVR chips. Code that doesn’t interact with the hardware can be very portable. Code that interacts with the hardware (most embedded code) is not really very portable.

Ah ok, So it would be more or less transferable with changes the libraries for each AVR/PIC but the basics are ‘pure’ C/C++. The is a LOT of languages out there pictorial,basic etc but I feel C is a good start for me so I can transfer my learnt C to other chips/devices or even PC’s ! I have a strong electronics background (I’m a radio ham) I think this thread will help a lot of people !

Your actual program’s code should work on different processors.
Its just the definitions which say Pin 1 is this pin on the chip stuff which changes.

Hmm. A set of arduino-compatible libraries for one of the popular PIC compilers would be an interesting project, and probably not too hard, either.

Yea, that would be awesome. And probably not too hard to integrate into the IDE either.

What about support for the new ARM Cortex-M3 processors? There is a GNU toolchain available and these MCUs are cheap (32-bit at 8-bit price). I think it is way more advanced than PIC, for probably the same effort. With PIC, we are just moving from 8-bit to 8-bit, no cost advantage. If anyone is interested, there are several companies manufacturing Cortex-M3 MCUs, like ST micro and luminary micro. Luminary micro introduced the first 32-bit ARM Cortex-M3 for under a buck (yes, 1 USD) (in large quantities, of course).

Another advantage is that the luminary micro cortex-m3 ARM MCU has the bootloader pre-loaded with a flash programmer implemented @ software level.

If you are interested, there is more information here:

And I already have the name for the new ARM based Arduino: ARMduino.

And I already have the name for the new ARM based Arduino: ARMduino.

I’d kill for a ARM. You can get Linux running under them. :smiley:

An Armduino would be great, especially since putting together the gnu development environment appears to be a bit complicated. But I was talking about a simple PIC library, so that once you had developed and debugged a sketch using the standard AVR arduino, you could compile and load it into a PIC using tools OTHER that the arduino SW environment. This is “just” a matter of implementing things like “millis()” and “digitalWrite()” and so on for a PIC, which is a much smaller task than making the whole environment PIC-compatible. A sort of source-level compatibility hack, rather than a true arduino “port.” (IMO, the PIC doesn’t really have a part at the price/performance/memory “sweet spot” occupied by the mega168, but it has other chips that could be used IF the code fits…)

Hmmm, an ARMduino running linux… interesting.

I know it is a lot of effort making Arduino software “platform independent”, but I think it is possible (adding an abstraction layer). And once you do it for one additional platform, the rest should be easier to add.

So the combination we need is ARMduino + Arduino IDE++

An Armduino would be great, especially since putting together the gnu development environment appears to be a bit complicated.

Code Sourcery has a light version of the GNU toolchain that is freely available. It doesn’t have the Eclipse IDE, but we don’t need it for Arduino IDE, as the action goes at the command line mode.

Westfw, Armduino or not, if you read about Cortex-M3 you will love it! They even have an evaluation board with one of their 64KB version, OLED display, pot, JTAG debugger, USB connectivity and limited editions of Keil or other development tools (the Code Sourcery version is not good as it offers a time limited release, instead of the code size limited of the other 2 tool vendors)… all for $49 in Digikey (726-1044-ND). It comes programmed with a video game that uses the OLED display and the pot. Or the Ethernet version for $69 (726-1054-ND).

I didn’t have much time to play with it, but looks very promising.

Just sharing my entusiasm for a new toy.

I’m somewhat familiar with the Luminary parts, and have one of the $49 development boards. I did some work trying to do a “hobbyist” protoboard (sorta like an arduino without any software) for the lm3S10x chips, since it was the first ARM in even a vaguely hobbyist-friendly package. But you run into issues that make it less than ideal for that sort of application pretty quickly - there are only 18 IOs (less if you want to preserve JTAG functions) and no A-D converters on that chip, the current drive is weak (8mA per pin max), the voltage requirements (3.3V) are annoyingly incompatible with common stuff. While there’s gcc for ARM, the M3 changes haven’t been re-integrated at source-forge, so you’re stuck with code-sorcery or a commercial compiler. In the end, it looked a lot more useful to buy one of the Olimex or Futurelec pre-made boards with NXP chips (but what good is a $3 micro if you have to be able to buy a $30 board to use it at all. This is one of the nice things about arduino - you have the nice simple-to-use development board, but you can easily re-host the chips to other environments.) Things have improved some since then (the $49 development boards are a lot better than the $300 versions that they were first offering, and perhaps I should take another look. I plan to spend a day at the ARM developers conference next week; checking out what’s new and all…

Yes, the lm3S10x chips are very limited in capabilities, and I think luminary micro only released them to prove the point of an ARM under $1. For $49 I got the LM3s811 evaluation kit and right now I am testing the $69 lm3s6965 ethernet board (it comes with ethernet, micro-sd port, larger OLED display… a lot of features for $69.

After playing with it for a couple of days, I agree that is is not a platform for beginners, and if you don’t use the free version of the development tools, the cost of buying a commercial license is astronomicaly expensive (for hobbyist standards).

Please, post a feedback of your visit to the ARM conference!