CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Analog DDS Chip AD9854

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lguancho



Joined: 08 Sep 2003
Posts: 5

View user's profile Send private message

Analog DDS Chip AD9854
PostPosted: Fri Nov 28, 2003 4:08 am     Reply with quote

Hi. I intend to use PIC16F877A to control a 48bit DDS chip AD9854 from Analog device, but am not sure how to implement the frequency calculation code. The formulae is:

Nout[control word] = (Fout *2^48 ) / Fref

Fout and Fref are large numbers such as 50000000 (Hz) and 300 000000(Hz) respectively. I think I need int32 type for these variables.

Question: How do we do [(int32) / (int32)]*int48 ?

Hope anyone could share some sample code to do the math.

Warmest Regards

Lim
Ttelmah
Guest







Re: Analog DDS Chip AD9854
PostPosted: Fri Nov 28, 2003 4:22 am     Reply with quote

lguancho wrote:
Hi. I intend to use PIC16F877A to control a 48bit DDS chip AD9854 from Analog device, but am not sure how to implement the frequency calculation code. The formulae is:

Nout[control word] = (Fout *2^48 ) / Fref

Fout and Fref are large numbers such as 50000000 (Hz) and 300 000000(Hz) respectively. I think I need int32 type for these variables.

Question: How do we do [(int32) / (int32)]*int48 ?

Hope anyone could share some sample code to do the math.

Warmest Regards

Lim

You are probably going to have to write your own maths routines, to get accuracy!...
The problem is that the '2^48' part corresponds to left shifting 48 bits, implying that the arithmetic is expected to be able to handle this. How big a value would have to be to accept this, would depend on the actual 'size' of Fout. The floating point type, will handle this, but the basic accuracy is then only 23 bits. Realistically I'm afraid, the answer is going to be to create your own larger data type, and perform the arithmetic with this. This will mean creating your own maths routines to handle this type....

Best Wishes
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

hmm, I've had the same problem before
PostPosted: Fri Nov 28, 2003 5:51 am     Reply with quote

Hi, I considered a pic for an AD9852 but needed speed as my frequency has to change fast as well, so we have gone for a DSP processor as it has dedicated math functions in hardware, eg. 32 bit multiplies, they are also pipelined giving massive speed. Fortunately I haven't had to do this project, someone else is doing it who has experience with DSP! Laughing

Neil.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group