Lab 7: Control Peripherals
7 - 48
C2000 Microcontroller Workshop - Control Peripherals
Acquisition Buffer Size
50
DSP Data Type
16-bit unsigned integer
Sampling Rate (Hz)
50000
Start Address
AdcBuf
Data Plot Style
Bar
FFT Order
10
Select
OK
to save the graph options.
12.
On the plot window, hold the mouse left-click key and move the marker line to observe
the frequencies of the different magnitude peaks. Do the peaks occur at the expected
frequencies?
13.
Fully halt the CPU (real-time mode) by using the Script function:
Scripts
Realtime Emulation Control
Full_Halt
.
Setup eCAP1 to Measure Width of Pulse
The first part of this lab exercise generated a 2 kHz, 25% duty cycle symmetric PWM
waveform which was sampled with the on-chip analog-to-digital converter and displayed
using the graphing feature of Code Composer Studio. Next, eCAP1 will be setup to detect
the rising and falling edges of the waveform. This information will be used to determine the
period and duty cycle of the waveform. The results of this step will be viewed numerically in
a memory window and can be compared to the results obtained using the graphing features of
Code Composer Studio.
14.
Switch to the “CCS Edit Perspective” view by clicking the
CCS Edit
icon in the upper
right-hand corner. Add the following file to the project from
C:\C28x\Labs\Lab7\Files
:
ECap_7_8_9_10_12.c
Check your files list to make sure the file is there.
15.
In
Main_7.c
, add code to call the
InitECap()
function. There are no passed
parameters or return values, so the call code is simply:
InitECap();
16.
Edit
Gpio.c
and adjust the shared I/O pin in GPIO5 for the ECAP1 function.
17.
Open and inspect the eCAP1 interrupt service routine (ECAP1_INT_ISR) in the file
DefaultIsr_7.c
. Notice that PwmDuty is calculated by CAP2 – CAP1 (rising to
falling edge) and that PwmPeriod is calculated by CAP3 – CAP1 (rising to rising edge).
18.
In
ECap_7_8_9_10_12.c
, setup eCAP1 to calculate PWM_duty and PWM_period.
The following registers need to be modified: ECCTL2 (continuous mode, re-arm disable,
and sync disable), ECCTL1 (set prescale to divide-by-1, configure capture event polarity
without reseting the counter), and ECEINT (enable desired eCAP interrupt).
Содержание C2000 Piccolo LaunchPad
Страница 74: ...Interrupts 4 18 C2000 Microcontroller Workshop Reset and Interrupts ...
Страница 100: ...Lab 5 System Initialization 5 26 C2000 Microcontroller Workshop System Initialization ...
Страница 126: ...Lab 6 Analog to Digital Converter 6 26 C2000 Microcontroller Workshop Analog to Digital Converter ...
Страница 218: ...Lab 8 IQmath FIR Filter 8 42 C2000 Microcontroller Workshop Numerical Concepts ...
Страница 236: ...Lab 9 Servicing the ADC with DMA 9 18 C2000 Microcontroller Workshop Direct Memory Access Controller ...
Страница 260: ...Lab 10 CLA Floating Point FIR Filter 10 24 C2000 Microcontroller Workshop Control Law Accelerator ...
Страница 331: ...C2000 Microcontroller Workshop Appendix A Experimenter s Kit A 1 Appendix A Experimenter s Kit ...
Страница 334: ...F28069 controlCARD A 4 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 ...
Страница 336: ...F28035 controlCARD A 6 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 SW3 ...
Страница 338: ...F28335 controlCARD A 8 C2000 Microcontroller Workshop Appendix A Experimenter s Kit LD1 LD2 LD3 SW1 ...