I see that on the official Arduino website, the reference page contains the functions and vales you would use specified to the Arduino compiler.


What would you use instead, if you are working with Atmel Studio?

  • 2
    \$\begingroup\$ The language is the same. The available symbols are different. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 7 '13 at 4:12
  • \$\begingroup\$ Yes, i agree with Ignacio. i think you should learn the C language. \$\endgroup\$ – Roh Oct 7 '13 at 4:24
  • 4
    \$\begingroup\$ This question appears to be off-topic because it is not about electronic design. \$\endgroup\$ – Leon Heller Oct 7 '13 at 8:07

The language is the same. You can either use Arduino IDE or Atmel Studio (http://www.engblaze.com/tutorial-using-atmel-studio-6-with-arduino-projects/) The Arduino libary is more of a wrapper to make it easy to do things, like digitalWrite, which you do not have by default in Atmel Studio (or you can define it yourself). With Atmel Studio you would flip a bit in a register to turn on the digital port. Now for the AtMega2560 and the AtMega328 these registers are different. So you can't just compile the same source and expect it to run on both MCU's when using the registers. Again, of course, you can specify a compiler flag that you are now using AtMega2560 or AtMega328 and define the registers in your own digitalWrite function accordingly, and that is exactly what the Arduino library is doing for you.

You can choose to use the Arduino Library while working in Atmel Studio, or you can choose to use native register operations toggling bits and so forth using Arduino IDE. To get Atmel Studio running with Arduino library and AVR dude requires some setup, but it might be worth it, depending on how large your code project is. Atmel Studio is based on Microsofts Visual Studio with code suggestion/completion and intellisense which could drastically speed up the development of the code.


Something that's available when using Atmel Studio is the Atmel Software Framework that gives some hardware abstraction like the Arduino libraries. It allows the same code (within reason) to run across multiple Atmel platforms including the AVR and their ARM based products. I've only just started using it for a new project but here's an example of some code:

ioport_set_pin_dir(RADIO_RX, IOPORT_DIR_INPUT);
data_in = ioport_get_pin_level(RADIO_RX);

It appears to have very good support for on-chip peripherals such as USB, SPI, USART etc. across their range. It also has some support for external peripherals such as an SD card with a FAT software stack and some LCDs although in that regard it seems limited pretty much to the devices they use on their development boards.

While the language is the same one thing that might add to the learning curve is you'll probably find less example code and high-level libraries using ASF, for instance that interface to a particular RF transceiver or GPS receiver.

Often though those sorts of libraries that attempt to hide the hardware layer too much can lead to unexpected problems when you don't know the underlying operation and how things will work together. From that point of view I think ASF gives a good level of abstraction to make things easier to read and port between Atmel devices while still giving good control over the hardware.


Not the answer you're looking for? Browse other questions tagged or ask your own question.