Introduction to Microcontrollers Lab Manual - Microchip
Introduction to Microcontrollers Lab Manual - Microchip
Introduction to Microcontrollers Lab Manual - Microchip
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
7.1 OBJECTIVE<br />
7.2 PRE-LAB<br />
<strong>Lab</strong> 7. Pulse-Width Modula<strong>to</strong>r (PWM)<br />
LABS<br />
Configure one of the PIC24FJ256GB110 Output Compare Blocks as a PWM <strong>to</strong> drive<br />
an LED and generate a “heart beat” similar <strong>to</strong> the power LED on a Macin<strong>to</strong>sh computer.<br />
7.2.1 Reference Material<br />
• PIC24FJ256GB110 Family Data Sheet (DS39897)<br />
• 16-Bit MCU and DSC Programmer's Reference <strong>Manual</strong> (DS70157)<br />
• MPLAB IDE User's Guide (DS51519)<br />
• PIC24F Family Reference <strong>Manual</strong> – Section 8. Interrupts (DS39707)<br />
• PIC24F Family Reference <strong>Manual</strong> – Section 12. I/O Ports with Peripheral Pin<br />
Select (PPS) (DS39711)<br />
• PIC24F Family Reference <strong>Manual</strong> – Section 35. Output Compare with Dedicated<br />
Timer (DS39723)<br />
7.2.2 Pulse-Width Modulation (PWM) Mode<br />
Pulse-Width Modulation is used <strong>to</strong> efficiently regulate the amount of electrical power<br />
delivered <strong>to</strong> a load by quickly switching power between fully ON and fully OFF.<br />
The “duty cycle” is the proportion of ON time in the “period” and is often expressed in<br />
percentage. 75% duty cycle would be delivering power ¾ of the time, and 100% would<br />
be fully on.<br />
A very simple implementation can be used <strong>to</strong> deliver an average voltage of 1.67V by<br />
pulse-width modulating 5V with a 33% duty cycle as illustrated below.<br />
FIGURE 7-1: BASIC PWM TO CONTROL POWER DELIVERY<br />
A more complicated implementation can be used <strong>to</strong> deliver sinusoidal power. This is a<br />
similar example <strong>to</strong> what we will be doing in this lab.<br />
2011 <strong>Microchip</strong> Technology Inc. DS51963A-page 51