介绍
定时器中断是由单片机中的定时器溢出而申请的中断。利用定时器中断,控制LED灯的闪烁。
准备
J-Link烧写器一套,(USB转安卓)数据线,USB转串口工具,跳线若干;
瑞萨e2 studio(如果没有J-Link套件,在瑞萨官网下载支持串口烧录的软件Renesas Flash Programmer);
串口调试工具(自行准备)。
软件下载安装
在瑞萨官网直接搜索e2 studio,下滑在下载页面中找到如下安装压缩包,点击下载安装。

在瑞萨官网,依次点击 支持和设计→软件与工具→Development Tools,下滑找到如下安装包,点击下载安装。

连接
1
参照瑞萨官网下载的规格书了解demo板的管脚定义,或者直接观察demo板上的丝印文字参照下图,和J-Link连接。此demo板需要USB转安卓线单独供电。

注意:延伸线(就是往开发板插的那条线)刚好反转了一下,请注意辨别。

2
参照下图连接,USB转串口工具和demo板连接

新建工程
打开e2 studio,按下图操作

工程模板

保存工程路径。
芯片配置
使用R7FA2L1AB2DFL来进行演示。

然后一直点击下一步,出现下图,按图选择再点完成即可。

定时器设置
点击Stacks→New Stack→Timers→Timers,General PWM

设置100ms为一次。
选择计数单位为Milliseconds,计时周期为100

定时器回调函数timer0_callback()
定时完毕可以用TIMER_EVENT_CYCLE_END进行判断。

设置一个标志为flag,当flag为20时执行操作并重置定时器,实现LED延时两秒功能。

定时器初始化
在void hal_entry(void)里初始化定时器,并开启

void LED()函数
读取led灯103的电平状态并手动将它翻转,实现定时器中断2s一次led灯闪烁

1
END
1
原文标题:RA2L1定时器中断
文章出处:【微信公众号:瑞萨MCU小百科】欢迎添加关注!文章转载请注明出处。
-
mcu
+关注
关注
146文章
17386浏览量
353080 -
瑞萨
+关注
关注
35文章
22315浏览量
86918
原文标题:RA2L1定时器中断
文章出处:【微信号:瑞萨MCU小百科,微信公众号:瑞萨MCU小百科】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
【瑞萨RA2L1入门学习】3. printf输出
【瑞萨RA2L1入门学习】2. PWM呼吸灯
【瑞萨RA2L1入门学习】05、待机模式按键外部中断唤醒 低功耗测试
【瑞萨RA2L1入门学习】1. 点亮LED
【瑞萨RA2L1入门学习】01、PWM呼吸灯
【瑞萨RA2L1入门学习】开箱+Keil环境搭建+点灯+点亮OLED
瑞萨RA家族精品RA2L1产品介绍

瑞萨电子RA2L1 MCU产品介绍

【RA-Eco-RA2E1-48PIN-V1.0开发板试用】RA-Eco-RA2E1-48PIN-V1.0开发板基于Keil MDK环境搭建
【RA-Eco-RA2E1-48PIN-V1.0开发板试用】带你认识RA-Eco-RA2E1-48PIN-V1.0开发板
用STM32F103打开了定时器2开定时器中断,关闭就报错 ,定时器如何关闭呢?
如何实现一个软件定时器?
STM8L152R8T6定时器中断异常的原因?怎么解决?
使用555定时器的可调双定时器电路

评论