Application Note 218
DS1086 Frequency Calculator and
Frequency Calculation Algorithm
www.maxim-ic.com
Introduction
The DS1086 is a welcomed addition to the EconOscillator™ family. While it is similar to the DS1085, the
DS1086 is capable of generating frequencies from 260kHz to 133MHz with a spread-spectrum output. A
spread-spectrum system clock/oscillator is important when EMI is a concern of the end application. In
addition to the spread-spectrum output, the DS1086 gives the designer the ability to easily change the
frequency of the oscillator in-circuit, on-the-fly using the 2-wire interface.
The purpose of this application note is to introduce the DS1086 frequency calculator, which is available for
download, and to show an algorithmic approach to calculating the values needed to program into the DS1086
to generate a specified frequency.
This application note assumes that the reader is already familiar with the DS1086 data sheet.
The Calculator
The DS1086 frequency calculator is a Windows 95/98/NT application available for download at
ftp://ftp.dalsemi.com/pub/silicon_timed/DS1086Calculator.exe. It can be used standalone to calculate the
values to program into the DS1086 registers, or in conjunction with a DS1086 EV Kit (available in the
future).
Figure 1. DS1086 Frequency Calculator
EconOscillator is a trademark of Dallas Semiconductor.
1 of 7
090402
AN218
Once the calculator’s executable file is downloaded and executed, the dialog shown in Figure 1 will appear.
To use the calculator, simply enter a desired frequency between .258 and 133 (in MHz) in the edit box and
select the desired percent spread (2% or 4%). Then click on Calculate (or Alt + C). The software will first
check to see if an EV Kit is connected to the PC’s serial port. If so, the RANGE register is read from the
DS1086 and used in the calculation. Otherwise, a dialog box similar to Figure 2 will appear stating that 10
hex (16 decimal) will be used in the calculation in place of an actual RANGE value. Clicking on OK will
remove the dialog and show the results of the calculation. The values on the left side of the calculator, in the
Calculation Results section, show results of the intermediate calculations (in decimal) and are defined below.
These are then used to generate the hex register values shown on the right side of the calculator in the
Register Value section. These are the values that need to be programmed into the DS1086 device registers to
set the desired frequency assuming that RANGE was read from an actual device. If an EV Kit is connected,
the Read and Write buttons will be enabled and can be used to program the DS1086 to the frequency you just
calculated.
Figure 2. DS1086 RANGE Message
Master Frequency
This is what the internal master oscillator needs to be trimmed to in order to generate the desired output
frequency. Valid frequencies are between 66Mhz and 133Mhz in 10kHz step increments. The output
frequency is determined by this Master Frequency divided by the Prescaler.
Prescaler
The Master Frequency is divided by the Prescaler. Valid Prescaler values are 2x, where x can be 0 to 8.
Thus, the Prescaler divides the Master Frequency by 1, 2, 4, 8, 16, 32, 64, 128, or 256.
Offset
This value selects the range of frequencies (refer to Table 2 in the data sheet) used to generate the Master
Frequency. When used in conjunction with DAC, a specific frequency within the range is selected. This value
is meaningless if RANGE is not known. See delta below.
delta (the difference between Offset and RANGE)
This is the delta of Offset from the factory programmed RANGE value (refer to Table 2 in the data sheet). For
example, a delta of +2 selects the frequency range of 102.4 to 112.63MHz. The relationship between Offset
and delta can be better described as follows: Offset = factory programmed value of RANGE + delta.
DAC
Once a range of frequencies is chosen, DAC is used to select a particular frequency within that range. The
value of DAC is multiplied by 10kHz (0.01MHz) and then added to the minimum frequency of the selected
range. For example, suppose the range of 92.16 to 102.39MHz has been selected (refer to Table 2 in the data
sheet). If DAC were say, 500 (dec), the Master Frequency would then be 92.16 + 500(0.01) = 97.16MHz.
2 of 7
AN218
% Err (calculated)
This value is the percent error between the desired frequency, which the user inputs, and the Expected Freq
Out (see below). This error is the theoretical quantizing error created by the 10kHz step size.
Expected Freq Out
This is the frequency you would expect to measure at the output. However, it is purely the calculated
expectation. Refer to the DS1086 data sheet for the specified frequency tolerance, as well as tempco and
voltco performance.
Percent Spread
The 4% and 2% radio buttons are used to select the desired percent spread. The selection is written into the J0
bit (b4) of the PRESCALER register. For this selection to have any effect on the frequency output, the
DS1086 SPRD pin must be tied to VCC. Otherwise, if no spread (dither) is desired, the SPRD pin should be
tied to GND. Refer to the data sheet for more information.
Algorithm
The DS1086 data sheet does a great job of showing how to calculate register values by hand. However, it fails
to discuss how such calculations and decision making could be implemented in software or firmware. When
the register values are given, calculating the frequency is straightforward. However, when the frequency is
given, calculating the register values is much more complicated. Furthermore, the process of calculating the
register values either by hand or by soft/firmware is further complicated by its dependency on the factory
programmed RANGE register value. The flowchart included in Appendix A shows an example algorithm of
how to programmatically solve for the DS1086 register values when given a desired frequency. Comments
accompany the flowchart and provide a step-by-step narrative. While the flowchart provides a solid
foundation, there may be improvements you might wish to implement depending on your applications
requirements. One such improvement would be to continue searching for all possible solutions to generate the
desired frequency and then choosing the solution with the smallest calculated error.
Conclusion
The DS1086, with its spread-spectrum output, is a welcomed addition to the EconOscillator family. Its
features complement those of its siblings. Due to the overwhelming interest in the DS1086, a frequency
calculator has been created to make it easier incorporating the DS1086 into your application. Likewise, to
simplify the challenge of working backwards and calculating the register values from a given frequency, a
flowchart has been provided for those applications where the frequency needs to be calculated
programmatically.
Download DS1086 calculator from: ftp://ftp.dalsemi.com/pub/silicon_timed/DS1086Calculator.exe.
3 of 7
AN218
Maxim Integrated Products / Dallas Semiconductor Contact Information
Dallas Semiconductor
4401 S. Beltwood Parkway
Dallas, TX 75244
Tel: 972-371-4448
Maxim Integrated Products, Inc
120 San Gabriel Drive
Sunnyvale, CA 94086
Tel: 408-737-7600
Product Literature / Samples Requests:
(800) 998-8800
Sales and Customer Service:
(408) 737-7600
World Wide Website:
www.maxim-ic.com
Product Information:
http://www.maxim-ic.com/MaximProducts/products.htm
Ordering Information:
http://www.maxim-ic.com/BuyMaxim/Sales.htm
FTP Site:
ftp://ftp.dalsemi.com
Tech Support:
MixedSignal.Apps@dalsemi.com
4 of 7
AN218
Appendix A
Begin
Input desired
frequency (MHz)
Input desired frequency
Can be input real-time or as an input parameter. Floating point
numbers are valid, such as float or double.
Validate frequency
Use /PDN or OE
pin to turn off
output.
YES
Is
desired
frequency 0Hz
?
NO
Invalid input
frequency!
NO
Is
desired freq.
258kHz 133MHz
?
YES
Read RANGE
register from the
device and convert
it to integer.
exponent = 0
increment
exponent
YES
Is
(2exponent *
desired freq.)
< 66MHz
?
NO
master frequency=
2exponent *
desired frequency
Error message
YES
Is
exponent > 8
?
The DS1086 can generate master oscillator frequencies of 66MHz133MHz. The prescaler then divides by 1-256 to generate lower
frequencies.
Read default offset in RANGE register
The read-only RANGE register is unique to each device and is
programmed into each DS1086 during production testing. It is a
back-up copy of the OFFSET register factory default value.
Calculate needed master freqency and prescaler
This algorithm favors lower master frequencies (and hence lower
current) over a higher prescaler (and hence an smaller effective
step size). An algorithm that does just the opposite (favors a
smaller step size over current) can be substituted.
The exponent (and hence prescaler) is incremented until a master
frequency over 66MHz is found. A nice improvement would be to
find all or several solutions (and choose solution with smallest
error).
master frequency = prescaler * desired frequency
where prescaler is 2x (valid values of x are 0 to 8).
The value of x is what is programmed into the PRESCALER
register.
28 is the largest valid prescaler value.
This check is not necessary since the desired frequency has
already been validated. However, it is included here to emphasize
that 8 is the max even though it uses 4 bits in the PRESCALER
register.
NO
Go to B
5 of 7
AN218
B
offsetindex=0
Calculate
frequency range
for current offset.
increment
offsetindex
NO
Is
master freq.
within the freq.
range of current
offset?
YES
offset =
RANGEvalue - 6
+ offsetindex
NO
Is
offsetindex - 6