If you want a little bit more complex solution with a
step size of 9. 4 Hz (closer to 10 Hz), you can multiply the
A/D reading by 1.25 by dividing the reading by four (two
right-shift operations) and then adding the result to the
original value. Since the NCO has a linear frequency vs.
voltage curve, it becomes easy to calculate the ratio of the
two resistors required for any frequency: let Ra = lower
Vcontrol = (Ra x Vcc) ⁄ (Ra + Rb) = n x Vcc/(n + 1)
The formula for the frequency can be
obtained from Graph 1 and simplified a
Freq = (7852 x V/Vcc) — 9.69
By manipulating these two equations,
the value for n as a function of frequency
can be derived as:
n = (Freq + 9.69) ⁄ (7852 — 9.69 — Freq)
Notice that n is independent of Vcc,
and that the maximum frequency is about
7,842 Hz. For instance, if 200 Hz is
wanted, then n = .0274. Letting Rb = 10K,
then Ra = 274 ohms. The spreadsheet
NCO Toy Organ.ods in the article
downloads uses the above formula to
calculate the Ra value for several
frequencies using 10K for Rb. The
schematic shows the values as calculated
by the spreadsheet for seven frequencies.
The PIC replacement (mode 4 and
range 1) can be used for this application as
well. Using the same approach as with the
NCO, the formula for n can be derived as:
n = 1 ⁄ ((.02048 x Freq) — 1)
If Rb is fixed at 10K, the formula for
Ra = 104 ⁄ ((.02048 x Freq) — 1)
Note that with this circuit, the lower
resistor values give shorter periods thus
higher frequencies — just the opposite of
the NCO. There will be three differences
using the 555 replacement as compared
to the NCO:
• The calculations for the resistor
values since the control voltage is
controlling the period.
• The high frequency resolution is not
very good. See the discussion about
resolution in the PIC Mims Circuit
• The gate circuit needs to have an
inverter since the gate is high true.
See Schematic 5a.
Mims Circuit 17
Circuit 17 (Schematic 6) is a 556 connected as a
chirp generator. Section 1 of the 556 is an astable
multivibrator. It has a frequency range from under 1 Hz to
about 60 Hz.
Based on the formula from a 555 spec sheet, using
the R2 and C1 values shown in the schematic, the width
of the pulse low time for the astable section is PW =
0.693*R2*C1 = 3. 46 ms. I measured 3. 38 ms which is
40 February 2018
SCHEMATIC 5A. PIC 555 toy organ.
SCHEMATIC 5. PIC NCO toy organ.