oscillator.
A fuse bit programming facility is not included in the
AVRHVP-1 programmer since
there is not enough program
memory to support this. For this
reason, another special programmer AVRHVP-2 has been developed, which handles only fuse bit
programming, and as well, writing the “lock bits” to hide the
binary code functions.
Listing 2 shows the software. To generate the accurate
440 Hz frequency tone, an infinite loop of 1,136 μS high and
low voltage is alternately
applied to the speaker (1,136 μS
is the half period corresponding
to 440 Hz.)
The key routine here is the
DL1132 μS delay routine, but
every other instruction counts as
well. For example, setting pin
PB1 high or low takes 2 μS each,
and the call overhead to DL1132
also takes 2 μS. Adding them all
up gives us exactly 1,136 μS.
With such meticulous calculations, the circuit output tone is
exactly 440.0 Hz when measured
by a frequency meter. As a comparison, if you don’t re-program
the fuse bits and use the built-in
RC oscillator, the frequency meter will
show quite different readings, such as
495.7 Hz.
PARTS LIST
➦ C1 — 100 μF 16 volt radial electrolytic capacitor
➦ C2 — 10 μF 16 volt radial electrolytic capacitor
➦ C3, C4 — 0.1 μF ceramic capacitor
➦ R1 — 210Ω 1/8 watt metal film precision resistor, 1% tolerance
➦ R2 — 1.82K, 1/8 watt metal film precision resistor, 1% tolerance
➦ R3, R4, R6 — 10K, 1/4 watt carbon resistor
➦ R5 — 330Ω 1/4 watt carbon resistor
➦ U1 — RS-232 transceiver DS275 from Dallas Semiconductor
➦ U2 — AT89C4051 Flash microcontroller (programmed)
➦ Q1 — PNP transistor 2N2907
➦ Q1 — NPN transistor 2N3904
➦ BR1 — Bridge rectifier DF01
➦ VR1 — 317LZ voltage regulator
➦ VR2 — 78L05 voltage regulator
➦ D1 — Schottky diode 1N5817
➦ LED1 — General-purpose light emitting diode
➦ J1 — Power jack
➦ J2 — DB9F connector
➦ CR1 — 3. 58 MHz ceramic resonator
➦ Miscellaneous: Eight-pin machined socket, 9VAC or 12.5VDC power
supply, etc.
➦ NOTE: The following items are available from:
G.Y. Xu, P.O. Box 14681, Houston, TX 77021
Phone: (713) 741-3125
1. Assembled and tested AVRHVP-1 programmer — $29.95
2. PCB and programmed AT89C4051 — $10.00
➦ Please visit
www.geocities.com/xumicro for ordering information.
HAPPY BIRTHDAY SONG
As the last example program, in
Listing 3 (go to the Nuts & Volt
website for Listing 3; www.nutsvolts.
com), we show the familiar Happy
Order online at:
www.melabs.com
Development Tools for PICmicro® MCUs
microEngineering Labs, Inc.
Phone: (719) 520-5323
Fax: (719) 520-1867
Box 60039
Colorado Springs, CO 80960
grammer
CUs
E
W
able
Optional
USB Adapter
s
February 2006 65