spi interface with external DAC in PSoC5

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

cross mob
drmi_4295866
Level 1
Level 1

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
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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
8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes

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

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

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

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

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

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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