uint8_t user_heating_algorithmPID(void) { uint32_t temp_1; uint16_t Adcn; nrfx_err_t err_code; HEATING_ENABLE(); nrf_delay_us(1000);//ÑÓʱ1000us=1ms err_code = fu_peripheral_saadc_sample_convert(FU_SAADC_CHANNEL_LOADER, (nrf_saadc_value_t*)&Adcn); APP_ERROR_CHECK(err_code); uMachine_V.heating_V = uGetOutPut_Voltage(Adcn); if(uMachine_V.Heating_Temperature < uMachine_V.Heating_SET_Temperature) { temp_1 = uMachine_V.heating_V*uMachine_V.heating_V/1000; if(uMachine_V.Heating_Temperature > Heating_ctr_power)//Heating_ctr_power=(Heating_top_SET_Temperature-(Heating_top_SET_Temperature/5))
{ if(uMachine_V.Heating_power > Constant_temperature_power) { uMachine_V.Heating_power=uMachine_V.Heating_power-((uMachine_V.Heating_power*(uMachine_V.Heating_Temperature-Heating_ctr_power))/(uMachine_V.Heating_SET_Temperature-Heating_ctr_power)); } else { uMachine_V.Heating_power = Constant_temperature_power; } } if((uMachine_V.heating_V <= 14000)&&(temp_1 < (uMachine_V.Heating_resistance * uMachine_V.Heating_power)))//ÏÞÖƵçѹΪ10V£¬ÍòÒ»µç×è²âÊÔ²¿×¼£¬µçѹ¾Í¿ÉÄÜÉýµÃºÜ¸ß { if(uMachine_V.heating_speed < 70) { uMachine_V.heating_speed++; } } else { uMachine_V.heating_speed--; } HEATING_ENABLE(); if(uMachine_V.heating_EN != 2)uMachine_V.heating_EN = 1; } else { HEATING_DISABLE(); uMachine_V.heating_EN = 0; } fu_pwm_duty_set(uMachine_V.heating_speed, FU_PWM_CH_ATOMIZER); return 0; }
经验再多也只能看作加法,而经过理论升华的经验,就可以看作乘法!