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>