You are here

PSoC World :Sine wave generation in PSoC1 | Cypress Semiconductor

PSoC World :Sine wave generation in PSoC1

Summary: 3 Replies, Latest post by danaaknight on 18 Dec 2012 06:59 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
desh's picture
Cypress Employee
9 posts

 Hi Everyone,

Here is a question that was asked during the PSoC World Virtual Conference that was held during December 12-13, 2012.


Is there an analog way of sine wave generation in PSoC1?

The answer is yes. The AN2025 discusses how sine wave can be generated in the PSoC way by using band pass filter.



user_14586677's picture
7646 posts

AN2025 generates sine via lookup table. This method is more limited in max

frequency it can generate, especially in PSOC 1. But the method is adapatable

to any continuous time waveform, triangle, ramp, sin(x)/x..........Method takes a

lot of MIPs, precious in a PSOC 1. Or use PSOC 3/5 where whole method is

accomplished in HW, DMA, DAC......


Alternatively you can use a Timer to generate freq of interest, then filter with

a BP filter to extract fundamental, a sinusoid.



Regards, Dana.

desh's picture
Cypress Employee
9 posts

 The updated AN2025 talks about about how a sine wave can be obtained by filtering techinque.In this method, a square wave with frequency equal to the desired sine wave frequency is generated by using timers. This square wave is then passed through a band pass filter to eliminate the higher order harmonics. Only the fundamental frequency is untouched, which is the desired sine wave.

Since the Implementation is purely in hardware, MCU is entirely free and can be used to implement any other functionality. Also, Higher frequencies can be generated which is not possible in lookup table method.

user_14586677's picture
7646 posts

Thnaks, I was working off an older version of AN2025.


From ap note -


Advantages (filter):

1)  Implementation is purely in  hardware.CPU can
be used to implement any other functionality.

2)  Can be used for obtaining higher frequency sine
waves which can’t be obtained by the DAC
method because of limitation of maximum DAC
update rate and CPU overhead.


1)  Because of the  discrete values of the
capacitance, a trial and error method may have
to be used to achieve the right expected filter


Also what they do not discuss is filter approach basically a fixed

frequency approach, as there are no APIs to tune filter in code

other than direct register writes, and user would have to create

a table of values based on Wizard trial runs to use. Also subject

to device to device variation, unlike LUT approach, especially

when PSOC is run off a xtal. Also filter approach cannot produce

ramp/triangle/sin(x)/x, eg other wave shapes.


Regards, Dana.

Log in to post new comments.