STM32 microsecond delay program

Publisher:大树下的大白菜yLatest update time:2016-08-03 Source: eefocusKeywords:stm32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
My stm32 system clock is 72MHZ, and I use software delay method to achieve microsecond delay, that is, empty loop:

The delay function is:

  #define delayUs(x) { unsigned int _dcnt; \
      _dcnt=(x*16); \
      while(_dcnt-- > 0) \
      { continue; }\
     }

x---------is the delay time (in us)

The 16 in _dcnt=(x*16); can be changed. When it is changed to 8, the delay time is x*0.5.

Keywords:stm32 Reference address:STM32 microsecond delay program

Previous article:ARM and 51 MCU communication
Next article:LPC Study Notes Timer

Recommended ReadingLatest update time:2024-11-16 14:31

STM32 SPI principle
SPI (Serial Peripheral Interface) is a synchronous serial data transmission standard proposed by Motorola. It is a high-speed, full-duplex, synchronous communication bus that is widely used in many devices. SPI related abbreviations SS: Slave Select, select the slave device, chip select. CKPOL (Clock Polarity) = C
[Microcontroller]
STM32 SPI principle
Push-pull output and open-drain output of stm32
First, look at the schematic diagram of STM32's GPIO as follows: When the port is configured as output:     Open-drain mode: When outputting 0, N-MOS is turned on, P-MOS is not activated, and outputs 0.               When outputting 1, N-MOS is high impedance, P-MOS is not activated, and output is 1 (external pull-
[Microcontroller]
STM32 DAC configuration
STM32F103VCT6 has two 12-bit DACs. The conversion speed of DAC has not been found. Some people on the Internet say that the frequency is 1MHZ, which is 1us. The conversion time of ADC is 1us at 56MHZ operating frequency and 1.17us at 72MHZ operating frequency. If AD and DA have a symmetrical relationship, then it is l
[Microcontroller]
Network communication UIP transplantation on STM32
1. What is the UIP protocol stack? UIP is a TCP/IP protocol stack suitable for small embedded communication, developed and written by people from the Swedish Institute of Computer Science. It removes the uncommon functions in the complete TCP/IP and simplifies the communication process, but it retains the protocols th
[Microcontroller]
Network communication UIP transplantation on STM32
MDK development of Stm32 using C++ development implementation
1. Retargeting 和 non-semihosting In order to implement cout, a section of code needs to be added, in which low-level functions such as fputc, ferror, fseek, ftell, etc. are re-implemented. There is also similar code in the section Libraries and Floating Point Support Guide: Redefining low-level library functions to
[Microcontroller]
MDK development of Stm32 using C++ development implementation
stm32 communicates information through the serial port and controls the LED on and off
h Turn off yellow l Turn off blue g Turn off green a Open All int main(void) {   /* USER CODE BEGIN 1 */     /* USER CODE END 1 */     /* MCU Configuration------------------------------------------------- ----------*/     /* Reset of all peripherals, Initializes the Flash interface and the Systick. */   HAL
[Microcontroller]
STM32 learning clock
STM32 learning----clock collection In STM32, there are five clock sources: HSI, HSE, LSI, LSE, and PLL. ①. HSI is a high-speed internal clock, RC oscillator, with a frequency of 8MHz. ②. HSE is a high-speed external clock that can be connected to a quartz/ceramic resonator or an external clock source with a freq
[Microcontroller]
Tax controller solution based on STM32
With the promotion of the Golden Tax Project, the tax control market will develop rapidly. As one of the four major tax control products, the tax controller has a market share that cannot be underestimated. Tax control manufacturers need to consider the performance and cost of their products in many aspects. In the pa
[Microcontroller]
Tax controller solution based on STM32
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号