惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

初心博客

嘿! - 初心博客 AD如何更改显示的精度 - 初心博客 windows蓝屏代码分析 - 初心博客 PE推荐 - 初心博客 Qt5.14安装教程 - 初心博客 HC32F460+ADC+TIM+UART - 初心博客 HC32F460驱动OLED屏幕显示 - 初心博客 浅谈平民出行方式 - 初心博客 选购七律 - 初心博客 Quartus II 18.1 安装教程 - 初心博客
HC32F460驱动定时器LED闪烁 - 初心博客
博主: 初心 · 2024-01-13 · via 初心博客
  • 发布时间:
  • 3324 次浏览
  • 2 条评论
  • 1056字数
  • 分类: 编程
  1. 首页
  2. 正文  
  3. 分享到:

数据手册1.4.22 通用定时器 0(Timer0)是一个可以实现同步计数、异步计数两种方式的基本定时器。定时器内含 2个通道,可以在计数期间产生比较匹配事件。该事件可以触发中断,也可作为事件输出来控制其它模块等。本系列产品中搭载 2 个单元的 Timer0。

采用小华配置工具经行代码的生成 工具地址:https://www.xhsc.com.cn/Productlist/info.aspx?itemid=1849

**注意:XHSC XHCode软件配置重新生成会全部覆盖代码 !**

**注意:XHSC XHCode软件配置重新生成会全部覆盖代码 !**

**注意:XHSC XHCode软件配置重新生成会全部覆盖代码 !**

1、XHcode配置

LED灯及定时器0配置

定时器0的主频配置

2、定时计算

定时器定时1秒,主频是48MHz ,分频1024 ,重装载值:46875(0xB71B);也就是48 000 000Hz/1024/46875=1秒

重装载值65535(0xFFFF)

3、LED闪烁代码

中断回调代码

    /* INT_SRC_TMR0_1_CMP_A Callback. */

static void INT_SRC_TMR0_1_CMP_A_IrqCallback(void)
{

//add your codes here
GPIO_TogglePins(GPIO_PORT_B, GPIO_PIN_04);

}

4、波形查看

示波器显示波形
反推回去:
A、500mHZ换算成赫兹单位也就是0.5Hz。
B、0.5Hz X 46875(重装载值)X 1024(分频系数) X 2 = 48 000 000HZ(48Mhz)

赞赏作者

如果觉得我的文章对你有用,请随意赞赏

HC32F460驱动定时器LED闪烁

 •