RT-Thread论坛
登录
直播中
陈伟
7年用户
1454经验值
私信
关注
使用RT-Thread studio stlink调试时会卡死的原因?
开启该帖子的消息推送
RT-Thread
stlink
在使用 RT-Thread studio stlink调试 很简单的一个示例调试有时卡死,
int main(void)
{
ti
m_init();
while (1)
{
//rt_thread_mdelay(2000);
}
return RT_EOK;
}
============================================================
#ifndef APP_TIM_H_
#define APP_TIM_H_
#include
#include
void tim_init();
#endif /* APP_TIM_H_ */
============================================================
#include "tim.h"
/*
* 软件定时器
*
* */
rt_timer_t tim1 =NULL ;
struct rt_timer tim2;
rt_err_t ret ;
void tim1_timeout(void *parameter) //定时器1回调(每到定时时间就进来一次)
{
rt_kprintf("ONE is OK\n ");
}
void tim2_timeout(void* parameter)//定时器2回调 (每到定时时间就进来一次)
{
//rt_kprintf("TWO is OK\n ");
static int count =0 ;
if(count >=2)
{
rt_kprintf("TWO is OK\n ");
count =0 ;
}
else {
count ++;
}
}
void tim_init()
{
/*动态创建*/
tim1 = rt_timer_create("tim1 demo",
tim1_timeout,
RT_NULL,
2000, //定时时间2s一次
RT_TIMER_FLAG_ONE_SHOT );//单次定时
/*静态创建*/
rt_timer_init(&tim2,
"tim2 demo ",
tim2_timeout,
RT_NULL,
1000, ////定时时间1s一次
RT_TIMER_FLAG_PERIODIC );//周期定时
if(tim1 !=NULL )
{
rt_timer_start(tim1);
}
//启动定时器
rt_timer_start(tim1);
//rt_timer_start(&tim2);
}
回帖
(1)
陈萍
2024-2-19 16:55:24
你这主函数while() 循环中延时注释掉了? 那样无法执行其他任务了吧
你这主函数while() 循环中延时注释掉了? 那样无法执行其他任务了吧
举报
更多回帖
rotate(-90deg);
回复
相关问答
RT-Thread
stlink
RT-Thread
使用usb的
stlink
-v2
调试
32mini板子报错怎么去解决呢
2022-07-18
2111
求大佬指点
RT-Thread
Studio
调试
一直报错main未定义
2022-10-13
1204
rt
thread
studio
新建gd32f450工程
stlink
无法仿真咋办?
2023-03-14
798
怎么在
RT-Thread
Studio
上使用
RT-Thread
Nano
2021-04-02
4282
RT-THREAD
STUDIO
退出
调试
模式后断点还在执行的
原因
是什么?
2022-03-14
3088
rt-thread
studio
更改rom起始地址无法
调试
应如何处理?
2022-06-14
1740
RT-Thread
Studio
单步
调试
报错
2023-08-04
1243
RT-Thread
studio
st-link串口
调试
失败如何解决
2022-09-30
2470
怎样使用
RT-Thread
Studio
进行开发基于STM32F407VET的项目呢
2021-12-17
1563
怎么解决
rt-thread
studio
st-link串口
调试
失败的问题呢?
2023-02-15
460
发帖
登录/注册
20万+
工程师都在用,
免费
PCB检查工具
无需安装、支持浏览器和手机在线查看、实时共享
查看
点击登录
登录更多精彩功能!
首页
论坛版块
小组
免费开发板试用
ebook
直播
搜索
登录
×
20
完善资料,
赚取积分