2013年10月31日 星期四

Busybox 啓動Telnte Daemon

Busybox選單有詳細的說明使用步驟,所以我下面列那些東西都是從busybox內的說明照抄的

建立步驟如下
(1)先確定linux kernel config中有UNIX98_PTYS和DEVPTS_FS
(2)確定busybox conifg有LOGIN和FEATURE SUID
(3)在目標板/dev資料夾下建立pts資料夾和製作ptmx character device node,範例如下


(4)下指令mount –t devpts devpts /dev/pts
(5)新增user root(adduser root)
(6)修改/etc/passwd(root::0:0:root,,,:/root:/bin/sh)
(7)啟動telnetd(telnetd &),然後從遠端telnet到你的目標板並輸入帳號root即可使用shell,畫面如下

2013年10月29日 星期二

C程式 平方根

C程式 平方桹

#include
#include
main(){
       float a,x=1,y;
       int i;
       printf("input a:\n");
       scanf("%f",&a);
       for(i=0;;i++)
       {
       y=x;
       x=(x+a/x)/2;
       if(fabs(y-x)<0 .0000001="" nbsp="" span="">
       break;
       }
        printf("sqrt(a)=%f",x);
       }

如何控制伺服馬達

如何控制伺服馬達
  


0°~180° Servo 

利用PWM控制角度

 Most servo motor will work well on 50 Hz of PWM frequency;
this mean the PWM signal should have a period of 20ms.
 
 
Servo Angle Schematic 180 3.8 
 
 
This servo can operate 180° when given a pulse signal ranging from 600usec to 2400usec. 
 
#define MIN_PULSE_WIDTH       600     // the shortest pulse sent to a servo 
#define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached
#define REFRESH_INTERVAL    20000     // minumim time to refresh servos in microseconds
--------------
360° Servo 

利用PWM控制轉的方向與轉速

360° servo 是藉由0.5~2.5ms  HIGH  PULSE
50Hz的脈波訊號做控制霢1.5ms  HIGH  PULSE是
位於停止的狀態;小於1.5ms  時順時霢轉動霢愈
小愈快;大於1.5ms 時霢時霢轉動霢愈大愈快。

 
 
 
------------------
 S3C6410 的PWM 如何設定,才能得到20ms的週期 (50HZ)
如果 PCLK=83MHZ, 8-bit prescaler=255 and 4-bit divider=16
Frequency=PCLK/(255+1)/16   => 20.2KHz
1/20.2K=0.0495ms
 
20ms/0.0495=404 --> TCNTB
 
TCMPB setting?:
Get 2ms    High Pulse width: 2ms/0.0495=40
Get 1.5ms High Pulse width: 2ms/0.0495=30
Get 1ms    High  Pulse width: 1ms/0.0495=20
 

MIPS ? DMIPS ? 代表的意思?

MIPS isn't generally considered a useful measure of performance - it's typically quoted based on choosing the fastest (likely one of the least capable) instructions on a machine, with no regard to the capabilities of that machine. Consider, if I built a machine that could only execute NOP, but could execute 200 million NOPs a second, it would be a 200 MIPS machine, however, if I built an entire fully feature CPU that could execute only 100 million NOPs per second (and NOP was the fastest instruction) but could also execute loads, stores, adds, multiplies etc. etc., it would be a 100 MIPS machine - however, the NOP-only machine appears (using the MIPS measure) to be twice as "good" despite being useless.

DMIPS is based on the time taken to execute a particular benchmark, something which might be considered representative of a real workload, namely Dhrystone. The DMIPS figure for a given machine is the relative speed a VAX 11/780 (a particular "1 MIPS" machine) would have to run at to complete the benchmark in the same amount of time as the machine being measured. For example, if a 100MHz CPU completes the benchmark 200 times faster than the VAX 11/780 does, then it would be considered a 200 DMIPS machine. For CPUs that can be run at various frequencies, then you'll often see this value reported divided through by MHz, e.g. 2 DMIPS/MHz in this example.

So, the quick answer is that (unlike MIPS) DMIPS can't be calculated, it can only be measured.

There are further details, and a link to the Dhrystone source code here:http://en.wikipedia.org/wiki/Dhrystone