好文档 - 专业文书写作范文服务资料分享网站

系统集成说明书

天下 分享 时间: 加入收藏 我要投稿 点赞

ofv = (float)(dm1-dp1)/1024.0*3.23*7.790+17.96; lcd_ofv=ofv; lcd_ofc=ofc; }

float voltage_pid(float voltage) {

uint8 index;

pid.ActualVoltage = ofv; pid.SetVoltage=voltage;

pid.err=pid.SetVoltage-pid.ActualVoltage; float

incrementVoltage=pid.Kp*(pid.err-pid.err_next)+pid.Ki*pid.err+pid.Kd*(pid.err-2*pid.err_next+pid.err_last);

pid.Voltage+=incrementVoltage; pid.err_last=pid.err_next; pid.err_next=pid.err; return pid.Voltage; }

void date_execute() {

int16 tmp=0;

date_get(); date_analyse();

tmp =(int16) voltage_pid(new_val); if(tmp>550) tmp=550; if(tmp<50) tmp=50; out_put=tmp; }

2、主程序

#include \#include \extern float new_val; extern vint16 out_put;

extern float lcd_set,lcd_out; extern vint16 tt;

extern volatile float lcd_ofv,lcd_ofc;

void vcan_sendware(uint8 *wareaddr, uint32 waresize); extern uint8 var[2];

void main()

13

{

source_init(); while(1) {

deal_key_event();

DisplayFloat8x16(lcd_set,40,0); DisplayFloat8x16(lcd_out,40,2); DisplayFloat8x16(lcd_ofv,80,4); DisplayFloat8x16(lcd_ofc,80,6);

ftm_pwm_duty(FTM0,FTM_CH0,100); //vcan_sendware((uint8_t *)var, sizeof(var)); }

}

14

15

系统集成说明书

ofv=(float)(dm1-dp1)/1024.0*3.23*7.790+17.96;lcd_ofv=ofv;lcd_ofc=ofc;}floatvoltage_pid(floatvoltage){uint8index;<
推荐度:
点击下载文档文档为doc格式
1plhg4c8c541z4g1sgcd5uqa87qzsz016s5
领取福利

微信扫码领取福利

微信扫码分享