|
|
View previous topic :: View next topic |
Author |
Message |
lguancho
Joined: 08 Sep 2003 Posts: 5
|
Analog DDS Chip AD9854 |
Posted: Fri Nov 28, 2003 4:08 am |
|
|
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 |
Posted: Fri Nov 28, 2003 4:22 am |
|
|
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
|
hmm, I've had the same problem before |
Posted: Fri Nov 28, 2003 5:51 am |
|
|
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!
Neil. |
|
|
|
|
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
|