发表于:2009/4/3 17:15:13
#0楼
我在书上看到了一个关于机器人下位机控制的设计,但是运行好象有点问题.不知道是怎么回师.请问这个PID酸法可以用在数字压力表中吗?
#include <reg51.h>
#include <absacc.h>
#define uchar unsighed char
#define unit unsighed int
static float fKP=0.3,fTI=20,fTD=0,fKD=0.5,fSampT=0.010;
static float ek_1=0,ek_2=0;
static float deltaUdk_1=0;
static float u=0;
float DeltaPID(float ek)
{
float deltaUp;
float deltaUi;
float deltaUd;
deltaUp=fKP*(ek-ek_1);
deltaUi=fKP*fSampT*ek/fTI;
deltaUd=fTD/(fKD*fSampT+fTD)*(deltaUdk_1+fKP*fKD*(ek-2*ek_1+ek_2));
ek_2=ek_1;
ek_1=ek;
deltaUdk_1=deltaUd;
u=u+deltaUp+deltaUi+deltaUd;
}
显示的错误是"STARTUP.obj"
TO "mm"
*** FATAL ERROR L210: I/O ERROR ON INPUT FILE:
EXCEPTION 0021H: PATH OR FILE NOT FOUND
FILE: C:\KEIL\C51\LIB\C51FPS.LIB
Target not created
#include <reg51.h>
#include <absacc.h>
#define uchar unsighed char
#define unit unsighed int
static float fKP=0.3,fTI=20,fTD=0,fKD=0.5,fSampT=0.010;
static float ek_1=0,ek_2=0;
static float deltaUdk_1=0;
static float u=0;
float DeltaPID(float ek)
{
float deltaUp;
float deltaUi;
float deltaUd;
deltaUp=fKP*(ek-ek_1);
deltaUi=fKP*fSampT*ek/fTI;
deltaUd=fTD/(fKD*fSampT+fTD)*(deltaUdk_1+fKP*fKD*(ek-2*ek_1+ek_2));
ek_2=ek_1;
ek_1=ek;
deltaUdk_1=deltaUd;
u=u+deltaUp+deltaUi+deltaUd;
}
显示的错误是"STARTUP.obj"
TO "mm"
*** FATAL ERROR L210: I/O ERROR ON INPUT FILE:
EXCEPTION 0021H: PATH OR FILE NOT FOUND
FILE: C:\KEIL\C51\LIB\C51FPS.LIB
Target not created