cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor

Hi all,

I am generating sine wave of 4kHz using external DAC124s085 spi interface with CY8CKIT-059 PSoC® 5LP Prototyping Kit . I am sending different data in decimal or hex that convert in sine wave.I am new in spi interface and new in these kit. I  don't have  much idea about schematic and how to write data in code? Can any one help me out that how can i write look up table?

0 Likes
Reply
1 Solution
Esteemed Contributor II

Try this example for sine/cos calculation.

There are a lot of video examples showing how to deal with the IDE Creator

Happy coding

Bob

View solution in original post

0 Likes
Reply
8 Replies
Esteemed Contributor II

Try this example for sine/cos calculation.

There are a lot of video examples showing how to deal with the IDE Creator

Happy coding

Bob

View solution in original post

0 Likes
Reply
New Contributor

Thank you for replying,it helps me alot.

Now ,I generated sine wave with external DAC that not in 4khz frequency how can I calculate my frequency? I have sample points in look up table and clock value ,can I use this values for frequency calculation?how?help me out.

0 Likes
Reply
Esteemed Contributor II

I have a little problem understanding your issue (English is nor my native language).

What you exactly mean with "external DAC that not in 4khz frequency"

Dil you alredy have a look at the WaveDAC component in which you could replace the PSoC internal DAC with an SPI interface.

Bob

0 Likes
Reply
New Contributor

I want 4kHZ sine wave . I generated sine wave that is in 1 khz frequency . I can't understand how to change my frequency ? I used sine look up table with 60 samples and 12MHz clock frequency. And I am generating square wave using PWM,I want to synchronise both wave . How can I synchronise?

0 Likes
Reply
Esteemed Contributor II

Can you please post your complete project so that we all can have a look at all of your settings. To do so, use

Creator->File->Create Workspace Bundle (minimal)

and attach the resulting file.

Bob

0 Likes
Reply
New Contributor

i am unable to share or attach file here ,i don't get any option like this .

0 Likes
Reply
Moderator
Moderator

Hi Drashti,

Please go to use advance editor option in right corner.

pastedImage_0.png

There you should be able to attach document.

pastedImage_1.png

Best Regards,
Vasanth

0 Likes
Reply
Esteemed Contributor

Hi,

Your program is generating 1kHz without problem, right?

I think your program is accessing the table with index which is increased every time for each 1ms delta.

I think that making increase of the index 4 times (and round back to 0 when it exceeds the maximum index of the table) will generate 4kHz.

For example if you are generating value for the DAC

something like

==============

while(1) {

    output_value = sin_table ;

    i = (i + 1) % TABLE_SIZE ;

}

==============

then, make it

==============

while(1) {

    output_value = sin_table ;

    i = (i + 4) %  TABLE_SIZE ; // <-----

}

==============

or I may write

1kHz

    i = (i + delta_for_1kHz) % TABLE_SIZE ;

4kHz

   i = (i + 4 * delta_for_1kHz) % TABLE_SIZE ;

moto

0 Likes
Reply