Datasheet

Get_Fosc_kHz
CODE OPTIMIZATION
Optimizer has been added to extend the compiler usability, cut down the amount of code gener-
ated and speed-up its execution. The main features are:
Constant folding
All expressions that can be evaluated in the compile time (i.e. are constant) are being replaced
by their results. (3 + 5 -> 8);
Constant propagation
When a constant value is being assigned to a certain variable, the compiler recognizes this and
replaces the use of the variable by constant in the code that follows, as long as the value of a vari-
able remains unchanged.
Copy propagation
The compiler recognizes that two variables have the same value and eliminates one of them fur-
ther in the code.
Value numbering
The compiler "recognizes" if two expressions yield the same result and can therefore eliminate
the entire computation for one of them.
"Dead code" ellimination
The code snippets that are not being used elsewhere in the programme do not affect the final
result of the application. They are automatically removed.
110
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Specifics
mikroC PRO for AVR
CHAPTER 3
Prototype
unsigned long Get_Fosc_kHz(void);
Returns Device clock in kHz, rounded to the nearest integer.
Description
Function returns device clock in kHz, rounded to the nearest integer.
Note that Get_Fosc_kHz is library function rather than a built-in routine; it is pre-
sented in this topic for the sake of convenience.
Requires Nothing.
Example
clk = Get_Fosc_kHz();