Datasheet
Delay_Cyc
Clock_KHz
Clock_MHz
99
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Specifics
mikroBasic PRO for AVR
CHAPTER 3
Prototype
sub procedure Delay_Cyc(Cycles_div_by_10 as byte)
Returns Nothing.
Description
Creates a delay based on MCU clock. Delay lasts for 10 times the input param-
eter in MCU cycles.
Note that
Delay_Cyc is library function rather than a built-in routine; it is pre-
sented in this topic for the sake of convenience. There are limitations for
Cycles_div_by_10 value. Value Cycles_div_by_10 must be between 2 and 257.
Requires Nothing.
Example
Delay_Cyc(10) ' Hundred MCU cycles pause
Prototype
sub function Clock_Khz() as word
Returns Device clock in KHz, rounded to the nearest integer.
Description
Function returns device clock in KHz, rounded to the nearest integer.
This is an “inline” routine; code is generated in the place of the call, so the call
doesn’t count against the nested call limit.
Requires Nothing.
Example
clk = Clock_kHz()
Prototype
sub function Clock_MHz() as byte
Returns Device clock in MHz, rounded to the nearest integer.
Description
Function returns device clock in MHz, rounded to the nearest integer.
This is an “inline” routine; code is generated in the place of the call, so the call
doesn’t count against the nested call limit.
Requires Nothing.
Example
clk = Clock_Mhz()