Rainbow Electronics AT90C8534 User Manual

Features

Utilizes the AVR
AVR – High-performance and Low-power RISC Architecture
– 118 Powerful Instructions – Most Single Clock Cycle Execution – 32 x 8 General-purpose Working Registers – Up to 1.5 MIPS Throughput at 1.5 MHz
Data and Nonvolatile Program Memory
– 8K Bytes Flash Program Memory
Endurance: 1,000 Write/Erase Cycles – 256 Bytes Internal SRAM – 512 Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles – Programming Lock for Flash Program and EEPROM Data Security
Peripheral Features
– One 8-bit Timer/Counter with Separate Prescaler – One 16-bit Timer/Counter with Separate Prescaler
Special Microcontroller Features
– Low-power Idle and Power-down Modes – External and Internal Interrupt Sources – 6-channel, 10-bit ADC
Specifications
– Low-power, High-speed CMOS Process Technology – Fully Static Operation
Power Consumption at 1.5 MHz, 3.6V, 25°C
– Active: 1.2 mA – Idle Mode: 0.2 mA – Power-down Mode: <10 µA
I/O and Packages
– Seven General Output Lines – Two External Interrupt Lines – 48-lead LQFP/VQFP Package
Operating Voltage
– 3.3 - 6.0V
Speed Grade
– 0 - 1.5 MHz
®
RISC Architecture
8-bit Microcontroller with 8K Bytes Programmable Flash
AT90C8534
Preliminary

Description

The AT90C8534 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. By executing powerful instructions in a single clock cycle, the
Pin Configuration
ADIN0
NC NC NC NC NC NC NC NC NC
AGND
NC
NC
PA0
PA1
PA2
PA3NCNCNCNC
4847464544434241403938
1 2 3 4 5 6 7 8 9 10 11 12
1314151617181920212223
ADIN3
ADIN4
AVCC
ADIN5
ADIN1
ADIN2
NC
NC
RESET
PA4
VCC
PA5
NC
37
24
XTAL2
XTAL1
36
NC
35
INT0
34
INT1
33
PA6
32
NC
31
GND
30
NC
29
NC
28
NC
27
NC
26
NC
25
NC
(continued)
Rev. 1229B–11/00
1
AT90C8534 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consump­tion versus processing speed.

Block Diagram

Figure 1. The AT90C8534 Block Diagram
VCC
GND
AVCC
ADIN5..0
AGND
PROGRAM
COUNTER
PROGRAM
FLASH
PA0 - PA6
PORTA DRIVERS
DATA REGISTER
PORTA
ANALOG MUX ADC
REG. PORTA
STACK
POINTER
SRAM
DATA DIR.
8-BIT DATA BUS
MCU CONTROL
REGISTER
INT1,0
EXTERNAL
INTERRUPTS
OSCILLATOR
TIMING AND
CONTROL
XTAL1
XTAL2
RESET
INSTRUCTION
REGISTER
INSTRUCTION
DECODER
CONTROL
LINES
PROGRAMMING
LOGIC
2
AT90C8534
GENERAL PURPOSE
REGISTERS
X Y Z
ALU
STATUS
REGISTER
TIMER/
COUNTERS
INTERRUPT
UNIT
EEPROM
AT90C8534
The AVR core combines a rich instruction set with 32 general-purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers.
The AT90C8534 provides the following features: 8K bytes of programmable Flash, 512 bytes EEPROM, 256 bytes SRAM, 7 general output lines, 2 external interrupt lines, 32 general-purpose working registers, 2 flexible timer/counters, internal and external interrupts, 6-channel, 10-bit ADC, and 2 software-selectable power saving modes. The Idle mode stops the CPU while allowing the ADC, timer/counters and interrupt system to continue functioning. The Power-down mode saves the SRAM and register contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hard­ware reset.
The device is manufactured using Atmel’s high-density nonvolatile memory technology. The on-chip programmable Flash allows the program memory to be reprogrammed by a conventional nonvolatile memory programmer. By combining an 8-bit RISC CPU with programmable Flash on a monolithic chip, the Atmel AT90C8534 is a powerful microcontroller that provides a highly flexible and cost-effective solution to many embedded control applications.
The AT90C8534 AVR is supported with a full suite of program and system development tools including: C compilers, macro assemblers, program debugger/simulators, in-circuit emulators and evaluation kits.

Pin Descriptions

VCC
Digital supply voltage
GND
Digital ground

Port A (PA6..PA0)

Port A is a 7-bit output port with tri-state mode. The Port A output buffers can sink 20 mA and can drive LED displays directly. The port pins are tri-stated when a reset condition becomes active, even if the clock is not running.

INT1, 0

External interrupt input pins. A falling or rising edge on either of these pins will generate an interrupt request. Interrupt pulses longer than 40 ns will generate an interrupt, even if the clock is not running.

ADIN5..0

ADC input pins. Any of these pins can be selected as the input to the ADC.

RESET

Reset input. An external reset is generated by a low level on the RESET pin. Reset pulses longer than 100 ns will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier

AVCC

This is the supply voltage pin for the A/D Converter. If the ADC is not used, the pin must be connected to V used, the pin should be connected to VCC via a low-pass filter. See page 30 for details on operation of the ADC.

AGND

Analog ground. If the board has a separate analog ground plane, this pin should be connected to this ground plane. Otherwise, connect to GND.
. If the ADC is
CC
3

Crystal Oscillators

XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 2. Either a quartz crystal or a ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 3. Note that XTAL2 should not be used to drive other components.
Figure 2. Oscillator Connections
Figure 3. External Clock Drive Configuration

Architectural Overview

The fast-access register file concept contains 32 x 8-bit general-purpose working registers with a single clock cycle access time. This means that during one single clock cycle, one ALU (Arithmetic Logic Unit) operation is executed. Two operands are output from the register file, the operation is executed and the result is stored back in the register file – in one clock cycle.
Six of the 32 registers can be used as three 16-bit indirect address register pointers for Data Space addressing, enabling efficient address calculations. One of the three address pointers is also used as the address pointer for the constant table look-up function. These added function registers are the 16-bit X-register, Y-register and Z-register.
The ALU supports arithmetic and logic functions between registers or between a constant and a register. Single register operations are also executed in the ALU. Figure 4 shows the AT90C8534 AVR RISC microcontroller architecture.
In addition to the register operation, the conventional memory addressing modes can be used on the register file as well. This is enabled by the fact that the register file is assigned the 32 lowermost Data Space addresses ($00 - $1F), allowing them to be accessed as though they were ordinary memory locations.
4
AT90C8534
AT90C8534
The I/O memory space contains 64 addresses for CPU peripheral functions such as Control Registers, Timer/Counters, A/D converters and other I/O functions. The I/O memory can be accessed directly or as the Data Space locations following those of the register file, $20 - $5F.
The AVR uses a Harvard architecture concept – with separate memories and buses for program and data. The program memory is executed with a single-level pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables instructions to be executed in every clock cycle. The program memory is programmable Flash memory.
With the relative jump and call instructions, the whole 4K word (8K bytes) address space is directly accessed. Most AVR instructions have a single 16-bit word format. Every program memory address contains a 16- or 32-bit instruction.
During interrupts and subroutine calls, the return address program counter (PC) is stored on the stack. The stack is effec­tively allocated in the general data SRAM and, consequently, the stack size is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the stack pointer (SP) in the reset routine (before subroutines or interrupts are executed). The 9-bit stack pointer is read/write accessible in the I/O space.
The 256 bytes data SRAM can be easily accessed through the five different addressing modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.
Figure 4. The AT90C8534 AVR RISC Architecture
AVR
4K X 16 Program Memory
Instruction
Register
Instruction
Decoder
Control Lines
AT90C8534 Architecture
Program
Counter
32 x 8
General
Purpose
Registrers
Direct Addressing
Indirect Addressing
256 x 8
SRAM
Data Bus 8-bit
ALU
Data
Interrupt
Unit
Status
and Control
8-bit
Timer/Counter
16-bit
Timer/Counter
Analog to Digital
Converter
512 x 8
EEPROM
7
Output Lines
5
Figure 5. Memory Maps
Data MemoryProgram Memory
Program Flash
(4K x 16)
$000
32 Gen. Purpose
Working Registers
64 I/O Registers
Internal SRAM
(256 x 8)
$0000
$001F $0020
$005F $0060
$015F
$FFF
A flexible interrupt module has its control registers in the I/O space with an additional global interrupt enable bit in the status register. All the different interrupts have a separate interrupt vector in the interrupt vector table at the beginning of the program memory. The different interrupts have priority in accordance with their interrupt vector position. The lower the interrupt vector address, the higher the priority.
6
AT90C8534

General-purpose Register File

Figure 6 shows the structure of the 32 general-purpose working registers in the CPU.
Figure 6. AVR CPU General-purpose Working Registers
70Addr.
R0 $00
R1 $01
R2 $02
R13 $0D
General R14 $0E
Purpose R15 $0F
Working R16 $10
Registers R17 $11
R26 $1A X-register low byte
R27 $1B X-register high byte
R28 $1C Y-register low byte
R29 $1D Y-register high byte
R30 $1E Z-register low byte
R31 $1F Z-register high byte
AT90C8534
All the register operating instructions in the instruction set have direct and single-cycle access to all registers. The only exception are the five constant arithmetic and logic instructions SBCI, SUBI, CPI, ANDI and ORI between a constant and a register and the LDI instruction for load immediate constant data. These instructions apply to the second half of the registers in the register file – R16..R31. The general SBC, SUB, CP, AND and OR and all other operations between two registers or on a single register apply to the entire register file.
As shown in Figure 6, each register is also assigned a data memory address, mapping them directly into the first 32 loca­tions of the user Data Space. Although not being physically implemented as SRAM locations, this memory organization provides great flexibility in access of the registers, as the X-, Y- and Z-registers can be set to index any register in the file.

X-register, Y-register and Z-register

The registers R26..R31 have some added functions to their general-purpose usage. These registers are address pointers for indirect addressing of the Data Space. The three indirect address registers X, Y and Z are defined as:
Figure 7. X-, Y- and Z-registers
15 0
X-register 7 0 7 0
R27 ($1B) R26 ($1A)
15 0
Y-register 7 0 7 0
R29 ($1D) R28 ($1C)
15 0
Z-register 7 0 7 0
R31 ($1F) R30 ($1E)
In the different addressing modes these address registers have functions as fixed displacement, automatic increment and decrement (see the descriptions for the different instructions).
7

ALU – Arithmetic Logic Unit

The high-performance AVR ALU operates in direct connection with all the 32 general-purpose working registers. Within a single clock cycle, ALU operations between registers in the register file are executed. The ALU operations are divided into three main categories: arithmetic, logical and bit functions.

Programmable Flash Program Memory

The AT90C8534 contains 8K bytes of on-chip programmable Flash memory for program storage. Since all instructions are 16- or 32-bit words, the Flash is organized as 4K x 16. The Flash memory has an endurance of at least 1000 write/erase cycles. The AT90C8534 program counter (PC) is 12 bits wide, thus addressing the 4096 program memory addresses.
Constant tables must be allocated within the address 0 - 4K (see the LPM – Load Program Memory instruction description). See page 9 for the different program memory addressing modes.

SRAM Data Memory

The following figure shows how the AT90C8534 SRAM memory is organized.
Figure 8. SRAM Organization
Register File
R0 R1 R2
...
R29 R30 R31
I/O Registers
$00 $01 $02
...
$3D $3E $3F
Data Address Space
$0000 $0001 $0002
...
$001D
$001E $001F
$0020 $0021 $0022
...
$005D
$005E $005F
Internal SRAM
$0060 $0061
...
$015E $015F
The lower 352 data memory locations address the register file, the I/O memory and the internal data SRAM. The first 96 locations address the register file + I/O memory, and the next 256 locations address the internal data SRAM.
The five different addressing modes for the data memory cover: Direct, Indirect with Displacement, Indirect, Indirect with Pre-decrement and Indirect with Post-increment. In the register file, registers R26 to R31 feature the indirect addressing pointer registers.
The direct addressing reaches the entire data space.
8
AT90C8534
AT90C8534
The Indirect with Displacement mode features 63 address locations reached from the base address given by the Y- or Z-register.
When using register indirect addressing modes with automatic pre-decrement and post-increment, the address registers X, Y and Z are decremented and incremented.
The 32 general-purpose working registers, 64 I/O registers and the 256 bytes of internal data SRAM in the AT90C8534 are all accessible through all these addressing modes.
See the next section for a detailed description of the different addressing modes.

Program and Data Addressing Modes

The AT90C8534 AVR RISC microcontroller supports powerful and efficient addressing modes for access to the program memory (Flash) and data memory (SRAM, Register file and I/O memory). This section describes the different addressing modes supported by the AVR architecture. In the figures, OP means the operation code part of the instruction word. To simplify, not all figures show the exact location of the addressing bits.

Register Direct, Single Register Rd

Figure 9. Direct Single Register Addressing
The operand is contained in register d (Rd).

Register Direct, Two Registers Rd And Rr

Figure 10. Direct Register Addressing, Two Registers
Operands are contained in register r (Rr) and d (Rd). The result is stored in register d (Rd).
9

I/O Direct

Figure 11. I/O Direct Addressing
Operand address is contained in six bits of the instruction word. n is the destination or source register address.

Data Direct

Figure 12. Direct Data Addressing
Data Space
31
OP Rr/Rd
15 0
20 19
16 LSBs
16
$0000
$015F
A 16-bit data address is contained in the 16 LSBs of a 2-word instruction. Rd/Rr specify the destination or source register.
10
AT90C8534

Data Indirect with Displacement

Figure 13. Data Indirect with Displacement
AT90C8534
15
Y OR Z - REGISTER
15
OP an
Data Space
0
05610
$0000
$015F
Operand address is the result of the Y- or Z-register contents added to the address contained in six bits of the instruction word.

Data Indirect

Figure 14. Data Indirect Addressing
Data Space
015
X, Y OR Z - REGISTER
$0000
Operand address is the contents of the X-, Y- or the Z-register.
$015F
11

Data Indirect with Pre-decrement

Figure 15. Data Indirect Addressing with Pre-decrement
Data Space
015
X, Y OR Z - REGISTER
-1
$0000
$015F
The X-, Y- or the Z-register is decremented before the operation. Operand address is the decremented contents of the X-, Y- or the Z-register.

Data Indirect with Post-increment

Figure 16. Data Indirect Addressing with Post-increment
Data Space
015
X, Y OR Z - REGISTER
$0000
1
$015F
The X-, Y- or the Z-register is incremented after the operation. Operand address is the content of the X-, Y- or the Z-register prior to incrementing.
12
AT90C8534
AT90C8534

Constant Addressing Using the LPM Instruction

Figure 17. Code Memory Constant Addressing
Constant byte address is specified by the Z-register contents. The 15 MSBs select word address (0 - 4K), the LSB selects low byte if cleared (LSB = 0) or high byte if set (LSB = 1).

Indirect Program Addressing, IJMP and ICALL

Figure 18. Indirect Program Memory Addressing
PROGRAM MEMORY
$000
15 0
Z-REGISTER
$7FF/$FFF
Program execution continues at address contained by the Z-register (i.e., the PC is loaded with the contents of the Z-register).
13

Relative Program Addressing, RJMP And RCALL

Figure 19. Relative Program Memory Addressing
+1
Program execution continues at address PC + k + 1. The relative address k is from -2048 to 2047.

EEPROM Data Memory

The AT90C8534 contains 512 bytes of data EEPROM memory. It is organized as a separate data space, in which single bytes can be read and written. The EEPROM has an endurance of at least 100,000 write/erase cycles. The access between the EEPROM and the CPU is described on page 28, specifying the EEPROM Address Registers, the EEPROM Data Register, and the EEPROM Control Register.

Memory Access Times and Instruction Execution Timing

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 20 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 20. 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
14
AT90C8534
AT90C8534
Figure 21 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 21. Single Cycle ALU Operation
T1 T2 T3 T4
System Clock Ø
Total Execution Time
Register Operands Fetch
ALU Operation Execute
Result Write Back
The internal data SRAM access is performed in two System Clock cycles as described in Figure 22.
Figure 22. On-Chip Data SRAM Access Cycles
T1 T2 T3 T4
System Clock Ø
Address
Data
WR
Data
RD
Prev. Address
Address
Write
Read
15

I/O Memory

The I/O space definition of the AT90C8534 is shown in Table 1.
Table 1. AT90C8534 I/O Space
I/O Address (SRAM Address) Name Function
$3F ($5F) SREG Status REGister
$3E ($5E) SPH Stack Pointer High
$3D ($5D) SPL Stack Pointer Low
$3B ($5B) GIMSK General Interrupt MaSK register
$3A ($5A) GIFR General Interrupt Flag Register
$39 ($59) TIMSK Timer/Counter Interrupt MaSK register
$38 ($58) TIFR Timer/Counter Interrupt Flag register
$35 ($55) MCUCR MCU general Control Register
$33 ($53) TCCR0 Timer/Counter0 Control Register
$32 ($52) TCNT0 Timer/Counter0 (8-bit)
$2E ($4E) TCCR1 Timer/Counter1 Control Register
$2D ($4D) TCNT1H Timer/Counter1 High Byte
$2C ($4C) TCNT1L Timer/Counter1 Low Byte
$1F ($3E) EEARH EEPROM Address Register High Byte
$1E ($3E) EEARL EEPROM Address Register Low Byte
$1D ($3D) EEDR EEPROM Data Register
$1C ($3C) EECR EEPROM Control Register
$1B ($3B) PORTA Data Register, Port A
$1A ($3A) DDRA Data Direction Register, Port A
$10 ($30) GIPR General Interrupt Pin Register
$07 ($27) ADMUX ADC Multiplexer Select Register
$06 ($26) ADCSR ADC Control and Status Register
$05 ($25) ADCH ADC Data Register High
$04 ($24) ADCL ADC Data Register Low
Note: Reserved and unused locations are not shown in the table.
The AT90C8534 I/Os and peripherals are placed in the I/O space. The I/O locations are accessed by the IN and OUT instructions transferring data between the 32 general-purpose working registers and the I/O space. I/O registers within the address range $00 - $1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions. Refer to the instruction set section for more details. When using the I/O specific commands, IN and OUT, the I/O addresses $00 - $3F must be used. When addressing I/O reg­isters as SRAM, $20 must be added to this address. All I/O register addresses throughout this document are shown with the SRAM address in parentheses.
For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses should never be written.
The I/O and peripherals control registers are explained in the following sections.
16
AT90C8534
AT90C8534

Status Register – SREG

The AVR status register (SREG) at I/O space location $3F ($5F) is defined as:
Bit 76543210
$3F ($5F) I T H S V N Z C SREG
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial value 0 0 0 0 0 0 0 0
Bit 7 – I: Global Interrupt Enable
The global interrupt enable bit must be set (one) for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the global interrupt enable bit is cleared (zero), none of the interrupts are enabled independent of the individual interrupt enable settings. The I-bit is cleared by hardware when an interrupt routine is entered and is set by the RETI instruction to enable subsequent interrupts.
Bit 6 – T: Bit Copy Storage
The bit copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source and destination for the operated bit. A bit from a register in the register file can be copied into T by the BST instruction and a bit in T can be copied into a bit in a register in the register file by the BLD instruction.
Bit 5 – H: Half-carry Flag
The half-carry flag H indicates a half-carry in some arithmetical operations. See the Instruction Set description for detailed information.
Bit 4 – S: Sign Bit, S = N V
The S-bit is always an exclusive or between the negative flag N and the twos complement overflow flag V. See the Instruc­tion Set description for detailed information.
Bit 3 – V: Twos Complement Overflow Flag
The twos complement overflow flag V supports twos complement arithmetics. See the Instruction Set description for detailed information.
Bit 2 – N: Negative Flag
The negative flag N indicates a negative result from an arithmetical or logical operations. See the Instruction Set descrip­tion for detailed information.
Bit 1 – Z: Zero Flag
The zero flag Z indicates a zero result from an arithmetical or logical operations. See the Instruction Set description for detailed information.
Bit 0 – C: Carry Flag
The carry flag C indicates a carry in an arithmetical or logic operation. See the Instruction Set description for detailed information.
Note that the status register is not automatically stored when entering an interrupt routine or restored when returning from an interrupt routine. This must be handled by software.

Stack Pointer – SP

The AT90C8534 Stack Pointer is implemented as two 8-bit registers in the I/O space locations $3E ($5E) and $3D ($5D). As the AT90C8534 data memory has $15F locations, nine bits are used.
Bit 151413121110 9 8
$3E ($5E) –––––––SP8 SPH
$3D ($5D) SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 SPL
76543210
Read/Write RRRRRRRR/W
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value 0 0 0 0 0 0 0 0
00000000
The Stack Pointer points to the data SRAM stack area where the Subroutine and Interrupt Stacks are located. This stack space in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled. The Stack Pointer is decremented by 1 when data is pushed onto the stack with the PUSH instruction and it is
17
Loading...
+ 37 hidden pages