Lab 7: Control Peripherals
7 - 50 C2000 Microcontroller Workshop - Control Peripherals
Terminate Debug Session and Close Project
27. Terminate the active debug session using the Terminate button. This will close the
debugger and return CCS to the “CCS Edit Perspective” view.
28. Next, close the project by right-clicking on Lab7 in the Project Explorer window
and select Close Project.
Optional Exercise
If you finish early, you might want to experiment with the code by observing the effects of
changing the ePWM1 CMPA register using real-time emulation. Be sure that the jumper wire is
connecting PWM1A (pin # GPIO-00) to ADCINA0 (pin # ADC-A0), and the Single Time graph
is displayed. The graph must be enabled for continuous refresh. Run the code in real-time
mode. Open an Expressions window to the EPwm1Regs.CMPA register – in EPwm.c highlight
the “EPwm1Regs” structure and right click, then select Add Watch Expression… and then OK.
In the Expressions window open “EPwm1Regs”, then open “CMPA” and open “half”. Under
“half” change the “CMPA” value. The Expressions window must be enabled for continuous
refresh. Notice the effect on the PWM waveform in the graph.
You have just modulated the PWM waveform by manually changing the CMPA value. Next, we
will modulate the PWM automatically by having the ADC ISR change the CMPA value. In
DefaultIsr.c notice the code in ADCINT1_ADC used to modulate the ePWM1A output between
10% and 90% duty cycle. In Main.c add “PWM_MODULATE” to the Expressions window
using the same procedure above. Then with the code running in real-time mode, change the
“PWM_MODULATE” from 0 to 1 and observe the PWM waveform in the graph. Also, in the
Expressions window notice the CMPA value being updated. (If you do not have time to work on
this optional exercise, you may want to try this after the class).
End of Exercise