You are here

how to generate a square wave of frequency 50 Hz using PSOC3 | Cypress Semiconductor

how to generate a square wave of frequency 50 Hz using PSOC3

Summary: 21 Replies, Latest post by danaaknight on 08 Aug 2012 07:50 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
sakki's picture
User
9 posts

 It should have an amplitude of 5V.

Im doing project on PSOC plz help me continue my work.humble request...

plz help me..

U2
uday's picture
Cypress Employee
569 posts

 It is possible to generate square pulses using PWM or Counter/Timer component. This example project should help you do the same. Note that the amplitude of the square wvae is dependent on the voltage at which the I/O system is working. In PSoC3 the I/O system is divided into 4 quadrants and each quadrant has it's own supply pin. VDDIO0, VDDIO1,VDDIO2,VDDIO3. Hence to get an amplitude of 5Volt the VDDIO that corresponds this particular pin needs to be connected to 5V(any desirable voltage).

U2
uday's picture
Cypress Employee
569 posts

This example project should get you started, Pulse Width Modulator - PSoC® 3 / PSoC 5 

deeps's picture
User
26 posts

 Hi,

Is it possible to produce 50 Hz with this.

 

deeps's picture
User
26 posts

 Hi,

Is it possible to produce 50Hz using this work. What modifications are required.

U2
uday's picture
Cypress Employee
569 posts

Yes, it is possible to generate a 50 hz signal by modifying this project. The project as such has a 1Mhz clock connected to the PWM component. Change this clock to 100 Khz by double clicking the component. Now double click the PWM component, in the configuration GUI, set Period as 19 to give a time period of 20ms. This gives a square wave of frequency 50 hz. The dutycycle is determined by the compare value. To get 50 % duty cylcle set the "compare value 1" parameter to 9.

deeps's picture
User
26 posts

Thank u

deeps's picture
User
26 posts

 hai U2,

I need an out of phase square wave too,in order to drive the inverter circuit.

I have used Look Up Table (LUT) block to invert the present 50Hz square wave.

Actually the square wave is inverted but not having the same amplitude.

What shud I do to obtain same amplitude ,infact I can do using external circuit ; but I need to know that is it possible with PSOC itself.

Plz help.

 

dasg's picture
Cypress Employee
730 posts

Hi Deeps,

 

You can easily get the inverted square wave by connecting a NOT gate (from Logic category of component catalog).

You can connect the NOT gate in parallel with the PWM output and connect it with an output pin which is configured to 'Strong Drive' mode.

 

If the corresponding Vddio is connected to 5V, then the output will remain at 5V.

deeps's picture
User
26 posts

 hi dasq,

I have used the NOT block, but it was unsuccessful.

 

 

U2
uday's picture
Cypress Employee
569 posts

There is another way of doing this, Double click the PWM component to configure its parameters. In the UDB implementation, the PWM component is capable of generating two PWM outputs, PWM1, PWM2. Set the PWM mode to generate two outputs. Set "compare Type1" to "Less than or Equal" and "Compare Type 2" to "Greater than or Equal" or the otherway round. This way the two PWM outputs are out of phase. Picture attached illustrates the same. Connect the two PWM outputs to Pins that have same VDDIO to ensure that they have same amplitude.

 

Attachments: 
Log in to post new comments.