SlideShare a Scribd company logo
1 of 15
伺服馬達控制


         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

Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCanSecWest
 
SLAM技術分享 (輪型機器人的移動議題)
SLAM技術分享 (輪型機器人的移動議題)SLAM技術分享 (輪型機器人的移動議題)
SLAM技術分享 (輪型機器人的移動議題)Kung-Han Chen
 
一人でもNFC開発
一人でもNFC開発一人でもNFC開発
一人でもNFC開発Hirokuma Ueno
 
Raspberry pi 基本操作
Raspberry pi 基本操作Raspberry pi 基本操作
Raspberry pi 基本操作艾鍗科技
 
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!Mr. Vengineer
 
Arduino 底層原始碼解析心得
Arduino 底層原始碼解析心得Arduino 底層原始碼解析心得
Arduino 底層原始碼解析心得roboard
 
ROS 2 Client Library for E^2
ROS 2 Client Library for E^2ROS 2 Client Library for E^2
ROS 2 Client Library for E^2Hideki Takase
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicJoseph Lu
 
2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-
2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-
2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-Asuka Nakajima
 
超簡単!TELNETの話
超簡単!TELNETの話超簡単!TELNETの話
超簡単!TELNETの話ogatay
 
Use After Free 脆弱性攻撃を試す
Use After Free 脆弱性攻撃を試すUse After Free 脆弱性攻撃を試す
Use After Free 脆弱性攻撃を試すmonochrojazz
 
mbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdfmbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdf吳錫修 (ShyiShiou Wu)
 
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)Kuniyasu Suzaki
 
ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介sounakano
 
技術紹介: S2E: Selective Symbolic Execution Engine
技術紹介: S2E: Selective Symbolic Execution Engine技術紹介: S2E: Selective Symbolic Execution Engine
技術紹介: S2E: Selective Symbolic Execution EngineAsuka Nakajima
 

What's hot (20)

Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
 
SLAM技術分享 (輪型機器人的移動議題)
SLAM技術分享 (輪型機器人的移動議題)SLAM技術分享 (輪型機器人的移動議題)
SLAM技術分享 (輪型機器人的移動議題)
 
一人でもNFC開発
一人でもNFC開発一人でもNFC開発
一人でもNFC開発
 
Raspberry pi 基本操作
Raspberry pi 基本操作Raspberry pi 基本操作
Raspberry pi 基本操作
 
IIJmio meeting 18 eSIMとMVNO
IIJmio meeting 18 eSIMとMVNOIIJmio meeting 18 eSIMとMVNO
IIJmio meeting 18 eSIMとMVNO
 
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!
 
mbot2.0教學-光感測器與LED應用.pdf
mbot2.0教學-光感測器與LED應用.pdfmbot2.0教學-光感測器與LED應用.pdf
mbot2.0教學-光感測器與LED應用.pdf
 
Arduino 底層原始碼解析心得
Arduino 底層原始碼解析心得Arduino 底層原始碼解析心得
Arduino 底層原始碼解析心得
 
ROS 2 Client Library for E^2
ROS 2 Client Library for E^2ROS 2 Client Library for E^2
ROS 2 Client Library for E^2
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
 
2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-
2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-
2014年10月江戸前セキュリティ勉強会資料 -セキュリティ技術者になるには-
 
超簡単!TELNETの話
超簡単!TELNETの話超簡単!TELNETの話
超簡単!TELNETの話
 
Use After Free 脆弱性攻撃を試す
Use After Free 脆弱性攻撃を試すUse After Free 脆弱性攻撃を試す
Use After Free 脆弱性攻撃を試す
 
IIJmio meeting 19 IIJ フルMVNO徹底解説
IIJmio meeting 19 IIJ フルMVNO徹底解説IIJmio meeting 19 IIJ フルMVNO徹底解説
IIJmio meeting 19 IIJ フルMVNO徹底解説
 
mbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdfmbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdf
 
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
 
ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介
 
技術紹介: S2E: Selective Symbolic Execution Engine
技術紹介: S2E: Selective Symbolic Execution Engine技術紹介: S2E: Selective Symbolic Execution Engine
技術紹介: S2E: Selective Symbolic Execution Engine
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 

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 1768Omkar 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 programmingMohamed Ali
 
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 IIOmar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming IIOmar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming IIOmar 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/50Ruthvik Vaila
 
PWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfPWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfDuyKhng31
 
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)
LED電源回路アプリケーションガイド 浜松プレゼン資料(浜松プレゼン)Tsuyoshi Horigome
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Ramadan Ramadan
 
LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料LED電源回路アプリケーションガイド 金沢プレゼン資料
LED電源回路アプリケーションガイド 金沢プレゼン資料Tsuyoshi Horigome
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counterscjbas
 
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艾鍗科技
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge艾鍗科技
 
2. 機器學習簡介
2. 機器學習簡介2. 機器學習簡介
2. 機器學習簡介艾鍗科技
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 艾鍗科技
 
心率血氧檢測與運動促進
心率血氧檢測與運動促進心率血氧檢測與運動促進
心率血氧檢測與運動促進艾鍗科技
 
利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆艾鍗科技
 
IoT感測器驅動程式 在樹莓派上實作
IoT感測器驅動程式在樹莓派上實作IoT感測器驅動程式在樹莓派上實作
IoT感測器驅動程式 在樹莓派上實作艾鍗科技
 
無線聲控遙控車
無線聲控遙控車無線聲控遙控車
無線聲控遙控車艾鍗科技
 
最佳光源的研究和實作
最佳光源的研究和實作最佳光源的研究和實作
最佳光源的研究和實作 艾鍗科技
 
無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車 艾鍗科技
 
Reinforcement Learning
Reinforcement LearningReinforcement Learning
Reinforcement Learning艾鍗科技
 
人臉辨識考勤系統
人臉辨識考勤系統人臉辨識考勤系統
人臉辨識考勤系統艾鍗科技
 
智慧家庭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
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge
 
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

Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectErbil Polytechnic University
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxNiranjanYadav41
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectDM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectssuserb6619e
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 

Recently uploaded (20)

Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction Project
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptx
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectDM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 

伺服馬達控制

  • 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)