In this part of the lab, we'll enhance our previous blinking LED project by using a PWM (Pulse Width Modulation) component. This will allow us to control the LED's blinking rate more precisely. We'll use the CY8CKIT-050 PSoC 5LP development kit to achieve this. The LED will light up for 50ms and turn off for 950ms, creating a more controlled blinking effect.
PSoC schematic diagram
The blinking led with PWM component project needs the following parts:
CY8CKIT-050 PSoC 5LP Development Kit
USB Cable
Project Creation:
Open PSoC Creator.
Go to File > New > Project.
Choose the target device: PSoC5LP CY8CKIT-050 (CY8C5868AXI-LP035 chip).
Select "Empty Schematic" and name the project Blinking_LED_PWM.
Hardware Configuration:
Go to the Component Catalog on the right side of the screen, search for "PWM" and drag it to the TopDesign schematic.
Add a "Digital Output Pin" and connect it to the PWM block.
Add a "Clock" and connect it to the PWM block.
Add a "Logic Low" component and connect it to the reset port of the PWM block.
Component Configuration:
Double-click the Clock component and set the frequency to 100 Hz with ±5% tolerance.
Double-click on the PWM component, rename it to PWM, set the PWM mode to one output, set the period to 99, and CMPvalue1 to 5.
In the workspace explorer, double-click on Pins under Blinking_LED_PWM.cydwr and set Port to P6[3].
Programming and Results:
Double-click on main.c in the workspace explorer under source files.
Add the code to start the PWM component
Build the design by clicking on "Build" or pressing Shift+F6.
Verify and resolve any warnings or errors.
Connect the PSoC 5LP to your computer using the USB cable.
Click on "Program" or press Ctrl+F5 to upload the code to the PSoC.
The red LED (LED3) on the board should start blinking every second.
Code for main.c
PSoC real-life implementation