资源介绍
飞思卡尔pid算法,实现参数显示和调整void main(void)
{
float display_value;
int count=0;
pid = &warm;
printf("Enter the values of Process point, Set point, P gain, I gain, D gain \n");
scanf("%d%d%f%f%f", &process_point, &set_point,&p_gain, &i_gain, &d_gain);
process_point = 30;
set_point = 40;
p_gain = (float)(5.2);
i_gain = (float)(0.77);
d_gain = (float)(0.18);
dead_band = 2;
integral_val =(float)(0.01);
printf("The values of Process point, Set point, P gain, I gain, D gain \n");
printf(" %6d %6d %4f %4f %4f\n", process_point,
set_point, p_gain, i_gain, d_gain);
printf("Enter the values of Process point\n");
while(count<=20)
{
scanf("%d",&process_point);
pid_init(&warm, process_point, set_point);
pid_tune(&warm, p_gain,i_gain,d_gain,dead_band);
pid_setinteg(&warm,0.0);
pid_setinteg(&warm,30.0);
pid_bumpless(&warm);
display_value = pid_calc(&warm);
printf("%f\n", display_value);
printf("\n%f%f%f%f",warm.pv,warm.sp,warm.igain,warm.dgain);
count++;
}
}