- •Features
- •Pin Configurations
- •Description
- •Block Diagram
- •Pin Descriptions
- •Port A (PA3..PA0)
- •Port B (PB7..PB0)
- •Port D (PD7..PD0)
- •XTAL1
- •XTAL2
- •RESET
- •Clock Options
- •Internal RC Oscillator
- •Crystal Oscillator
- •External Clock
- •External RC Oscillator
- •Register Indirect
- •I/O Direct
- •I/O Memory
- •Reset Sources
- •Power-on Reset
- •External Reset
- •Watchdog Reset
- •Interrupt Handling
- •Interrupt Response Time
- •External Interrupt
- •Low-level Input Interrupt
- •Sleep Modes
- •Idle Mode
- •Power-down Mode
- •Timer/Counter0
- •Timer/Counter Prescaler
- •Watchdog Timer
- •Hardware Modulator
- •Analog Comparator
- •I/O Ports
- •Port A
- •Port A as General Digital I/O
- •Alternate Function of PA2
- •Port A Schematics
- •Port B
- •Port B as General Digital Input
- •Alternate Functions of Port B
- •Port B Schematics
- •Port D
- •Port D as General Digital I/O
- •Fuse Bits
- •Signature Bytes
- •Calibration Byte
- •Programming the Flash
- •Parallel Programming
- •Signal Names
- •Enter Programming Mode
- •Chip Erase
- •Programming the Flash
- •Reading the Flash
- •Programming the Fuse Bits
- •Programming the Lock Bits
- •Parallel Programming Characteristics
- •Electrical Characteristics
- •Absolute Maximum Ratings
- •DC Characteristics
- •External Clock Drive Waveforms
- •External Clock Drive
- •Register Summary
- •Instruction Set Summary
- •Ordering Information
- •Packaging Information
- •Errata
- •All revisions
- •Table of Contents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Register Direct, Single |
Figure 7. Direct Single Register Addressing |
||||||||||
Register Rd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The operand is contained in register d (Rd). |
Register Indirect |
Figure 8. Indirect Register Addressing |
|
REGISTERFILE |
0
Z-Register 30
31
The register accessed is the one pointed to by the Z-register (R31, R30).
Register Direct, Two Registers Figure 9. Direct Register Addressing, Two Registers
Rd and Rr
Operands are contained in register r (Rr) and d (Rd). The result is stored in register d (Rd).
8 ATtiny28L/V
1062G–AVR–01/06
ATtiny28L/V
I/O Direct
Relative Program Addressing,
RJMP and RCALL
Figure 10. I/O Direct Addressing
Operand address is contained in six bits of the instruction word. n is the destination or source register address.
Figure 11. Relative Program Memory Addressing
15 |
0 |
PC
+1 |
15 |
12 11 |
0 |
||
|
|
OP |
|
k |
|
|
|
|
|
PROGRAM MEMORY
$000
$3FF
Program execution continues at address PC + k + 1. The relative address k is -2048 to 2047.
Constant Addressing Using |
Figure 12. Code Memory Constant Addressing |
||||
the LPM Instruction |
|
|
|
PROGRAM MEMORY |
|
|
|
|
|
||
|
15 |
1 |
0 |
|
$000 |
|
|
||||
|
|
|
|||
|
|
Z-REGISTER |
|
|
|
|
|
|
|
|
|
$3FF
Constant byte address is specified by the Z-register contents. The 15 MSBs select word address (0 - 1K), and LSB selects low byte if cleared (LSB = 0) or high byte if set (LSB = 1).
9
1062G–AVR–01/06
Subroutine and Interrupt
Hardware Stack
Memory Access and
Instruction Execution
Timing
The ATtiny28 uses a 3-level-deep hardware stack for subroutines and interrupts. The hardware stack is 10 bits wide and stores the program counter (PC) return address while subroutines and interrupts are executed.
RCALL instructions and interrupts push the PC return address onto stack level 0, and the data in the other stack levels 1 - 2 are pushed one level deeper in the stack. When a RET or RETI instruction is executed the returning PC is fetched from stack level 0, and the data in the other stack levels 1 - 2 are popped one level in the stack.
If more than three subsequent subroutine calls or interrupts are executed, the first values written to the stack are overwritten.
This section describes the general access timing concepts for instruction execution and internal memory access.
The AVR CPU is driven by the System Clock, directly generated from the external clock crystal for the chip. No internal clock division is used.
Figure 13 shows the parallel instruction fetches and instruction executions enabled by the Harvard architecture and the fast-access register file concept. This is the basic pipelining concept to obtain up to 1 MIPS per MHz with the corresponding unique results for functions per cost, functions per clocks and functions per power unit.
Figure 13. The Parallel Instruction Fetches and Instruction Executions
T1 |
T2 |
T3 |
T4 |
System Clock Ø
1st Instruction Fetch
1st Instruction Execute 2nd Instruction Fetch 2nd Instruction Execute 3rd Instruction Fetch 3rd Instruction Execute 4th Instruction Fetch
Figure 14 shows the internal timing concept for the register file. In a single clock cycle an ALU operation using two register operands is executed, and the result is stored back to the destination register.
Figure 14. Single Cycle ALU Operation
T1 |
T2 |
T3 |
T4 |
System Clock Ø
Total Execution Time
Register Operands Fetch
ALU Operation Execute
Result Write Back
10 ATtiny28L/V
1062G–AVR–01/06