The Arduino processing language is so easy to use that I find it hard to think of good reasons to use AVR C language anymore. To be fair, I have never use AVR C before. Correct me if I am wrong. Some reasons I can think of;
Reasons for using AVR C
Faster.
Smaller code size.
Easier to debug? For Arduino IDE, seems like the only way to debug is println(). Cannot use breakpoint, watch windows. If AVR C compiler IDEis used, I think the debugging environment is superior.
Reasons for not using AVR C
Arduino developers accomplish in a day what AVR C developers accomplish in a week. I think this reason alone beats all else
Are the reasons raised valid? Did I miss out anything else?
Faster? Don't know about that. It's the same avr-gcc compiler.
I think it is faster because in AVR C, the developer can directly manipulate the registers. So, it should be faster than working using wrapped-around APIs.
lightaiyee:
The Arduino processing language is so easy to use that I find it hard to think of good reasons to use AVR C language anymore.
The Arduino "language" is C with some very useful pre-defined functions, all written in C.
There is nothing stopping you from doing direct register access if speed was a concern. In fact, the source code for all Arduino functions are included in the IDE, so you could see how stuff gets done. The time savings comes from the fact these functions already exist, so you don't have to create something like analogRead() yourself.
Arduino developers accomplish in a day what AVR C developers accomplish in a week. I think this reason alone beats all else
bullshit
this is very subjective and completely dependant on the competence of the particular developer
Also you forgot, or probably didn't know, that Arduino breaks a lot of C++ rules so the code isn't immediantly portable. Somebody who is extremely experienced at real C++ will find it somewhat awkward to program in Arduino.
lightaiyee:
I think it is faster because in AVR C, the developer can directly manipulate the registers. So, it should be faster than working using wrapped-around APIs.
Here I output VGA signals to a monitor:
It is highly timing dependent and in a couple of places I directly access the registers. However it is written in the Arduino IDE.
Arduino breaks a lot of C++ rules ...
What rules? Bear in mind they both use the avr-gcc compiler.
Arduino's IDE implemented automatic function prototype generation, it sort of eliminated the need for header files in certain situations, it's harder to say what is public and what is private using Arduino, for functions that are not a part of a class
This file follows the C++ rules because it hasn't been pre-processed. So if you remove the function prototype for foo you get an error.
You still need to be aware of the way the IDE copies files into the temporary directory (ie. libraries) so you would probably need to put an include for each library into the main sketch. But that is not much different from having to edit a makefile.
It is highly timing dependent and in a couple of places I directly access the registers. However it is written in the Arduino IDE.
Thanks! I had the impression that one limitation of using Arduino IDE is that the developer loses the flexibility to access the registers directly. Now, I know that is wrong. This means that the Arduino code can run just as fast as AVR C because the developer can access the registers directly.