You are here

WaveDAC8 Amplitude Control for PSOC5? | Cypress Semiconductor

WaveDAC8 Amplitude Control for PSOC5?

Summary: 20 Replies, Latest post by boz336 on 30 Aug 2016 05:00 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
boz336's picture
User
20 posts

I'm in the process of trying to generate a sawtooth waveform with the WaveDac component.  For a static waveform, there are no issues... and it works just fine  However, I'd like to be able to change the amplitude of the waveform through a UART interface. 

So the real question is:  What is the easiest way to be able to change the amplitude of the output waveform?

In the API, there is a WaveDAC8.c file that has an array (const uint8 CYCODE WaveDAC8_wave1) of 8-bit values that presumably get sequentially put into the DAC.  Is there a way to just add several more of these with the correct amplitudes?   If so, how do I go about changing the active waveform from main.c?

Or, is there a better way to do this?

Thanks in advance.

 

user_342122993's picture
User
603 posts

Check a similar project (function generator), which was posted before

http://www.cypress.com/?app=forum&id=2492&rID=76891

boz336's picture
User
20 posts

It looks like that project uses PWM rather than the DAC.  Are there any examples that use the DAC instead?  I've looked, but have not yet found any.

 

user_342122993's picture
User
603 posts

Inddeed, not a WaveDAC. I believe that to update WaveDAC internal array in real time API funcion can be used:
void WaveDAC8_StartEx(uint8 * wavePtr1, uint16 sampleSize1, uint8 * wavePtr2, uint16 sampleSize2)

But I have no ready-to use example at hand.
 

user_342122993's picture
User
603 posts

Attached is a project showing adjustable wave parameters using VDAC8 (not WaveDAC). In essence it does the same as WaveDAC: transferring data from RAM to VDAC8 using DMA.

 

boz336's picture
User
20 posts

Thanks.  That looks pretty close to what I was after.

user_342122993's picture
User
603 posts

I will look into using WaweDAC_StartEx(...), maybe it is possible to update output in real time. Strangely, there are no examples of that reported neither on the forum nor in App notes.

boz336's picture
User
20 posts

To make sure I understand clearly..... In your RAM-DMA-VDAC example, the amplitude would be controlled by loading a different uint8 array with different values (e.g. higher amplitude waveform)?  I'm still trying to figure out how to use   "void WaveDAC8_StartEx"  to change waveform amplitude.  For what it's worth, I don't need super high resolution control over the amplitude.  A set of maybe 6 or 8 amplitudes would probably do it.

user_342122993's picture
User
603 posts

That is correct - to change the waveform amplitude or shape, offset etc., the array values are being updated by CPU. DMA is blindly pushing the content of the array to VDAC. That is the easiest  way to update waveform.

Next step would be to make two arrays and just change the pointer to it. This way the change of waveform can be instantaneous. 

user_1377889's picture
User
9831 posts

Hey, Odissey1! Nice tie!!!

 

Bob ;-)

user_342122993's picture
User
603 posts

This piece of art will be auctioned in November :)

Log in to post new comments.