英飞凌单片机例程tc1767_taskingv33r2_pwm_ltc
- 格式:pdf
- 大小:1.25 MB
- 文档页数:47
confidential
Page 17
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Local Timer Cell /LTC4/LTC4:
Enable LTC4 after initialization. Mode: Compare with Last Timer. LTC4 register value : 0x05DB. Reset the LTC4 output by a local event or copy previous cell action. LTC4mode control: Enable high level of „Select Line Input‟.
Page 19
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Output Pins:
Click on “OUT1”.
confidential
Page 20
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
confidential
Page 4
Exercise GPTA_LTC_PWM PWM Signal Update (Coherent)
Timer
0 Compare_0(Period) 0 1 Compare_1(Period) 0 1
Reset timer
-1
Compare_0(Duty) Compare_1(Duty)
Select “GPTA0_vInit”.
confidential
Page 22
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
confidential
Page 8
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA Clock Timer Clock Control:
Enable GPTA0 Timer clock.
confidential
Page 9
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
confidential
Page 12
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Local Timer Cell /LTC0/LTC0:
Enable LTC0 after initialization. Mode selection: Timer with reset from adjacent LTC with higher order. Connect the input line to LTC0. Enable rising edge of selected input signal.
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Clock Generation / CDU / Clock Bus 7-6:
Select Divided GPTA0 clock. Select divide factor 2^1.
Open this file File Open and browse for gpta_pwm.dav.
confidential
Page 6
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
Project Settings (cont.) GPTA:
confidential
Page 7
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA Clock Module clock:
Enable GPTA Module Select fractional divider mode Set the required module clock to 40MHz
Some of the work done in the previous exercise ASC_1 can be reused in this exercise. Copy and rename the file asc_1.dav into
d:\hot\tc1767\gpta_ltc_pwm\gpta_ltc_pwm.dav
Page 14
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Local Timer Cell /LTC1/LTC1:
Enable LTC1 after initialization. Mode: Compare with Last Timer. LTC1 register value : 0x03E7. Output Control Mode: Set the LTC1 output by a local event only. LTC1 mode control: Enable low level of „Select Line Input‟.
General Purpose Timer Array Exercise GPTA_LTC_PWM
Exercise GPTA_LTC_PWM Objective
Using 5 Local Timer Cells (LTC), generate a PWM signal with switchable duty cycle and period (Signal 0 and Signal 1). Signal 0 has a period of 100us and a duty cycle of 20%,signal 1 has a period of 200us and a duty cycle of 75%. Every time the user strikes a key on its keyboard (using MTTY), the signal toggles from one duty cycle / period configuration to the other. The character is also echoed back to the PC. The update of the duty cycle / period is fully coherent and is observed on a scope.
confidential
Page 15
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Local Timer Cell /LTC2/LTC2:
Enable LTC2 after initialization. Mode: Compare with Last Timer. LTC2 register value : 0x07CF. Set the LTC2 output by a local event or copy previous cell action. LTC2 mode control: Enable high level of „Select Line Input‟.
Software Control
Pin 0.1 Channel
Pin 5.0 Trigger
Scope
confidential
Page 3
Exercise GPTA_LTC_PWM Application of 5 LTC cells
LTC0 is used as a reset timer cell and is the time base for the other cells. LTC1 defines Period 0, LTC3 Duty cycle 0. They are active when their input signal “SI” is set to 0.
Let‟s get started now!
confidential
Page 2
Exercise GPTA_LTC_PWM Block diagram
RS 232
TC1767
TxD
PC
Receive ASC Buffer
Interrupt Routine
Priority 1
GPTA TxD
Signal 0 Signal 1
Click on the GPTA0 module:
confidential
Page 10
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Clock Generation:
Click on “CDU”.
confidential
Page 11
confidential
Page 16
Exercise GPTA_LTC_PWM DAvE Configurations (cont.)
GPTA0 Local Timer Cell /LTC3/LTC3:
Enable LTC3 after initialization. Mode: Compare with Last Timer. LTC3 register value : 0x0C7. Reset the LTC3 output by a local event or copy previous cell action. LTC3mode control: Enable low level of „Select Line Input‟.