3 Replies Latest reply on Dec 18, 2012 6:59 AM by DaKn_263916

# PSoC World :Sine wave generation in PSoC1

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.

http://www.cypress.com/?rID=2600

-Sandesh

• ###### 1. Re: PSoC World :Sine wave generation in PSoC1

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.

• ###### 2. Re: PSoC World :Sine wave generation in PSoC1

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.

http://www.cypress.com/?rID=2600

• ###### 3. Re: PSoC World :Sine wave generation in PSoC1

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

From ap note -

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

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

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.