STC15W408AS library 0.9.0
Macros
Delay

Macros

#define TICKS_DELAY_1ms   ((uint16_t) (((get_master_clock_frequency() / 1000UL) - 30UL) / 18UL))
 Ticks for 1ms delay.
 
#define delay_ms(ms)
 Delays program flow using CPU nop. More...
 

Detailed Description

Functions and data structures related to delaying program flow

Author
Michael Golovanov

Macro Definition Documentation

◆ delay_ms

#define delay_ms (   ms)
Value:
{ \
{ \
uint16_t ms_div = ms >> get_frequency_divider_scale(); \
do \
{ \
uint16_t d = TICKS_DELAY_1ms; \
do \
{ \
__asm NOP __endasm; \
__asm NOP __endasm; \
__asm NOP __endasm; \
} while (d--); \
} while (ms_div--); \
} \
}
#define TICKS_DELAY_1ms
Ticks for 1ms delay.
Definition: delay.h:20
#define get_frequency_divider_scale()
Get master clock frequency divider scale (CLK_DIV bits [0..2])
Definition: frequency.h:65

Delays program flow using CPU nop.

Using CPU cycles to delay. Use delay_ms with care.

Parameters
msuint16_t delay value