A. marlin固件裡面怎麼樣修改PID&VID
這是不能修改的。
一般固件是設計者針對機器的晶元合理的編出來的
如果改了就無法使用的。
B. pid控制的C語言編程
#include<unistd.h>
#include<stdio.h>
int main(int argc,int **argv)
{
int pid=fork();
if(pid==-1)
{
printf("error");
}
else if(pid==0)
{
printf("This is the child process!\n");
}
else
{
printf("This is the parent process! child process id=%d\n",pid);
}
return 0;
}
首先為什麼這段代碼gcc編沒兆譯不了,只能用g++編譯,gcc編譯顯示結果如下
Undefined first referenced
symbol in file
__gxx_personality_v0 /var/tmp//ccuHN8IS.o
ld: fatal: Symbol referencing errors. No output written to t5
collect2: ld returned 1 exit status
其次,g++編譯橋察租後運行結果敏兆如下
This is the parent process! child process id=27406
This is the child process!
C. github上的梅林固件怎樣編譯
首先你要知道固件是什麼,路由器的固件相當於電腦的系統。如果你的電腦很好,但埋檔是裝的系統爛,臘冊那麼用起來也不彎局亂會爽。路由器的固件是各家都不一樣,沒有一個統一的。
D. PID編程的實例!
C語言實現PID演算法
BC31 TC30 編拆並鏈譯過,可運行。
#include <stdio.h>
#include<math.h>
struct _pid {
int pv; /*integer that contains the process value*/
int sp; /*integer that contains the set point*/
float integral;
float pgain;
float igain;
float dgain;
int deadband;
int last_error;
};
struct _pid warm,*pid;
int process_point, set_point,dead_band;
float p_gain, i_gain, d_gain, integral_val,new_integ;;
/*------------------------------------------------------------------------
pid_init
DESCRIPTION This function initializes the pointers in the _pid structure
to the process variable and the setpoint. *pv and *sp are integer pointers.
------------------------------------------------------------------------*/
void pid_init(struct _pid *warm, int process_point, int set_point)
{
struct _pid *pid;
旅孫
pid = warm;
pid->pv = process_point;
pid->sp = set_point;
}
/*----------------------------------------------------------------------------------
pid_tune
DESCRIPTION Sets the proportional gain (p_gain), integral gain (i_gain),
derivitive gain (d_gain), and the dead band (dead_band) of a pid control structure _pid. ----------------------------------------------------------------------------------------*/
void pid_tune(struct _pid *pid, float p_gain, float i_gain, float d_gain, int dead_band)
{
pid->蔽閉pgain = p_gain;
pid->igain = i_gain;
pid->dgain = d_gain;
pid->deadband = dead_band;
pid->integral= integral_val;
pid->last_error=0;
}
/*-------------------------------------------------------------------------------
pid_setinteg
DESCRIPTION Set a new value for the integral term of the pid equation.
This is useful for setting the initial output of the pid controller at start up.
--------------------------------------------------------------------------------*/
void pid_setinteg(struct _pid *pid,float new_integ)
{
pid->integral = new_integ;
pid->last_error = 0;
}
/*----------------------------------------------------------------------------------------
pid_bumpless
DESCRIPTION Bumpless transfer algorithim. When suddenly changing setpoints, or when restarting the PID equation after an extended pause, the derivative of the equation can cause a bump in the controller output.
This function will help smooth out that bump. The process value in *pv should be the updated just before this function is used.
----------------------------------------------------------------------------------------*/
void pid_bumpless(struct _pid *pid)
{
pid->last_error = (pid->sp)-(pid->pv);
}
/*----------------------------------------------------------------------------------------
pid_calc
DESCRIPTION Performs PID calculations for the _pid structure *a. This function uses the positional form of the pid equation, and incorporates an integral winp prevention algorithim. Rectangular integration is used, so this function must be repeated on a consistent time basis for accurate control. RETURN VALUE The new output value for the pid loop.
----------------------------------------------------------------------------------------*/
USAGE #include "control.h"*/
float pid_calc(struct _pid *pid)
{
int err;
float pterm, dterm, result, ferror;
err = (pid->sp) - (pid->pv);
if (abs(err) > pid->deadband)
{
ferror = (float) err; /*do integer to float conversion only once*/
pterm = pid->pgain * ferror;
if (pterm > 100 || pterm < -100)
{
pid->integral = 0.0;
} else {
pid->integral += pid->igain * ferror;
if (pid->integral > 100.0)
{
pid->integral = 100.0;
} else if (pid->integral < 0.0) pid->integral = 0.0;
}
dterm = ((float)(err - pid->last_error)) * pid->dgain;
result = pterm + pid->integral + dterm;
} else result = pid->integral;
pid->last_error = err;
return (result);
}
void main(void)
{
float display_value;
int count=0;
pid = &warm;
// printf("Enter the values of Process point, Set point, P gain, I gain, D gain \n");
// scanf("%d%d%f%f%f", &process_point, &set_point, &p_gain, &i_gain, &d_gain);
process_point = 30;
set_point = 40;
p_gain = (float)(5.2);
i_gain = (float)(0.77);
d_gain = (float)(0.18);
dead_band = 2;
integral_val =(float)(0.01);
printf("The values of Process point, Set point, P gain, I gain, D gain \n");
printf(" %6d %6d %4f %4f %4f\n", process_point, set_point, p_gain, i_gain, d_gain);
printf("Enter the values of Process point\n");
while(count<=20)
{
scanf("%d",&process_point);
pid_init(&warm, process_point, set_point);
pid_tune(&warm, p_gain,i_gain,d_gain,dead_band);
pid_setinteg(&warm,0.0); //pid_setinteg(&warm,30.0);
//Get input value for process point
pid_bumpless(&warm);
// how to display output
display_value = pid_calc(&warm);
printf("%f\n", display_value);
//printf("\n%f%f%f%f",warm.pv,warm.sp,warm.igain,warm.dgain);
count++;
}
}
E. 在ubuntu 12.04下怎樣編譯極路由1s的openwrt固件
搭建編譯環境
Ubuntu x64 12.04下的命令:
sudo apt-get install subversion
sudo apt-get install git
sudo apt-get install flex
sudo apt-get install g++
sudo apt-get install gawk
sudo apt-get install zlib1g-dev
sudo apt-get install libncurses5-dev
當然,也可以將上面的命令合起來:
sudo apt-get install subversion git flex g++ gawk zlib1g-dev libncurses5-dev
建立工作目錄及獲取openwrt源碼
mkdir openwrt
cd openwrt
svn co svn://svn.openwrt.org/openwrt/trunk/
trunk是openwrt的開發版,openwrt有好幾個分支,要編譯其它分支,sun://後的換為相應的地址即可。
建立openwrt文件夾是為了方便存放不同分支的代碼,如果你不需要,可以省略「mkdir openwrt」及「cd openwrt」。
如果svn的速度慢,可以使用openwrt的第三方鏡像,比如國內的openwrt中文論壇所建的鏡像。
更新feed及添加package
openwrt的一些額外功能都是通過package實現的,很多個package就組成了一個feed,我們可以根據需求更新自己想要的feed的源。 例如我們需要luci的web管理界面和python的支持,那麼我們需要更新luci和packages的feed源:
cd trunk
./scripts/feeds update luci packages
./scripts/feeds install luci packages
當然,我們推薦更新所有feed並添加所有package
./scripts/feeds update -a
./scripts/feeds install -a
配置及編譯
進入配置界面
make menuconfig
以後再次編譯時,要先切換到工作目錄:
cd openwrt
cd trunk
然後在次過程中選擇好target system和target profile,target system需要看你路由器的cpu晶元信息,target profile是你路由器的型號。接下來就可以根據自己的需求進行定製了,添加上需要的支持或去掉無用的包,按「Y」在固件中添加包按「Y」,按「N」去 掉不需要的包。
要運行OH3C,必須有python-mini(lang->python->python-mini)的支持。
如果你的路由器flash空間比較緊張,可以去掉下面的包:
Kernel moles->Network Support->kmod-ppp
Network->ppp
選好後就保存配置退出開始編譯了:
make -j
-j 後面可以跟參數,即同時進行的任務數,比如2或4,不跟參數意為不限制同時進行的任務數,會大大減少編譯的時間,特別是首次編譯。
編譯過程中可能不會下載一些東西,所以斷網可能造成編譯中斷,編譯所需時間與你的CPU及網速有很大關系,一般首次編譯在40分鍾到2小時之間不等。以後的編譯一般在30分鍾之內。
F. 如何自定義設備的VID PID 和VersionNumber
1.滑鼠右鍵答絕手點擊「計算機」(win xp中是『我的電腦』),選擇「管理」(或設備管理器)
注意:win xp中不能直接復制該項,此時請對照找到宏伏的PID和VID,手動輸出。清嫌
G. marlin固件裡面怎麼樣修改PID&VID
Marlin固件是reprap 3d列印機中比較常用的固件。但是並不是所有的列印機參數都是一樣的,所以在使用之前需要做好配置才能讓列印機工作正確。
更詳盡的介紹見:http://makerlab.me
你需要先到github下載marlin源代碼,下載地址是:https://github.com/ErikZalm/Marlin/tree/Marlin_v1
下載後用Arino IDE打開拓展名為ino或pde的文件,文件名應當是Marlin.pde。彎兆
打開後,IDE會同時打開同文件夾下的讓鬧慎所有文件,包括最重要的文件之一:Configuration.h文件。通過IDE上的TAB切換的Configuration.h文件。下面我會對最常用的參坦敬數進行解釋和說明,請根據自己的情況進行修改。
H. 如何編譯自己的openwrt中文固件
今天路由固件的世界幾乎都是linksys WRT54G 開創出來的, 這個型號的固件開源之後,逐漸衍生出來今天的強盡的DDWRT/tomato/openwrt固件。linksys WRT54G 是博通的晶元。 正是因為這個歷史原因,DDWRT/tomato/openwrt固件 對博通晶元的支持最好,對其他的晶元比較差, 或者根本不支持其他的晶元。 個人認為,3個固件裡面,tomato的用戶體驗相對最好。但是僅僅支持博通晶元。DDWRT對博通晶元的支持好, 對一些athero也可以,對螃蟹的支持很差。但是DDWRT固件過於陳舊,比 tomato落後很多。openwrt固件可以支持很多晶元,但是用戶體驗相對最差,但是如果想用好openwrt固件,用戶需要自己編譯openwrt固件適應各種晶元/功能,或者說用戶需要具有獨立開發新產品的能力。國內的很多垃圾路由原廠固件就是盜用的openwrt固件,開發的時候把硬體要求降到最低,一旦售出,概不維護。因為沒有優秀固件的連續支持,找到螃蟹的好芯有啥意義,難道您想幫螃蟹開發維護固件。用戶需要的功能來自於優異的固件。但是目前看來,優秀固件的只支持博通的晶元。難道您的倉庫里積壓了太多的螃蟹晶元路由,需要用新手上路的第一貼,來論壇打軟廣告。
I. 路由器的固件能反編譯嗎
可以進行反編譯。
路由器的固件通常存儲在FLASH中,通常都是以xxx.bin格式的文件形式保存的。bin格式是一種二進制文件,存儲的是路由器的機器碼,通過反編譯,可以將其還原為匯編碼,以便進行分析。獲取、反編譯及分析固件通常按下列步驟:
常見路由器的SPI FLASH編程器;
最好是用Winows 筆記本來登陸到ubuntu系統的台式機上的方式 ;
Windows 下的Putty、winhex、WinSCP軟體工具;
TTL線、網線、萬用表及烙鐵,熱風槍等工具和線材;
拆開對應的路由器設備的外殼;
查看路由器內部的的介面標識;
用萬用表找到對應的地線GND標號;
通常為了調試或升級的方便,都會保留TTL引腳;
查看是否存在有TTL線的引腳或觸點;
用准備好的TTL線連接路由器的TTL引腳或觸點;
windows下用putty中的串口項打開對應的TTL線連接的串口;
查看是否有路由器啟動的日誌信息,如果有,請仔細分析;
等路由信息啟動完畢後,看看是否有終端跳出來,是否有登陸窗口跳出;
如果有登陸窗口,但是無法輸入,或者無法猜測出對應的用戶名密碼;
用熱風槍或烙鐵取下路由器上的存儲FLASH晶元;
在Windows下用編程器提前存儲在FLASH晶元的全部固件;
用WinSCP工具將提取出的固件上傳到ubuntu系統中;
在ubuntu系統中安裝對應的固件分析工具(firmware-mod-kit、binwalk、lzma、squashfs-tools等);
用這些分析工具進行分析,分析出來後,解壓對應的數據包,提前對應的關鍵性數據進行分析。
按以上步驟可以實現對路由器的分析。
J. Gargoyle(石像鬼)固件自定義修改及編譯
參考 Gargoyle Document 及 安裝OpenWrt build system
Gargoyle固件是以Openwrt為藍本的二次開發固件,同樣開源。Gargoyle源碼地址
理論上linux系統均可編譯,筆者所用過成功編譯的Linux發行版有Archlinux,Ubuntu12.04、14.04、16.04。不同發行版所需要的軟體包不一樣,其中以Ubuntu較常用,本文以其為例。
安裝Build System:
32位系統:sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev subversion flex uglifyjs texinfo
64位系統:sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo
另外,安裝完成後,建議安裝cache:sudo apt-get install cache。
安裝完成後,確保系統可用磁碟空間不少於20GB。
打開終端(Terminal),通過命令行操作
獲取Gargoyle源碼文件:
git clone git://github.com/ericpaulbishop/gargoyle.git
進入gargoyle文件夾內查看源碼
cd gargoyle
git相關操作:
git branch #查看當前分支
git branch -r #查看本地所有分支
git branch -a #查看所有遠程分支
切換分支:
git checkout <分支名稱>
切換commit:
git checkout <commit id>