Mikroc, Delay_cyc, Clock_khz – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 145: Vdelay_ms

Advertising
background image

MikroElektronika: Development tools - Books - Compilers

137

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Prototype

void

Delay_Cyc(char Cycles_div_by_10);

Description

Creates a delay based on MCU clock. Delay lasts for 10 times the input parameter in
MCU cycles. Input parameter needs to be in range 3 .. 255.

Note that

Delay_Cyc

is library function rather than a built-in routine; it is presented in

this topic for the sake of convenience.

Example

Delay_Cyc(10);

/* Hundred MCU cycles pause */

Delay_Cyc

Prototype

unsigned

Clock_Khz(void);

Returns

Device clock in KHz, rounded to the nearest integer.

Description

Returns device clock in KHz, rounded to the nearest integer.

Example

clk = Clock_Khz();

Clock_Khz

Prototype

void

Vdelay_ms(unsigned time_in_ms);

Description

Creates a software delay in duration of

time_in_ms

milliseconds (a variable).

Generated delay is not as precise as the delay created by

Delay_ms

.

Example

pause = 1000;

// ...

Vdelay_ms(pause);

// ~ one second pause

Vdelay_ms

Advertising
This manual is related to the following products: