ABSTRACT

This chapter focuses on the introduction of clock ticks and clock-based timers. It explains how clock ticks are generated and how to use Real Time-Thread (RT-Thread) timers. The clock tick is generated by a hardware timer configured in interrupt trigger mode. RT-Thread timer provides two types of timer mechanisms: the first type is a one-shot timer, which only triggers a timer event for onetime after startup, and then the timer stops automatically. The second type is a periodic triggering timer, which periodically triggers a timer event until the user manually stops it; otherwise, it will continue to execute forever. In the RT-Thread operating system, timer control block is defined by the structure structrt_timer and forms a timer kernel object, which is then linked to the kernel object container for management. The timer control block contains important parameters related to the timer and acts as a link between various states of the timer.