1. Connect an LED to the output pin of the CCP1 module on your PIC-P40 board. Be sure to use a 470 Ω current limiting re
Posted: Thu Jul 14, 2022 2:37 pm
1. Connect an LED to the output pin of the CCP1 module on yourPIC-P40 board. Besure to use a 470 Ω current limiting resistor in series with theLED.Using Timer 2 and the CCP1 module, write a C program to monitor thestatus of thePIC-P40 onboard button and perform the following: while the buttonis beingpressed and held, the LED will first be illuminated using a PWMwaveform with a25% Duty Cycle (DC) for 0.5 seconds. Then the LED will beilluminated using aPWM waveform with a 50% DC for 0.5 seconds. Then the LED will beilluminatedusing a PWM waveform with a 75% DC for 0.5 seconds. Then the LEDwill beilluminated using a PWM waveform with a 100% DC for 0.5 seconds.The cycle thenrepeats, starting at a DC of 0% (ie. LED off). When the button isreleased, the LEDshould stay illuminated at whatever DC was being used while thebutton was beingpressed. The LED should be off (ie. 0% DC) on program start-up. Usea value of 45kHz for Fpwm and 20 MHz for FOSC.Use the MPLAB simulator to verify the proper operation of theprogram beforeprogramming the PIC-P40. Use the Stimulus feature of MPLAB SIM tosimulate thebutton