Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
155
Prototype
sub procedure Delay_Cyc(dim x, y as word)
Description
Creates a delay based on MCU clock. Delay lasts for 
x*16384 + y
 MCU clock cycles.
Parameters
x
: NumberOfCycles divided by 16384 
y
: remainder of the NumberOfCycles/16384 division 
Returns
Nothing.
Requires
Nothing.
Example
Delay_Cyc(1, 10)  ‘ 1x16384 + 10 = 16394 cycles pause 
Notes
Delay_Cyc
 is a library function rather than a built-in routine; it is presented in this topic for the sake 
of convenience.
Prototype
sub procedure Delay_Cyc_Long(dim CycNo as word)
Description
Creates a delay based on MCU clock. Delay lasts for 
CycNo
 MCU clock cycles.
Parameters
- CycNo
: number of MCU cycles 
Returns
Nothing.
Requires
Nothing.
Example
Delay_Cyc_Long(16384)  ‘ 16384 cycles pause 
Notes
Delay_Cyc_Long
 is a library function rather than a built-in routine; it is presented in this topic for 
the sake of convenience.
Delay_Cyc
Delay_Cyc_Long
Prototype
sub function Clock_kHz() as longint
Description
Returns device clock in kHz, rounded to the nearest integer.
This is an “inline” routine; the code is generated in the place of the call.
Parameters
None.
Returns
Device clock in kHz, rounded to the nearest integer.
Requires
Nothing.
Example
clk = Clock_kHz()
Notes
None.
Clock_kHz