1 2 Previous Next 21 Replies Latest reply on Aug 8, 2012 7:50 AM by user_14586677

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

It should have an amplitude of 5V.

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

plz help me..

• ###### 1. Re: how to generate a square wave of frequency 50 Hz using PSOC3

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).

• ###### 2. Re: how to generate a square wave of frequency 50 Hz using PSOC3

This example project should get you started,

• ###### 3. Re: how to generate a square wave of frequency 50 Hz using PSOC3

Hi,

Is it possible to produce 50 Hz with this.

• ###### 4. Re: how to generate a square wave of frequency 50 Hz using PSOC3

Hi,

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

• ###### 5. Re: how to generate a square wave of frequency 50 Hz using PSOC3

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.

• ###### 6. Re: how to generate a square wave of frequency 50 Hz using PSOC3
Thank u
• ###### 7. Re: how to generate a square wave of frequency 50 Hz using PSOC3

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.

• ###### 8. Re: how to generate a square wave of frequency 50 Hz using PSOC3

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.

• ###### 9. Re: how to generate a square wave of frequency 50 Hz using PSOC3

hi dasq,

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

• ###### 10. Re: how to generate a square wave of frequency 50 Hz using PSOC3

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.

• ###### 11. Re: how to generate a square wave of frequency 50 Hz using PSOC3
we're not getting the output, when we proceeded as you told,can u send us the project done on PSoC3
• ###### 12. Re: how to generate a square wave of frequency 50 Hz using PSOC3
HAI, Plz send us the project, with complementary square waves and having the same amplitude between 2-4V.
• ###### 13. Re: how to generate a square wave of frequency 50 Hz using PSOC3

Hi deeps,

Are you not getting both the outputs. As per one of your previous comments u had successful in getting a 50Hz waveform. After changing the PWM configuration to get 2 outputs, did you map it to an appropriate pin, in the CYDWR file.

• ###### 14. Re: how to generate a square wave of frequency 50 Hz using PSOC3

Hi U2,

Yes I have done the same on CYDWR file, we are getting the same square wave not the inverted one.

Its a simple thing but we are not getting it. Yesterday we got the inverted but it suddenly dissappeared as we were about to connect it to the circuit .Can u plz do it from ther and send us the project.

1 2 Previous Next