- 1、本文档共7页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
stm32定时器延时时间(STM32 timer delay time)
stm32定时器延时时间(STM32 timer delay time)
STM32, systick specific delay time calculation
Categories: STM32/STM8, 2013-04-12, 11:14, 154 people read comments (0) collection report
/****************************************************************************
* STM32 microcontroller, SysTick system, tick timer, experimental procedures
*
*
*
*****************************************************************************/
#ifndef _SYSTICK_H
#define _SYSTICK_H
#include SysTick.h
#define (SYSTICK_CSR ((volatile unsigned * long * 0xE000E010))) / / control register
#define (SYSTICK_LOAD ((volatile unsigned * long * 0xE000E014))) / / reload registers
#define (SYSTICK_VAL ((volatile unsigned * long * 0xE000E018))) / / current value register
#define (SYSTICK_CALRB ((volatile unsigned * long * 0xE000E01C))) / / calibration value register
Unsigned long SysTick_Delay; / / global variables
/ / configuration register
Void SysTick_InitStructReadCmd (void)
{
SYSTICK_VAL = 0; / / the current zero value register
SYSTICK_LOAD = SystemCoreClock / 1000000; / / an important part here is the system of/ 100000
SYSTICK_CSR |= 0x06; / / the first time can make SysTick close in the open
}
/ / interrupt service program
Void SysTick_Hangler (void)
{
SYSTICK_VAL = 0; / / the current zero value register
If (SysTick_Delay! = 0x00 / SysTick_Delay) to judge the delay is equal to 0
{
SysTick_Delay--; / / reduced to 0 end
}
}
/ / delay function
Void Delay_10us (unsigned, long, Countlinef)
{
SYSTICK_CSR |= 0x07; / / SysTick to start
SysTick_Delay = Countlinef; / / assign delay variable SysTick_Delay global variables
While (SysTick_Delay! = 0); / / judge whether to delay time
SYSTICK_CSR |= 0x06; / / time to close the SysTick which can be used in the open
}
Int main (void)
{
(SystemInit); / / note so is the system clock initialization is clocked at 72M, here is a must
SysTick_InitStructReadCmd ();
While (1)
{
GPIOD-BSRR = 0
Delay_10us (1000000); / / 1ms delay
GPIOD-BRR = 0
}
}
//====
您可能关注的文档
- bat 批处理延迟运行脚本(Bat batch running script).doc
- bh1750数字光照(Bh1750 digital light).doc
- beautiful smile and love美丽的微笑和爱心(美丽的微笑与爱心美丽的微笑和爱心).doc
- boys love 名言(男生的爱名言).doc
- bilibili入站测试(bilibili入站测试).doc
- bedzed(BedZED).doc
- bt3破解无线wep_wpa2(BT3 crack wireless wep_wpa2).doc
- bt下载狂热者分析各种破解方法(BT download enthusiasts analyze various crack methods).doc
- build.prop优化(build.prop优化).doc
- bp神经网络c语言实现(BP neural network, C language implementation).doc
文档评论(0)