Does ImageCraft create a CPU frequency define?
I would suspect this is a simple question but I am 开发者_如何学Gonot able to find an answer anywhere.
Does the ImageCraft compiler create a cpu frequency define? I know gcc-avr does in the form F_CPU but I have not been able to find a similar define for iccavr.
I had a look at the online manual and found only a few predefined macros:
http://www.imagecraft.com/help/iccavr/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ICCAVRHelp&file=5A-CPreprocessor2.html
It seems that a symbol for CPU frequency does not exist.
By the way, unless you can specify this somewhere in the Build options (i don't know because i've used this compiler a long time ago), the compiler doesn't really know what the avr frequency is. The microcontroller can run at different frequencies and oscillators (RC/XTAL) and the compiler does not really care because the machine code it generates will run in any case, it's the programmer responsability to take care of that.
But one thing that will come handy is the CPU type, for example if you need to make some code work on many CPUs where some registers have different names or bits meaning then you can #ifdef the appropriate symbol, like ATMega128 and handle the CPU-specific code.
精彩评论