利用串口示波器调试PID参数

30 篇文章 1 订阅
23 篇文章 1 订阅

PID调试最麻烦的是参数调整,需要花费大量时间,如果每调整一次都要修改代码重新编译烧录,效率很低,推荐串口示波器与rt-thead finsh进行调试
在这里插入图片描述
推荐使用FireWater数据引擎
在这里插入图片描述
定时上报数据,rt_kprintf不支持浮点数据打印,fractional_to_int是一个将浮点数小数放大100倍后取整函数,实现2位小数精度的数据打印

static void pcr_refresh_timeout(void *parameter)
{
    rt_kprintf("temp:%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,\
        %d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d\n",\
        (int)temp_tec_get()->fTemp[0],fractional_to_int(temp_tec_get()->fTemp[0]),\
        (int)temp_tec_get()->fTemp[1],fractional_to_int(temp_tec_get()->fTemp[1]),\
        (int)temp_tec_get()->fTemp[2],fractional_to_int(temp_tec_get()->fTemp[2]),\
        (int)temp_tec_get()->fTemp[3],fractional_to_int(temp_tec_get()->fTemp[3]),\
        (int)temp_tec_get()->fTemp[4],fractional_to_int(temp_tec_get()->fTemp[4]),\
        (int)temp_tec_get()->fTemp[5],fractional_to_int(temp_tec_get()->fTemp[5]),\
        (int)temp_tec_get()->fTemp[6],fractional_to_int(temp_tec_get()->fTemp[6]),\
        (int)temp_tec_get()->fTemp[7],fractional_to_int(temp_tec_get()->fTemp[7]),\
        (int)temp_hot_get()->fTemp[0],fractional_to_int(temp_hot_get()->fTemp[0]),\
        (int)temp_hot_get()->fTemp[1],fractional_to_int(temp_hot_get()->fTemp[1]),\
        (int)temp_hot_get()->fTemp[2],fractional_to_int(temp_hot_get()->fTemp[2]),\
        (int)temp_hot_get()->fTemp[3],fractional_to_int(temp_hot_get()->fTemp[3]),\
        (int)temp_hot_get()->fTemp[4],fractional_to_int(temp_hot_get()->fTemp[4]),\
        (int)temp_hot_get()->fTemp[5],fractional_to_int(temp_hot_get()->fTemp[5]),\
        (int)temp_hot_get()->fTemp[6],fractional_to_int(temp_hot_get()->fTemp[6]),\
        tec_driver_get_ptr(1)->u8Duty);
}

波形图控件拖动到页面,上传后数据显示的数据的波形图方便观察数据变化
在这里插入图片描述
参数调整下发,数据上报与参数下发都是使用finsh 命令行串口,在rt-thread下设定一些参数修改的调试命令

temp_pid_debug list cnt[0-100]
temp_pid_debug hot chn[0-6] temp[23-120] speed[0-3]
temp_pid_debug tec chn[0-6] temp[0-120] speed[0-4]
temp_pid_debug enable [tec|hot] chn[0-6] en[0-1]
temp_pid_debug pid hot p [k]
temp_pid_debug pid hot i [k]
temp_pid_debug pid hot d [k]
temp_pid_debug pid warm p [k]
temp_pid_debug pid warm i [k]
temp_pid_debug pid coola p [k]
temp_pid_debug pid coola i [k]
temp_pid_debug pid coolb p [k]
temp_pid_debug pid coolb i [k]

配置串口示波器命令
在这里插入图片描述
拖一个参数设置控件到页面并绑定命令
在这里插入图片描述
使用这个软件设置PID参数与查询升降温曲线波形图示例

升降温曲线实现

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

纵向深耕

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值