Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20610

BASCOM-AVR : programming AD9850 - problems with precision of multiplicati : NEWTOPIC

$
0
0
I try to program a DDS generator module AD9850. What needs to be done is to calculate the frequency control word F_ctrl = F_out / F_ref * 2exp32. F_ref is 125E6 Hz and the range of F_out is from 10Hz to 40E6 Hz. I have some noticeable differences when performing the calcs using variables in single precision. There is improvement when I use double precision instead. Now I want to implement frequency changes in steps of 10Hz, 100Hz, 1kHz, 10kHz, 100kHz ... 10 MHz. If I calculate on a base of MHz, i.e. F-ref and F_out are both in MHz, I start e.g. from 1.0 MHz. Adding a step of 100kHz (by adding 0.1 to F_out) I would expect a value for F_out of 1.1, but instead I get 1.0999999235 or something similar. There is no ROUND function for Double and it would not help since it would round to integer values. I tried to convert to a STRING, format the STRING with FUSING and reconvert it with VAL to a single or double format - same effect. Also using INPUT from the terminal e.g. 0.001 is converted to something like 0.00099999 ... But I gues also here the routine for VAL is used to convert the input into a number. Does anybody have an idea how to overcome this problem? Cheers, Johannes [b:2ddc8907e9][color=red:2ddc8907e9](BASCOM-AVR version : 2.0.7.6 )[/b:2ddc8907e9][/color:2ddc8907e9]

Viewing all articles
Browse latest Browse all 20610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>