女人被狂躁到高潮视频免费无遮挡,内射人妻骚骚骚,免费人成小说在线观看网站,九九影院午夜理论片少妇,免费av永久免费网址

當(dāng)前位置:首頁 > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]typedef struct PID{ double SetPoint; // Desired Value double Proportion; // Proportional Const double Integral; // Integral Const double Derivative; // Derivative Const double LastError; // Error[-1]

typedef struct PID
{
double SetPoint; // Desired Value

double Proportion; // Proportional Const
double Integral; // Integral Const
double Derivative; // Derivative Const

double LastError; // Error[-1]
double PrevError; // Error[-2]
double SumError; // Sums of Errors
} PID;

/*=========================================================================*
Perform One PID Iteration
*=========================================================================*/

double PIDCalc ( PID *pp, double NextPoint )

{ double dError, Error;

pp->SumError += (Error = pp->SetPoint - NextPoint);
dError = pp->LastError - pp->PrevError;
pp->PrevError = pp->LastError;
pp->LastError = Error;
return ( pp->Proportion * Error
+ pp->Integral * pp->SumError
+ pp->Derivative * dError
);
}

/*=========================================================================*
Initialize PID Structure
*=========================================================================*/

void PIDInit ( PID *pp )

{ memset ( pp,0,sizeof(PID) );
}

/***************************************************************************
Main Program
***************************************************************************/

double sensor ( void ) // Dummy Sensor Function
{ return 100.0;
}

void actuator ( double rDelta ) // Dummy Actuator Function
{}

void main ( void )
{ PID sPID; // PID Control Structure
double rOut; // PID Response (Output)
double rIn; // PID Feedback (Input)

PIDInit ( &sPID ); // Initialize Structure
sPID.Proportion = 0.5; // Set PID Coefficients
sPID.Integral = 0.5;
sPID.Derivative = 0.0;
sPID.SetPoint = 100.0; // Set PID Setpoint

for (;;) // Mock Up of PID Processing
{ rIn = sensor (); // Read Input
rOut = PIDCalc ( &sPID,rIn ); // Perform PID Interation
actuator ( rOut ); // Effect Needed Changes
}
}

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

/**************************文件所用資源1.端口:P22.調(diào)用delay_ms函數(shù)**************************/#include #include #define key...

關(guān)鍵字: 4*4 c51程序 矩陣鍵盤

/**************************文件所用資源1.端口:P0.2,P0.32.調(diào)用delay_ms函數(shù)**************************//*********************...

關(guān)鍵字: c51程序 讀寫驅(qū)動(dòng) 24cxx

/**************************文件所用資源1.端口:P0.4,P0.5,P0.6,P0.72.調(diào)用delay_ms函數(shù)**************************//***********...

關(guān)鍵字: c51程序 io口 模擬spi通信

/********************************文件所用資源1.外部中斷0、1 定時(shí)中斷0、1 串口中斷2.端口:P3.0,P3.1,P3.3,P3.4,P3.5********************...

關(guān)鍵字: c51程序 串口中斷 外部中斷 定時(shí)中斷

模塊內(nèi)接口:使用如下標(biāo)志符:asm匯編語句endasm注意:如果在程序中使用了,注意在Keil編譯器中需要激活Properties中的“GenerateAssemblerFile”和“AssemblerFile”兩個(gè)選項(xiàng)...

關(guān)鍵字: keil c51程序 嵌入?yún)R編

關(guān)于spi協(xié)議見:http://hi.baidu.com/gilbertjuly/blog/item/0be222eeac9abae5cf1b3e38.html ISD4002芯片資料參考:http://downloa...

關(guān)鍵字: c51程序 spi總線 單片機(jī) 發(fā)送數(shù)據(jù)

/*--------------------------24C01的IIC 讀寫的c51程序---------------------程序中很多NOP是冗余的,希望讀者能進(jìn)一步精簡(jiǎn),但必須經(jīng)過驗(yàn)證。 Atmel 24C...

關(guān)鍵字: c51程序 單片機(jī) 讀寫24c01

void X5045SpiOpen(void);//打開X5045片選void X5045SpiClose(void);//關(guān)閉X5045片選 void X5045WriteEnable(void);//軟件使能X50...

關(guān)鍵字: c51程序 x5045 讀寫一體化

/*------------------------------------------------------------------------------為了安全起見,程序中很多NOP是冗余的,希望讀者能進(jìn)一步精簡(jiǎn)...

關(guān)鍵字: c51程序 iic 讀寫 24c01

/**************************文件所用資源1.外部中斷02.端口:P3.3、P3.4**************************/sbit BT_REC =P3^3;//接收 P3.0sb...

關(guān)鍵字: c51程序 io口 模擬串口
關(guān)閉