STC15W408AS library 0.17.0
Loading...
Searching...
No Matches
Functions
timer_ms_to_ticks_table.h File Reference
#include <stdint.h>
#include <timer_common.h>
Include dependency graph for timer_ms_to_ticks_table.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void timer0_1ms_delay_init ()
 Initializes Timer0 for 1 millisecond delay using precalculated ticks.
 
void timer0_1ms_delay ()
 Executes a 1 millisecond delay using Timer0.
 

Function Documentation

◆ timer0_1ms_delay()

void timer0_1ms_delay ( )

Executes a 1 millisecond delay using Timer0.

Starts Timer0 and waits for the overflow flag (TF0) to be set, indicating that the configured 1ms time interval has elapsed. The timer is configured by timer0_1ms_delay_init() with the appropriate reload values for the system clock frequency.

Note
This is a blocking function that waits in a polling loop until the timer overflow occurs.
Timer0 must be initialized with timer0_1ms_delay_init() before calling this function.
See also
timer0_1ms_delay_init() - Initializes Timer0 for 1ms delay
TF0 - Timer0 overflow flag
TR0 - Timer0 run control bit

◆ timer0_1ms_delay_init()

void timer0_1ms_delay_init ( )

Initializes Timer0 for 1 millisecond delay using precalculated ticks.

Note
Must be called before using timer0_1ms_delay() to ensure correct timer configuration for the current system clock settings.
Disables Timer0 interrupt during initialization to prevent unwanted interrupt service routine execution.
See also
get_frequency_divider_scale() - Gets current frequency scale index
get_timer0_clock_divider() - Gets Timer0 clock divider setting
timer0_1ms_delay() - Performs the actual 1ms delay
precalc_1t_ticks - Lookup table for 1T mode tick values
precalc_12t_ticks - Lookup table for 12T mode tick values