The ramp speed, R1, is a bit more complex. There are
two parameters which change with the R1 setting: the
step size in Hz, using bits 9-7 of the A/D reading; and the
step duration, using bits 6-4.
Both the step size and duration bits are used as
indices into tables of eight values each, so they can easily
be changed if you want. With the R1 tap at ground, the
step size is 15 Hz and the duration per step is 100 ms.
Rotating the pot a little changes the duration to 50 ms
while keeping the step size the same.
Basically, for each step size, the
program will change the duration
from its maximum of 100 ms to its
minimum of 1 ms. After reaching 15
Hz and 1 ms, the next setting will be
a step size of 30 Hz with a duration
of 100 ms. The maximum step size is
currently a value of 25* 15 Hz = 375
Hz, so the maximum speed is
attained with the R1 tap at 5V and
yields a step size of 375 Hz with a
step duration of 1 ms.
All the inputs can be varied
during program execution. However,
they are read and applied only at the
end of each ramp cycle. Also,
although the pots are shown as 5K,
they can be any value up to 10K
which is the specified maximum
source resistance for the PIC A/D.
Since I used the 16F18313 in a
number of these sample circuits, I
decided to migrate the PIC 555
replacement from Part 1 of this series
to this processor. You can find the
code ( PIC_555-16F.asm) with the
I have recently designed a
breadboard for the PIC 555
replacement using the 12F1572 or
The schematic and board layout
can be seen in the file Breadboard.jpg in the downloads.
The board has a 7805 regulator and a sizable area for
breadboarding. It’s a mix of thru-hole and SMD parts, and
has a programming header compatible with a PICKit- 3.
All schematics are drawn using
All parts purchased are
February 2018 45
(If you want a single board, you can email me at
firstname.lastname@example.org. If you want to get three boards, you can
order them from OshPark at oshpark.com/profiles/K3PTO.)