Hi everyone, as I said before I had lots of experiences after we had completed our CanSat project and I heard new technologies. Today, we’re going to talk about PSoC devices which I wonder always. I’m new on these devices so I don’t know details but I have an application with one of them and I want to show you this application.

But firstly, let’s talk about PSoC. Actually I have no detail research about these devices but an engineer who is good at own job said me “These devices are like Arduino but you can assign any task to any pin” and I said “Wooovovv” 😀 And now, I have one(PSoC 5LP, CY8CKIT-059) and I’ve applied different examples on this device, it’s really amazing device. This device is a FPGA and an Arduino at the same time.

We’re going to program a led to blink softly like breathing. We can do this application with a C code on Arduino or other MCUs but we can do this using hardware design with PSoC devices 🙂

Let’s start.

Step 1: Create new project with “Target Kit: PSoC5LP”

Step 2: Click TopDesign.cysch on the top of the left workplace. And draw the circuit that you designed.

We have a clock, two PWMs, a XOR gate and a pin. Our PWMs have different period values and our circuit uses XOR gate to provide new signal from ouput of PWMs.

PWM_1 -> 8 bit, its period is 255 and and its CMP Value is 127

PWM_1 -> 8 bit, its period is 251 and and its CMP Value is 125

Step 3: Assign tasks to pins

Click the Pins on the left workplace

Assign task to pins by numbers on the hardware.

P2[1] means “2.1” that is on the hardware.

Step 4: Build -> Build <<Design01>>

After building, we can see a c file that its name “main.c”

Click twice on main.c, we’ll add some code line.

Step 5: A little code 🙂

#include "project.h"

int main(void)
{
    //CyGlobalIntEnable; /* Enable global interrupts. */
    
    PWM_1_Start();
    PWM_2_Start();

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

    for(;;)
    {
        /* Place your application code here. */
    }
}

Step 6: Debug -> Program

Result:

As you see, the led can’t blink softly there is a thing like  freezing effect. We’ll discuss this in the next post.