 |
 |
| |
| ubuntu8.04命令行IP地址设置方法 |
|
[ 2008-5-26 15:18:00 | By: MCUBLOG ] |
我用的是ubuntu8.04,IP命令行配置如下:
sudo gedit /etc/network/interfaces
DHCP配置如下(假设通过eth1上网)
# The primary network interface - use DHCP to find our address auto eth1 iface eth1 inet dhcp //指定为dhcp 然后重启 sudo /etc/init.d/networking restart
静态IP地址配置如下(假设通过eth1上网) # The primary network interface auto eth1 iface eth1 inet static//指定为static address 192.168.3.90//IP地址 gateway 192.168.3.1//网关 netmask 255.255.255.0//子网掩码
同样需要重启 sudo /etc/init.d/networking restart
如果有必要,配置DNS sudo gedit /etc/resolv.conf nameserver 192.168.3.2
|
|
| |
| Re:ubuntu8.04命令行IP地址设置方法 |
|
[ 2008-5-28 17:03:27 | By: chenshaocheng ] |
如果可以帮我解释一下下面这段程序(SPWM波生成实验代码).谢谢! #i nclude "math.h" #i nclude "f2407_c.h" #define PI 3.1415926 extern void ini(void); extern interrupt void timer2_isr(void); void delay5s(void); float sin_table[33]={0,0.189,0.371,0.541,0.690,0.815,0.909,0.972,0.98, 0.972,0.909,0.815,0.690,0.541,0.371,0.189,0, -0.189,-0.371,-0.541,-0.690,-0.815,-0.909,-0.972,-0.98, -0.972,-0.909,-0.815,-0.690,-0.541,-0.371,-0.189,0}; unsigned int index_pwm=0; unsigned int a,b,c=0; float timer2_per=200; unsigned int num_f_d=33; float f; unsigned int d; void main(void) { unsigned int i,j; ini(); asm(" CLRC INTM");--开总中断 for(i=0;i<10;i++) delay5s(); delay5s(); delay5s(); delay5s(); delay5s(); *IMR |= 0x0001; for(;;)delay5s();; } void delay5s(void) { unsigned long i; for(i=0;i<5000;i++); } void ini(void) { unsigned int e; *SCSR1 = 0x00FD; *SCSR2 = (*SCSR2 | 0x000B) & 0x000F; *WDCR = 0x00E8; WSGR = 0x0040; *MCRA = 0x0fc0; *MCRB = 0xFE00; *MCRC = 0x0000; *PFDATDIR = *PFDATDIR | 0x2000; *T1CON = 0x0000; *T2CON = 0x0000; *GPTCONA = 0x0080; *T1CNT = 0x0000; *T1PR =32*timer2_per; d=*T1PR; *DBTCONA = 0xff3; *ACTRA = 0x0666; *COMCONA = 0x8200; *T1CON = 0x0840; *DBTCONA=0xff3; *T2CNT = 0x0000; *T2PR = timer2_per; *T2CON = 0xD640; *IMR = 0x0000; *IFR = 0x003F; *IMR = 0x0004; *EVAIFRA = 0xFFFF; *EVAIFRB = 0xFFFF; *EVAIFRC = 0xFFFF; *EVAIMRA = 0x0000; *EVAIMRB = 0x0001; *EVAIMRC = 0x0000; *EVBIFRA = 0xFFFF; *EVBIFRB = 0xFFFF; *EVBIFRC = 0xFFFF; *EVBIMRA = 0x0000; *EVBIMRB = 0x0000; *EVBIMRC = 0x0000; } interrupt void timer2_isr(void) { *EVAIFRB = *EVAIFRB & 0x0001; f=0.2+156.0/timer2_per; if(f>0.98) f=0.98; a=*CMPR1=f*d*(0.5+0.5*sin_table[index_pwm%num_f_d]); b=*CMPR2=f*d*(0.5+0.5*sin_table[(index_pwm+((2*num_f_d)/3))%num_f_d]); c=*CMPR3=f*d*(0.5+0.5*sin_table[(index_pwm+((num_f_d)/3))%num_f_d]); index_pwm++; if(index_pwm>=num_f_d)index_pwm=0; } |
|
| |
|