Lab 7: Control Peripherals
C2000 Microcontroller Workshop - Control Peripherals 7 - 49
19. Using the “PIE Interrupt Assignment Table” find the location for the eCAP1 interrupt
“ECAP1_INT” and fill in the following information:
PIE group #: # within group:
This information will be used in the next step.
20. Modify the end of ECap_7_8_9_10_12.c to do the following:
- Enable the “ECAP1_INT” interrupt in the PIE (Hint: use the PieCtrlRegs structure)
- Enable the appropriate core interrupt in the IER register
Build and Load
21. Save all changes to the files and click the “Build” button. Select Yes to “Reload the
program automatically”. Switch back to the “CCS Debug Perspective” view by clicking
the CCS Debug icon in the upper right-hand corner.
Run the Code – Pulse Width Measurement
22. Open a memory browser to view the address label PwmPeriod. (Type &PwmPeriod in
the address box). The address label PwmDuty (address &PwmDuty) should appear in the
same memory browser window.
23. Set the memory browser properties format to “32-Bit Unsigned Integer”. We will be
running our code in real-time mode, and we will need to have the memory browser
continuously refresh.
24. Using the connector wire provided, connect the PWM1A (pin # GPIO-00) to ECAP1 (pin
# GPIO-05) on the Docking Station.
25. Run the code (real-time mode) by using the Script function: Scripts Realtime
Emulation Control Run_Realtime_with_Reset. Notice the values for
PwmDuty and PwmPeriod.
26. Fully halt the CPU (real-time mode) by using the Script function: Scripts
Realtime Emulation Control Full_Halt.
Questions:
• How do the captured values for PwmDuty and PwmPeriod relate to the compare register
CMPA and time-base period TBPRD settings for ePWM1A?
• What is the value of PwmDuty in memory?
• What is the value of PwmPeriod in memory?
• How does it compare with the expected value?