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

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 It should have an amplitude of 5V.

   

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

   

plz help me..

0 Likes
21 Replies
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

 Hi,

   

Is it possible to produce 50 Hz with this.

0 Likes
Anonymous
Not applicable

 Hi,

   

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

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable
        Thank u   
0 Likes
Anonymous
Not applicable

 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.

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

 hi dasq,

   

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable
        we're not getting the output, when we proceeded as you told,can u send us the project done on PSoC3   
0 Likes
Anonymous
Not applicable
        HAI, Plz send us the project, with complementary square waves and having the same amplitude between 2-4V.   
0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

 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.

0 Likes
Anonymous
Not applicable

 Hi,

   

How can we get a 5 volt pulse? You said we need to connect corresponding VDDIO to 5 volts. Can you open it up a little? 

   

Best regards,

0 Likes
Anonymous
Not applicable

In case of PSoC3/PSoC5. The GPIOs are placed such that four quadrants are formed. Each quadrant can operate at a unique voltage. The operating voltage for each of these quadratns is determined by VDDIO supply voltage pins(VDDIO0, VDDIO1, VDDIO2, VDDIO3). By connecting VDDIO0 to 5V, all the GPIOs that come under its qudrant can generate a pulse of 5V amplitude.  

0 Likes
Anonymous
Not applicable

Is it possible to generate 125.1KHz with 50% duty cycle using PSoC3 ??

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Answer is basically yes, but question is accuracy you need for the 125.1 Khz.

   

Clock rate is dependent on your clock source, internal or external, and their

   

respective accuracies.

   

 

   

Also question is how accurate 50% duty cycle ? Exact, implies even divisors.

   

 

   

All can be effected by PWM, but clearly you need to do a goal/error analysis.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Of couse it is:

   

you may use a PWM fed with 1251 kHz and a period of 10 and a compare-value of 5 or similar combinations like

   

2502/20/10

   

5004/40/20

   

1008/80/40

   

 

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

@Dana

   

As you see, I'm a very slow typist....

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Summarizing another way, examine the divisor needed to get from

   

33 Mhz, 48 Mhz, whatever frequency source to get 125.1, 1251, 12510 Khz.

   

Establish if it meets your accuracy needs.

   

 

   

Bob is correct, any PWM with an even divisor, period value, can yield a 50%

   

duty cycle with that divisor/2 for the compare value.

   

 

   

Regards, Dana.

0 Likes