➦ Figure 4. 440 Hz Music
The 12V programming high-voltage Vpp
is generated by a
voltage regulator VR1
(317LZ) through a precision resistor divider
made from R1 and R2.
These two resistors
are specified at 1% tolerance to get accurate
Vpp is then
applied to the chip
RESET pin only after
power-up and chip reset. Transistor
pair Q1,Q2 acts as a switch to block
or allow Vpp to go through under
the control 4051 port pin P1.3.
When P1.3 is low, both Q1 and Q2
are cut off, so the pull-down resistor
R6 provides a way to reset the
ATtiny11 to ground. When P1.3 is
high, both Q1 and Q2 are turned on
and the 12 Vpp is applied to enable
the chip’s programming mode.
Ceramic resonator CR1 clocks the
4051 MCU, allowing it to operate at
9600 bps. LED1 indicates the programming status.
In order to make the programmer
more flexible, its power supply is
designed to be either 9 VAC or 12. 5
VDC. The bridge rectifier DF01 and
low voltage regulator VR2 (78L05)
provide +5V power for all chips.
Capacitors C2 and C4 are used to
smooth the DC output.
With 4K bytes of Flash memory,
the programmer can (barely) store
the code for all necessary operations: Blank Check, Erase Chip,
Read/Write flash, Read Signature
bytes, and Verify programming. The
lack of any extra room forces the
programmer to only accept binary
file input. It doesn’t accept Hex format files.
To ease this requirement, we
provide a software program named
HEX2BIN.EXE to let you convert
your Hex file into a binary file,
compatible with the programmer.
Now let’s see how to use this programmer to do something with
➥ Figure 5. Third Example Circuit.
The simplest application to
demonstrate MCU programming is
LED ON/OFF control. Figure 3 shows
the actual circuit, and Listing 1 is
the AVR assembly language source
After power-up and completing
the chip reset, the LED connected to
PB0 (pin 5) is alternately driven high
and low, for a half second each, caus-
➦ Listing 1. Single and Double Blinking
; LED1N2.ASM: Single/Double Blinking LED program
; 1 Hz blinking LED driven by Tiny11/12 AVR working at 1 MHz
; LED is connected to AVR PortB Bit_0 (Pin 5 for ATtiny11/12)
; Double blinking LED is generated by Low-level trigger INT0
; at PortB Bit-1 (Pin 6 for ATtiny11/12)
; Port definitions here
; INT0 is used to cause double-blinking LED
SREG, r16 ; Enable any Interrupt
GIMSK, r16 ; Enable INT0
MCUCR, r16 ; INT0 = Low-Level triggered
DDRB, 0 ; config DDRB bit-0 as output for LED
cbi PORTB, 0 ; LED=ON
sbi PORTB, 0 ; LED=OFF
rjmp LED1 ; repeat again
;the delay = 1/2 sec at 1 MHz
February 2006 63