SlideShare a Scribd company logo
伺服馬達控制


         Joseph Chen
360° Servo

 伺服馬達控制主要利用PWM控制轉的方向
 與轉速
 360° servo 需要50Hz的脈波週期訊號 並藉由0.5~2.5ms HIGH PULSE做
 控制
 等於1.5ms HIGH PULSE是位於停止的狀態
 小於1.5ms 順時針轉動, 若值愈小轉速可愈快
 大於1.5ms 逆時針轉動,若值愈大轉速可愈快。
The S3C6410X RISC microprocessor comprises of
five 32-bit timers. These timers are used to
generate internal interrupts to the ARM
subsystem.
Timers 0 and 1 include a PWM function (Pulse
Width Modulation), which can drive an external
I/O signal. The PWM for timer 0 and 1 have an
optional dead-zone generator capability, which
can be utilized to support a large current device.
Timer 2, 3 and 4 are internal timers with no
output pins.
Clock Generation Scheme for PWM
PWM Function Block


                            TCNTB     TCMPB
                                               Manual Update=1
                                               Auto reload=1
PCLK   Prescaler   Divder                      when TCNT reaches 0
                            TCNT        TCMP   TCNT=TCNB
                                               TCMP=TCMPB
                             TCNTO

                             TCFG       TCON



                            Double Buffering
PWM waveform
REGISTER MAP
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                     TOUT
                             Pulse Width



 TCMPB setting?:
 Get 2ms High Pulse width: 2ms/0.0495=40
 Get 1.5ms High Pulse width: 1.5ms/0.0495=30
 Get 1ms High Pulse width: 1ms/0.0495=20
dc_motor.c


 static int __init dcm_init(void)
 {
             int retval;
             retval = register_chrdev(DCM_MAJOR,dcm_name,&dcm_fops);
             if(retval < 0)
             {
                         printk(KERN_WARNING"Can't get major %dn",DCM_MAJOR);
                         return retval;
             }
             s3c6410_timer_setup(0,10,100,0);
             pwm_init(PERIOD); //unit: 20000us
             printk("Serveo_motor driver register success!n");
             return 0;
 }
static void pwm_init(unsigned long period)
{
                                                             Period=20000us
    // initial the timer period
               unsigned long tcnt;
                                                             時間(週期)
                                                             = Y HZ (Y次/s)* period
     hi_pulse=0;
                                                             =次/s *(us/106)
     tcnt=(period*(( PCLK )/((255+1)*16 )))/1000000;

     printk(KERN_WARNING"%s:tcnt=%ldn",__func__,tcnt);

//           tcnt =( 96000000 )/( FREQ_PWM1 *16 );
             __raw_writel(tcnt, S3C_TCNTB(0));
             __raw_writel(((tcnt*(0))/100), S3C_TCMPB(0));

}
s3c6410_timer_setup

 int s3c6410_timer_setup (int channel, int usec,
 unsigned long g_tcnt, unsigned long g_tcmp)
 Parameters:
  1)   channel: PWM channel 0/1
  2)   usec: unused
  3)   g_tcnt: unused
  4)   g_tcmp: unused
/* set gpio as PWM TIMER0 to signal output*/
s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C64XX_GPF14_PWM_TOUT0);
s3c_gpio_setpull(S3C64XX_GPF(14), S3C_GPIO_PULL_NONE);
tcfg1 &= ~S3C_TCFG1_MUX0_MASK;
tcfg1 |= 4; // set divider 16 , by jospeh

tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK;
tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER0_SHIFT;
tcon &= ~(7<<0);
tcon |= S3C_TCON_T0RELOAD;
User space Code

 232, 0 /dev/pwm0
 232,1 /dev/pwm1
 fd_l=open(“/dev/pwm0”);
  ioctl(fd_l,cmd,arg);
 fd_r=open(“dev/pmm1”);
 Ioctl(fd_r,cmd,arg)

More Related Content

What's hot

Boost.Coroutine
Boost.CoroutineBoost.Coroutine
Boost.Coroutinemelpon
 
コルーチンでC++でも楽々ゲーム作成!
コルーチンでC++でも楽々ゲーム作成!コルーチンでC++でも楽々ゲーム作成!
コルーチンでC++でも楽々ゲーム作成!
amusementcreators
 
MCC CTF講習会 pwn編
MCC CTF講習会 pwn編MCC CTF講習会 pwn編
MCC CTF講習会 pwn編
hama7230
 
物聯網技術分享 使用ESP8266
物聯網技術分享 使用ESP8266物聯網技術分享 使用ESP8266
物聯網技術分享 使用ESP8266
Power Wu
 
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Worksfrom Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
National Cheng Kung University
 
Raft
RaftRaft
C++ Template Metaprogramming
C++ Template MetaprogrammingC++ Template Metaprogramming
C++ Template MetaprogrammingAkira Takahashi
 
用十分鐘 向jserv學習作業系統設計
用十分鐘  向jserv學習作業系統設計用十分鐘  向jserv學習作業系統設計
用十分鐘 向jserv學習作業系統設計
鍾誠 陳鍾誠
 
Design by contractとホーア論理
Design by contractとホーア論理Design by contractとホーア論理
Design by contractとホーア論理Takuya Matsunaga
 
Pci express transaction
Pci express transactionPci express transaction
Pci express transaction
y38y38
 
STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強
STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強
STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強
Kiyoshi Ogawa
 
ELFの動的リンク
ELFの動的リンクELFの動的リンク
ELFの動的リンク
7shi
 
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
Takateru Yamagishi
 
x86とコンテキストスイッチ
x86とコンテキストスイッチx86とコンテキストスイッチ
x86とコンテキストスイッチ
Masami Ichikawa
 
ARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- OverviewARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- Overview
National Cheng Kung University
 
Raspberry pi 基本操作
Raspberry pi 基本操作Raspberry pi 基本操作
Raspberry pi 基本操作
艾鍗科技
 
C# でブロックチェーン実装
C# でブロックチェーン実装C# でブロックチェーン実装
C# でブロックチェーン実装
Yuto Takei
 
Pci express data link
Pci express data linkPci express data link
Pci express data link
y38y38
 
Dockerのネットワークについて
DockerのネットワークについてDockerのネットワークについて
Dockerのネットワークについて
Nobuyuki Matsui
 

What's hot (20)

Boost.Coroutine
Boost.CoroutineBoost.Coroutine
Boost.Coroutine
 
コルーチンでC++でも楽々ゲーム作成!
コルーチンでC++でも楽々ゲーム作成!コルーチンでC++でも楽々ゲーム作成!
コルーチンでC++でも楽々ゲーム作成!
 
MCC CTF講習会 pwn編
MCC CTF講習会 pwn編MCC CTF講習会 pwn編
MCC CTF講習会 pwn編
 
物聯網技術分享 使用ESP8266
物聯網技術分享 使用ESP8266物聯網技術分享 使用ESP8266
物聯網技術分享 使用ESP8266
 
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Worksfrom Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
 
Raft
RaftRaft
Raft
 
C++ Template Metaprogramming
C++ Template MetaprogrammingC++ Template Metaprogramming
C++ Template Metaprogramming
 
用十分鐘 向jserv學習作業系統設計
用十分鐘  向jserv學習作業系統設計用十分鐘  向jserv學習作業系統設計
用十分鐘 向jserv學習作業系統設計
 
Design by contractとホーア論理
Design by contractとホーア論理Design by contractとホーア論理
Design by contractとホーア論理
 
Pci express transaction
Pci express transactionPci express transaction
Pci express transaction
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
 
STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強
STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強
STARC RTL設計スタイルガイドによるVerilog HDL並列記述の補強
 
ELFの動的リンク
ELFの動的リンクELFの動的リンク
ELFの動的リンク
 
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
CUDAのアセンブリ言語基礎のまとめ PTXとSASSの概説
 
x86とコンテキストスイッチ
x86とコンテキストスイッチx86とコンテキストスイッチ
x86とコンテキストスイッチ
 
ARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- OverviewARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- Overview
 
Raspberry pi 基本操作
Raspberry pi 基本操作Raspberry pi 基本操作
Raspberry pi 基本操作
 
C# でブロックチェーン実装
C# でブロックチェーン実装C# でブロックチェーン実装
C# でブロックチェーン実装
 
Pci express data link
Pci express data linkPci express data link
Pci express data link
 
Dockerのネットワークについて
DockerのネットワークについてDockerのネットワークについて
Dockerのネットワークについて
 

Similar to 伺服馬達控制

PWM based motor speed control using LPC 1768
PWM based motor speed control using LPC 1768PWM based motor speed control using LPC 1768
PWM based motor speed control using LPC 1768
Omkar Rane
 
AVR_Course_Day7 timers counters and interrupt programming
AVR_Course_Day7 timers counters and  interrupt programmingAVR_Course_Day7 timers counters and  interrupt programming
AVR_Course_Day7 timers counters and interrupt programming
Mohamed Ali
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
Keroles karam khalil
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
Aarav Soni
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
Ruthvik Vaila
 
Ec8791 lpc2148 pwm
Ec8791 lpc2148 pwmEc8791 lpc2148 pwm
Ec8791 lpc2148 pwm
RajalakshmiSermadurai
 
PWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfPWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdf
DuyKhng31
 
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
Tsuyoshi Horigome
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16
Ramadan Ramadan
 
LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料
Tsuyoshi Horigome
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
cjbas
 
Timers in Arduino
Timers in ArduinoTimers in Arduino
Timers in Arduino
VEDANSH SHARMA
 
Sereial com. ppt
Sereial com. pptSereial com. ppt
Sereial com. pptgaurav5345
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersCorrado Santoro
 

Similar to 伺服馬達控制 (20)

PWM based motor speed control using LPC 1768
PWM based motor speed control using LPC 1768PWM based motor speed control using LPC 1768
PWM based motor speed control using LPC 1768
 
AVR_Course_Day7 timers counters and interrupt programming
AVR_Course_Day7 timers counters and  interrupt programmingAVR_Course_Day7 timers counters and  interrupt programming
AVR_Course_Day7 timers counters and interrupt programming
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
 
Ec8791 lpc2148 pwm
Ec8791 lpc2148 pwmEc8791 lpc2148 pwm
Ec8791 lpc2148 pwm
 
PWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfPWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdf
 
12 mt06ped007
12 mt06ped007 12 mt06ped007
12 mt06ped007
 
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16
 
LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
 
Timers in Arduino
Timers in ArduinoTimers in Arduino
Timers in Arduino
 
Timers
TimersTimers
Timers
 
Sereial com. ppt
Sereial com. pptSereial com. ppt
Sereial com. ppt
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F Microcontrollers
 
Hy 523
Hy 523Hy 523
Hy 523
 

More from 艾鍗科技

TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
艾鍗科技
 
Appendix 1 Goolge colab
Appendix 1 Goolge colabAppendix 1 Goolge colab
Appendix 1 Goolge colab
艾鍗科技
 
Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用
艾鍗科技
 
02 IoT implementation
02 IoT implementation02 IoT implementation
02 IoT implementation
艾鍗科技
 
Openvino ncs2
Openvino ncs2Openvino ncs2
Openvino ncs2
艾鍗科技
 
Step motor
Step motorStep motor
Step motor
艾鍗科技
 
2. 機器學習簡介
2. 機器學習簡介2. 機器學習簡介
2. 機器學習簡介
艾鍗科技
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
艾鍗科技
 
3. data features
3. data features3. data features
3. data features
艾鍗科技
 
心率血氧檢測與運動促進
心率血氧檢測與運動促進心率血氧檢測與運動促進
心率血氧檢測與運動促進
艾鍗科技
 
利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆
艾鍗科技
 
IoT感測器驅動程式 在樹莓派上實作
IoT感測器驅動程式在樹莓派上實作IoT感測器驅動程式在樹莓派上實作
IoT感測器驅動程式 在樹莓派上實作
艾鍗科技
 
無線聲控遙控車
無線聲控遙控車無線聲控遙控車
無線聲控遙控車
艾鍗科技
 
最佳光源的研究和實作
最佳光源的研究和實作最佳光源的研究和實作
最佳光源的研究和實作
艾鍗科技
 
無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車
艾鍗科技
 
Reinforcement Learning
Reinforcement LearningReinforcement Learning
Reinforcement Learning
艾鍗科技
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
艾鍗科技
 
人臉辨識考勤系統
人臉辨識考勤系統人臉辨識考勤系統
人臉辨識考勤系統
艾鍗科技
 
智慧家庭Smart Home
智慧家庭Smart Home智慧家庭Smart Home
智慧家庭Smart Home
艾鍗科技
 
智能健身
智能健身智能健身
智能健身
艾鍗科技
 

More from 艾鍗科技 (20)

TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Appendix 1 Goolge colab
Appendix 1 Goolge colabAppendix 1 Goolge colab
Appendix 1 Goolge colab
 
Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用
 
02 IoT implementation
02 IoT implementation02 IoT implementation
02 IoT implementation
 
Openvino ncs2
Openvino ncs2Openvino ncs2
Openvino ncs2
 
Step motor
Step motorStep motor
Step motor
 
2. 機器學習簡介
2. 機器學習簡介2. 機器學習簡介
2. 機器學習簡介
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
 
3. data features
3. data features3. data features
3. data features
 
心率血氧檢測與運動促進
心率血氧檢測與運動促進心率血氧檢測與運動促進
心率血氧檢測與運動促進
 
利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆
 
IoT感測器驅動程式 在樹莓派上實作
IoT感測器驅動程式在樹莓派上實作IoT感測器驅動程式在樹莓派上實作
IoT感測器驅動程式 在樹莓派上實作
 
無線聲控遙控車
無線聲控遙控車無線聲控遙控車
無線聲控遙控車
 
最佳光源的研究和實作
最佳光源的研究和實作最佳光源的研究和實作
最佳光源的研究和實作
 
無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車
 
Reinforcement Learning
Reinforcement LearningReinforcement Learning
Reinforcement Learning
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
人臉辨識考勤系統
人臉辨識考勤系統人臉辨識考勤系統
人臉辨識考勤系統
 
智慧家庭Smart Home
智慧家庭Smart Home智慧家庭Smart Home
智慧家庭Smart Home
 
智能健身
智能健身智能健身
智能健身
 

Recently uploaded

PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Steel & Timber Design according to British Standard
Steel & Timber Design according to British StandardSteel & Timber Design according to British Standard
Steel & Timber Design according to British Standard
AkolbilaEmmanuel1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
Nettur Technical Training Foundation
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 

Recently uploaded (20)

PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Steel & Timber Design according to British Standard
Steel & Timber Design according to British StandardSteel & Timber Design according to British Standard
Steel & Timber Design according to British Standard
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 

伺服馬達控制

  • 1. 伺服馬達控制 Joseph Chen
  • 2. 360° Servo 伺服馬達控制主要利用PWM控制轉的方向 與轉速 360° servo 需要50Hz的脈波週期訊號 並藉由0.5~2.5ms HIGH PULSE做 控制 等於1.5ms HIGH PULSE是位於停止的狀態 小於1.5ms 順時針轉動, 若值愈小轉速可愈快 大於1.5ms 逆時針轉動,若值愈大轉速可愈快。
  • 3.
  • 4. The S3C6410X RISC microprocessor comprises of five 32-bit timers. These timers are used to generate internal interrupts to the ARM subsystem. Timers 0 and 1 include a PWM function (Pulse Width Modulation), which can drive an external I/O signal. The PWM for timer 0 and 1 have an optional dead-zone generator capability, which can be utilized to support a large current device. Timer 2, 3 and 4 are internal timers with no output pins.
  • 6. PWM Function Block TCNTB TCMPB Manual Update=1 Auto reload=1 PCLK Prescaler Divder when TCNT reaches 0 TCNT TCMP TCNT=TCNB TCMP=TCMPB TCNTO TCFG TCON Double Buffering
  • 9.
  • 10. 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 TOUT Pulse Width TCMPB setting?: Get 2ms High Pulse width: 2ms/0.0495=40 Get 1.5ms High Pulse width: 1.5ms/0.0495=30 Get 1ms High Pulse width: 1ms/0.0495=20
  • 11. dc_motor.c static int __init dcm_init(void) { int retval; retval = register_chrdev(DCM_MAJOR,dcm_name,&dcm_fops); if(retval < 0) { printk(KERN_WARNING"Can't get major %dn",DCM_MAJOR); return retval; } s3c6410_timer_setup(0,10,100,0); pwm_init(PERIOD); //unit: 20000us printk("Serveo_motor driver register success!n"); return 0; }
  • 12. static void pwm_init(unsigned long period) { Period=20000us // initial the timer period unsigned long tcnt; 時間(週期) = Y HZ (Y次/s)* period hi_pulse=0; =次/s *(us/106) tcnt=(period*(( PCLK )/((255+1)*16 )))/1000000; printk(KERN_WARNING"%s:tcnt=%ldn",__func__,tcnt); // tcnt =( 96000000 )/( FREQ_PWM1 *16 ); __raw_writel(tcnt, S3C_TCNTB(0)); __raw_writel(((tcnt*(0))/100), S3C_TCMPB(0)); }
  • 13. s3c6410_timer_setup int s3c6410_timer_setup (int channel, int usec, unsigned long g_tcnt, unsigned long g_tcmp) Parameters: 1) channel: PWM channel 0/1 2) usec: unused 3) g_tcnt: unused 4) g_tcmp: unused
  • 14. /* set gpio as PWM TIMER0 to signal output*/ s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C64XX_GPF14_PWM_TOUT0); s3c_gpio_setpull(S3C64XX_GPF(14), S3C_GPIO_PULL_NONE); tcfg1 &= ~S3C_TCFG1_MUX0_MASK; tcfg1 |= 4; // set divider 16 , by jospeh tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK; tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER0_SHIFT; tcon &= ~(7<<0); tcon |= S3C_TCON_T0RELOAD;
  • 15. User space Code 232, 0 /dev/pwm0 232,1 /dev/pwm1 fd_l=open(“/dev/pwm0”); ioctl(fd_l,cmd,arg); fd_r=open(“dev/pmm1”); Ioctl(fd_r,cmd,arg)