View Single Post
  #8   Report Post  
Old July 13th 03, 10:11 AM
 
Posts: n/a
Default


If anyone has build a radio using a dds/pll vfo, I'd like to know how
they handled
the user interface in software, which micros they used and how they
handled the
math to calculate the divisor constants.


Heres the way I do a simple integer division ...

j = i / 0.66 ... that's what we want, both i & j are int's

The same as ..

j = i * (1 / 0.66)

The same as ..

j = i * 1.5151

Have the 1.5151 as a look up in rom but scaled up by *256 (388 in int terms)

So you have ..

j = i * 388

Then you divide the result by 256 (a simple shift right by 8 bits)


eg ..

i = 54
i = i * 388
j = i asr 8 .... this gets rid of the scale up

or

j = i shr 8 .... for unsigned calcs

..

j now equals 82 (as near as you can get to 81.84375)


If the divisor is variable then you prolly have no choice but to do a proper
division at some point, but still use scaled up int's to get your result.


Clive