Bypassing the Arduino Coding Environment

I would like to use the ATMega168 and the arduino development board Duemilanove, but am interested in programming it through traditional methods, i.e. programming in C and writing to registers etc., instead of using the Arduinio programming envirornment that simplifies this process the coding process.

Is there any literature available that I may look at to do such a thing?


All register addresses are predefined in iomxx0_1.h so you can just straight-up extract them from the ATmel datasheets and name them in the Arduino environment.


You can use AVR Studio 4 and Assembly Language or C. I believe there are ways to use the bootloader but I know an 'in system programmer' such as the AVRISPMKII works. It takes just a few seconds to reload the bootloader if you want to revert back to the Arduino environment.


Great, thanks for the pointers.

A school project requires the use of a microntroller, so I thought I'd use the ATmega on my Arduino board. I don't think my professors would approve of using the Arduino environment. It's powerful in it's simplicity, but there's a lot of insight to be gained by doing things the hard way (that's what I'm telling myself anyways).


The AVRISP is a hardware peripheral that I need to buy, which I'd rather not. ?

Ideally I would like to program in AVR Studio and then upload the program over the same USB connection used when uploading sketches.

There was another thread that dealt with programming the Arduino in other languages:

The Arduino IDE is basically an editor with the ability to invoke the compiler and linkers, and to upload the results to the Arduino.

I don't see that changing to a different IDE, like AVR Studio accomplishes anything.


Thanks for guiding me to that topic. It looks like its possible to bypass the Arduino libraries but still able to upload the code through the Arduino IDE.

I’m looking to use my Arduino board for a school project, and it’d probably be looked down on to call Arduino’s handy functions to accomplish things that are not trivial programming endeavours.

The Arduino libraries provide powerful functionality masked by simplicity. There’s a lot of things going on behind the scenes that I would like to manually program rather than relying on Arduino’s libraries. While I agree it is far easier to use the Arduino, one sacrifices an intimate understanding of how the ATMega functions when using them.

The simplicity comes from user higher level languages, like C, C++, and C#, bot from the IDE. The IDE is, at the interface level, a fancy text editor. The text being edited can be C, assembler, etc. It does not, in and of itself, make programming the Ardiono easier or harder than other IDEs like AVR Studio.

Good luck. Programming the Arduino in a lower level language will give you a much better understanding of the micro-controller and its capabilities than programming in a higher level language.

On the other hand, a lot of effort has gone into those languages and libraries. That level of effort is hard for a single person to replicate.

After further thought, I'm not looking to write code in a lower-level language such as assembly. Rather, I would like to code in C but not invoke the Arduino libraries to do all the dirty work for me.

Would you know where I can find the source code that is executed when calling an Arduino function, such as AnalogRead or DigitalOut?

Programming in assembly and manually manipulating registers is a worthwhile effort, just not something I'm looking to do at this point in time.

Well, now, if you just re-use some elses code, doesn't that defeat the purpose?

In the hardware\cores\arduino directory, there is a file called wiring_analgo.c that contains the analogRead function. Other functions are there, too.

All the sourcecode your after gets installed with the environment. Just snoop around in your install directory (hardware/cores/arduino/ for the analogRead).

And you can still use C or C++ while programming chip registers directly... no need to use assembly.