#nclude<reg51.h>#include<intrins.h>#銷nclude<math.h>#include<string.h>struct PID{unsigned int SetPoint;//設(shè)定目標(biāo) Desired Value unsigned int Proportion;//比例常數(shù)Proportional Const unsigned int integral;//積分常數(shù)Integral Const unsigned int Derivative://微分常數(shù)Derivative Const unsigned int LastError;//Emorl-1]unsigned int PrevError;//Errorl-2]unsigned int SumError;//Sums of Errors struct PID spid;//PID Control Structure unsigned int rout;//PID Response(Output)unsigned int rin://PID Feedback(Input)sbit data1=P100;sbit clk=P141;sbit plus=P240;sbit subs=P241:sbit stop=P22;sbit output=P34;sbit DQ=P33;unsigned char flag,flag_1=0;unsigned char high_time,low_time,.count=0,/占空比調(diào)節(jié)參數(shù)unsigned char set_temper=35;unsigned char temper;unsigned chari:unsigned charj=0;unsigned ints;
陀螺儀硬件自檢:相關(guān)方法陀螺儀允許用戶測(cè)試機(jī)械和電氣部分。自檢的代碼在 InvenSense提供的 MotionApps?軟件里面。如果沒有使用 MotionApps?軟件,請(qǐng)參閱下節(jié)(Obtaining the Gyroscope Factory Trim (FT) Value)。當(dāng)自檢啟動(dòng),片上的電子設(shè)備就會(huì)啟動(dòng)相應(yīng)的傳感器。這次啟動(dòng)會(huì)使傳感器的 proofmasses的距離相當(dāng)于一個(gè)預(yù)定的科里奧利力(Coriolis force)。傳感器的 Proof masses位移變換的結(jié)果將在輸出信號(hào)中反映。輸出信號(hào)用戶可以在自檢反饋看到。自檢反饋(STR)定于如下:Self Test Response=Gyroscope Output with Self Test Enabled — Gyroscope Output with Self Test Disabled自檢反饋通過反饋與出產(chǎn)的評(píng)估比較查找變換用于確定這部分通過還是自檢失敗