Guide to Implementing a Simple Running Light with the 51 Microcontroller

Guide to Implementing a Simple Running Light with the 51 Microcontroller

The 51 microcontroller has become the first choice for electronic beginners due to its low cost and ease of use. The running light, as a basic experimental project, allows for quick mastery of core skills such as GPIO control and delay functions. This article breaks down the implementation steps from hardware setup to software programming. … Read more

Using DWT Peripheral to Write Delay Functions in STM32

Using DWT Peripheral to Write Delay Functions in STM32

DWT is a debugging peripheral, and one of its core functions is CYCCNT, which is a 32-bit incrementing counter used to record the number of clock cycles executed by the CPU. We can achieve rewriting the HAL_Delay function or implement microsecond-level delays by monitoring the changes in this counter. Appendix: 1. Source Code dwt.delay.h file … Read more

How to Write Delay Functions for Microcontrollers?

How to Write Delay Functions for Microcontrollers?

In microcontroller design, to ensure specific functions are realized, many electronic engineers equip delay functions. However, many beginners in electronics do not understand the purpose of these delay functions and may not even know how to write them. This article will list the delay functions for microcontrollers, hoping to assist everyone. Generally speaking, a microcontroller … Read more

Embedded Programming (24) – How to Use the #ifndef Directive?

Embedded Programming (24) - How to Use the #ifndef Directive?

Lifetime Technical Support:186 3636 9649 Author Introduction: Fan Shengmin (186 3636 9649), Member of the Science Writers Association of Yuncheng City, Member of the Science Writers Association of Shanxi Province. Author of maker education. Published “Playing with Electronics” in 2016, “Super Fun Electronic Production” in 2017, “Electrical Experiments in Life” in 2018, “Arduino Programming and … Read more

STM32 System Clock and Delay Function Initialization

STM32 System Clock and Delay Function Initialization

STM32 has three different clock sources that can be used to drive the system clock (SYSCLK): 1: HSI oscillator clock (internal clock) 2: HSE oscillator clock (external clock, provided by the crystal) 3: PLL clock (Phase-Locked Loop clock) These devices have the following two secondary clock sources: (1) 40kHz low-speed internal RC, which can be … Read more