WaveDAC changes from software

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

cross mob
Anonymous
Not applicable

Hi,

   

 I'm still new to the PSOC family, so please forgive what may be a potentially daft question. With the WaveDAC I know it's possible to set a frequency and leave it running (yay), but is it possible to change this frequency in software?

   

 For example, read an ADC, do some munging in C, then change the frequency of the WaveDAC output. Is that possible?

   

Paula

0 Likes
14 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Short answer: yes.

   

Long answer: use an external clock.

0 Likes
Anonymous
Not applicable

Thanks, I don't really want to use an external clock as that would mean taking my signal in through the PSOC ADC, processing it in the CPU, then sending it to some external clock to generate the required frequency, bringing it back into a pin on the PSOC.

So I'd really like to see if it's possible to do directly from the CPU.

0 Likes

External clock means "external to the component", not "external to the chip".  You select this in the component configuration.

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Maybe so?
void main(void)
{
  .  .  .  .  .  .  .  .                        
    UART_CLOCK_SetDivider(Divider[MyBaud]);              
    CyDelay(pause);                                            
.......
}

0 Likes
Anonymous
Not applicable

Interesting approach, thank you.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        Another approach is to use DDS module to control WaveDAC output ffequency (see link, App Note and video) http://www.cypress.com/forum/psoc-community-components/dds24-24-bit-dds-arbitrary-frequency-generato...   
0 Likes
Anonymous
Not applicable

Hi, I've compiled the DDS_HW example and changed the output pins so they are connected to the LED and another pin on my FreeSoC2 (PSOC5LP based) board. but I'm not seeing the LED flash, I changed the frequency to 1hz (as below) But I'm not seeing the LED flash/light up at all. Am I missing something obvious?
Many thanks in advance
 

   
    

 

    

    double FStart = 1.0f;   //100000.0f;      // start frequency

    

    double FStep  = 1.0f;   //1000.0f;        // frequency increment step

    

    uint16 NSteps = 300u;           //number of increment steps (FStop=FStart + FStep * NSteps); Npoints = NSteps + 1   

    

    

   
0 Likes
        Yo, Does original project DDS_HW work? (Or any other of the projects provided?). I suggest to post your project for review in the DDS thread, this way I will get the notification.   
0 Likes
Anonymous
Not applicable

Hi,

   

no it doesn't work for me, though it compiles and builds.

   

I'll respond a bit later with a copy of the imported DDS_HW code as well.

   

thanks

0 Likes

Start with basic DDS24_SW example. Also note that DDS minimal freq = Clock/2^24. To get 1Hz output with 0.1 Hz resolution, set input clock to 1.6777216 MHz

0 Likes
Anonymous
Not applicable

Thanks, the DDS24_SW version works perfectly.
I've used this to drive the WaveDAC which works just as I wanted. thank you

0 Likes
Anonymous
Not applicable

Thank you everyone, I'll try some of the things suggested 🙂

0 Likes
Anonymous
Not applicable

Not that you haven't already thought of it, you could use the Counter component as your clock source. Use the comp out as the clock in to the WaveDAC8 and set the compare value via software using WriteCompare(value). This will allow you to vary the clock frequency relatively easily. It may not be as precise as odissy1's DDS module though, I haven't tried that yet.

0 Likes
Anonymous
Not applicable

Thanks Jeffery, I sort of tried that, using a timer and toggling a pin, but it didn't give me a great frequency resolution.
I'm going to try the DDS module tomorrow, I'll post my results.
Thanks everyone.

0 Likes