More DDS [IQ Dual Phase DDS]

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Hi Pals   
I'm so glad to used the DDS modules by many friends,   
They told me that there are many applications of DDS.   
   
There is no necessarily of sine wave is in always,   
Some application needs more high frequency   
and that is enough as pulse wave.   
   
Hence this time   
I was made a IQ-DDS module   
It is upto 5MHz and Minimum frequency resolution is 2.86Hz at 48MHz clock.   
   
This test bench is implemented to Pioneer-Kit, Bootable PSoC5LP   
How to is describe in this article, 9.OCT.2013   
[ http://www.cypress.com/?app=forum&id=2492&rID=86654 ]   
   
Would you mind to make a SDR Radio.   
Have a nice days.   
0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I cannot resist to comment something on your programming-style:

   

You #define in your file Globals.h the constants "true" and "false" as

   

   

//////////////////////////////////////////////////////////////////////////////////

        true -1   

   

#define

   

   

#define

       

   

false 0

   

//////////////////////////////////////////////////////////////////////////////////

       

Did you ever try what your program does when you write

   

if((5 == 5) == true)

   

or comparing two variables with the same value as

   

if((VarA == VarB) == true

   

or even checking a boolean variable as I frequently see in code

   

if(BoolVar == true)

   

Astonishingly the comparision will go wrong and finding the cause for this can cost you some time! The excuse "I do not compare in my code something to true" will help you, but it does not hinder you (or someone else) to do so. I have learnt to do it a little bit different: We all know that a false condition is defined as the value zero, so when using the logic of C we are independent of what value "true" (which in GCC is 1, not -1) is used.

   

#define false 0 // as we know

   

#define true !false // whatever the compiler chooses

   

 

   

Happy coding

   

Bob

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I cannot resist to comment something on your programming-style:

   

You #define in your file Globals.h the constants "true" and "false" as

   

   

//////////////////////////////////////////////////////////////////////////////////

        true -1   

   

#define

   

   

#define

       

   

false 0

   

//////////////////////////////////////////////////////////////////////////////////

       

Did you ever try what your program does when you write

   

if((5 == 5) == true)

   

or comparing two variables with the same value as

   

if((VarA == VarB) == true

   

or even checking a boolean variable as I frequently see in code

   

if(BoolVar == true)

   

Astonishingly the comparision will go wrong and finding the cause for this can cost you some time! The excuse "I do not compare in my code something to true" will help you, but it does not hinder you (or someone else) to do so. I have learnt to do it a little bit different: We all know that a false condition is defined as the value zero, so when using the logic of C we are independent of what value "true" (which in GCC is 1, not -1) is used.

   

#define false 0 // as we know

   

#define true !false // whatever the compiler chooses

   

 

   

Happy coding

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Sorry, the forum software klobbered your pasted code from your file, it originally red

   

#define true -1

   

#define false 0

   

 

   

Bob

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

Even better: just

   
#include <stdbool.h>
   

and use true and false directly...

0 Likes