pwm unit 17 로봇 sw 교육원 조용수. 학습 목표 pwm pwm register 2
TRANSCRIPT
PWMUNIT
17
로봇 SW 교육원조용수
2학습 목표
• PWM• PWM Register
3PWM
• Pulse Width Modulation• 진폭이 일정한 상태에서 펄스 폭을 증 / 감 하여
신호를 변화시키는 방법• 디지털 출력으로 아날로그 회로를 제어할 수 있음 .• Duty Cycle : High Level 과 Low Level 간의 비율
4
N051 PWM
• Four PWM Generators, each generator supports• One 8-bit prescaler • One clock divider ( 1, ½, ¼, 1/8, 1/16)• Two PWM-timers for two outputs, each timer includes
• A 16-bit PWM down-counter• A 16-bit PWM reload value register (CNR)• A 16-bit PWM compare register (CMR)
• One dead-zone generator• Two PWM outputs.
• 8 PWM channels or 4 PWM paired channels.• 16 bits resolution.• Support edge and center aligned modes• Single-shot or Continuous mode PWM.
PWM/Capture Clock Source
5
6
PWM Edge Align Mode
• Duty ratio = (CMR+1) / (CNR+1)• Duty = (CMR+1) x (clock period)• Period = (CNR+1) x (clock period)
+
-
CMRn+1
CNRn
PWM-TimerComparator
Output CNRn
CMRn
Update new CMRn
StartInitialize
PWM
PWMOuput
CMRn+1CNRn+1
7
PWM Double Buffering Illustration
PWM Waveform
write a nonzero number to prescaler & setup clock dividor
Start
CNR=150 CMR=50
151
51
200
50
CNR=199 CMR=49
CNR=99 CMR=0
100
1
CNR=0 CMR=XX
Stop
New period (CNR)New duty (CMR)
S/W write new period (CNR)And new duty (CMR)
First cycle Second cy-cle
8
Operation of Dead Zone Generator • Why need the dead zone control?
– To avoid a paired-PWM outputs overlapping on duty-on du-ration.
– For example, in Motor Driver application, it needs to avoid the upper and lower power switch turn on simultaneously.
• Insert a delay time (dead zone) before duty on at each channel of paired-PWM.
• 8-bit dead-zone timer from PWM clock.
PG0 withoutdead-zone
PG1 withoutdead-zone
PWM0 withdead-zone
PWM1 withdead-zone
Dead-zone Interval
Effect of dead-zone for complementary pairs
9PWM Register
10PWM Register
11PWM Register
12PWM Register
13PWM Register
14PWM Register
15PWM Register
16PWM Register
17PWM Register
18PWM Register
19PWM Register
20PWM Register
21PWM Register
22PWM Register
23PWM Register
24PWM Register
25PWM Register
26PWM Register
27PWM Register