Programmable Watchdog Timer with On-Chip Oscillator
•
Low Power Idle and Power Down Modes
•
Programming Lock for Flash Program and EEPROM Data Security
•
Selectable On-Chip RC Oscillator
•
8-Pin Device
®
AVR
Enhanced RISC Architecture
8-Bit
Microcontroller
with 2K Bytes of
In-System
Programmable
Flash
AT90S2323
Description
The AT90S/LS2323 and AT90S/LS2343 is a low-power CMOS 8-bit microcontrollers
based on the
in a single cloc k cycl e, the AT 90S/LS 2323 and A T90S/ LS2343 achieves throug hputs
approaching 1 MIPS per MHz allo wing the system desi gner to optimize powe r consumption versus processing speed.
The AVR core combines a rich instr uction set with 32 gene ral purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU),
allowing two indep endent r egisters to be acce ssed in one singl e instr uction execute d
in one clock cycle. Th e resulting arc hitecture is mor e code efficie nt while achievin g
throughputs up to ten times faster than conventional CISC microcontrollers.
®
AVR
enhanced RISC arch itectu re. By exec uting pow erful in struc tions
Pin Configuration
PDIP/SOIC
RESET
(CLOCK) PB3
PB4
GND
1
2
3
4
AT90S/LS2343AT90S/LS2323
8
VCC
7
PB2 (SCK/T0)
6
PB1 (MISO/INT0)
5
PB0 (MOSI)
RESET
XTAL1
XTAL2
GND
1
2
3
4
8
VCC
7
PB2 (SCK/T0)
6
PB1 (MISO/INT0)
5
PB0 (MOSI)
AT90LS2323
AT90S2343
AT90LS2343
Preliminary
A T90S/LS2323
Rev. 1004AS–05/98
Note: This is a summary document. For the complete 34 page
document, please visit our website at
literature@atmel.com
and request literature #1004A.
www.atmel.com
or e-mail at
1
Block Diagram
Figure 1. The AT90S/LS2343 Block Diagram
VCC
GND
PROGRAM
COUNTER
STACK
POINTER
8-BIT DATA BUS
INTERNAL
OSCILLATOR
WATCHDOG
TIMER
TIMING AND
CONTROL
RESET
PROGRAM
FLASH
INSTRUCTION
REGISTER
INSTRUCTION
DECODER
CONTROL
LINES
PROGRAMMING
LOGIC
SRAM
GENERAL
PURPOSE
REGISTERS
X
Y
Z
ALU
STATUS
REGISTER
SPI
DATA REGISTER
PORTB
PORTB DRIVERS
PB0 - PB4
MCU CONTROL
REGISTER
TIMER/
COUNTER
INTERRUPT
UNIT
EEPROM
DATA DIR.
REG. PORTB
OSCILLATOR
2
AT90S/LS2323 and AT90S/LS2343
Figure 2. The AT90S/LS2323 Block Diagram
VCC
GND
PROGRAM
COUNTER
STACK
POINTER
AT90S/LS2323 and AT90S/LS2343
8-BIT DATA BUS
INTERNAL
OSCILLATOR
WATCHDOG
TIMER
TIMING AND
CONTROL
RESET
PROGRAM
FLASH
INSTRUCTION
REGISTER
INSTRUCTION
DECODER
CONTROL
LINES
PROGRAMMING
LOGIC
SRAM
GENERAL
PURPOSE
REGISTERS
X
Y
Z
ALU
STATUS
REGISTER
SPI
DATA REGISTER
PORTB
PORTB DRIVERS
Description
The AT90S/LS2323 and AT90S/LS2343 provides the following features: 2K bytes of In-System Programmable
Flash, 128 bytes EEPROM, 128 bytes SRAM, 3
(AT90S/LS2323) / 5 (AT90S/LS2343) general purpose I/O
lines, 32 general purpose workin g registers, an 8-bit
timer/counter, internal a nd externa l interru pts, progr ammable Watchdog Timer with internal oscillator, an SPI serial
port for Fla sh Memory down loading and two software
selectable power savi ng modes. The Idle Mo de stops the
CPU while allowing the SRAM, timer/counters, SPI port
and interrupt system to conti nue functioning. The pow er
down mode saves the register contents but freezes the
oscillator, disabling all other chip func tions until the next
interrupt or hardware reset.
The device is manufac tured using Atmel’s high density
non-volatile memory technology. The on-chip Flash allows
the program memory to be reprogrammed in-system
through an SPI serial interface. By combining an 8-bit RISC
CPU with ISP Flash on a monolithic chip, the Atmel
AT90S/LS2323 an d AT90S/LS234 3 is a powerful mi cro-
MCU CONTROL
REGISTER
TIMER/
COUNTER
INTERRUPT
UNIT
EEPROM
OSCILLATOR
DATA DIR.
REG. PORTB
PB0 - PB2
controller that provides a highly flexibl e and cost effective
solution to many embedded control applications.
The AT90S/LS2323 and AT90S/LS2343 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.
Comparison Between AT90S/LS2323
and AT90S/LS2343
The AT90S/LS2323 is intended for use with external quartz
crystal or ceramic resonator as the clock source. The startup time is fuse selectable as either 1 ms (suitable for
ceramic resonator) or 16 ms (suitable for crystal). The
device has three I/0 pins.
The AT90S/LS2343 is intended for use with either an external clock source or the internal RC oscillator as clock
source. The device has five I/0 pins.
3
Table 1 summarizes the differences in features of the two
devices.
Port B is a 3-bit bi-directional I/O port. Port pins can provide
internal pull-up resistors (selected for each bit).
RESET
Reset input. A low on thi s pin for t wo m achine c ycles while
the oscillator is running resets the device.
XTAL1
Input to the inverting os cillator ampl ifier and input to the
internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
Pin Descriptions AT90S/LS2343
VCC
Supply voltage pin.
GND
Ground pin.
Port B (PB4..PB0)
Port B is a 5-bit bi-directional I/O port. Port pins can provide
internal pull-up resistors (selected for each bit). W hen the
device is clocked from an external clock source, PB3 is
used as the clock input.
RESET
Reset input. A low on thi s pin for t wo m achine c ycles while
the oscillator is running resets the device.
CLOCK
Clock signal input in external clock mode.
Clock Sources
The AT90S/LS2323 contains an inverting amplifier which
can be configured for us e as an on-chip oscillato r, as
shown in Figure 3. XTAL1 and XTAL2 ar e input and ou tput
respectively. Either a quartz crystal or a ceramic resonator
may be used. It is recommended to use the AT90S/LS2343
if an external clock source is used, since this gives an extra
I/O pin.
The AT90S/LS2343 can be clocked by an external clo ck
signal, as shown in Figure 4, or by the on-chip RC oscillator. This RC oscillator runs at a nominal frequency of 1
MHz (VCC = 5V). A fuse bit - RCEN - in the Flash mem ory
selects the on-chip RC oscillator as the clock source when
programmed ('0'). The AT90S/LS2343 is shipped with this
bit programmed.
Figure 3. Oscillator Connection
Figure 4. External Clock Drive Configuration
4
AT90S/LS2323 and AT90S/LS2343
AT90S/LS2323 and AT90S/LS2343
AT90S/LS2323 and AT90S/LS2343
Architectural Overview
The fast-access register file concept contains 32 x 8-bit
general purpose worki ng regis ters with a sing le clo ck 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 res ult is stored b ack in th e regi ster fi le in one clock cycle.
Six of the 32 registers can be used as three 16-bits indirect
address register pointers for Data Space addres singenabling efficient address ca lculations. 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 be tween
registers or be tween a c onstant a nd a regi ster. S ingle re gister operations are also executed in the ALU. Figure 5
shows the AT90S/LS2 323 and AT90S/LS2343
Enhanced 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 e nabled by t he fact that the registe r file is
assigned the 32 lo wermost Data Space addre sses ($00 $1F), allowing them to be accessed as though they were
ordinary memory locations.
The I/O memory space contains 64 addresses for CPU
peripheral fu nction s as Cont rol Reg isters, Timer /Coun ters,
AVR
A/D-converte rs, and o ther I/O fun ctions. The I/O me mory
can be accessed di rectly, or as the Data Spac e locations
following those of the register file, $20 - $5F.
AVR
The
ries and buses for program and data. The program memory
is accessed with a two stage pipeline. 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
in-system downloadable Flash memory.
With the relative jump and call instructions, the whole 1K
address space is dir ectly ac cessed. M ost
have a single 16-bit word for mat. Every progr am memory
address contains a 16- or 32-bit instruction.
During interrupts a nd subrou tine cal ls, the r eturn addr ess
program counter (PC) is stored on the stack. The stack is
effectively allocat ed in the gene ral data S RAM , and co nsequently the stack size is only limited by the total SRAM size
and the usage of the S RAM . Al l user programs must init ial ize the SP i n th e r eset ro utine (be fore su brouti nes or int errupts are executed). The 8-bit stack pointer SP is read/write
accessible in the I/O space.
The 128 bytes data SRAM + register file and I/O registers
can be easily accessed through the five different addressing modes supported in the
The memory spaces in the
and regular memory maps.
has Harvard architecture - with separate memo-
AVR
instructions
AVR
architecture.
AVR
architecture are all linear
5
Figure 5. The AT90S/LS2323 and AT90S/LS2343 AVR Enhanced RISC Architecture
AT90S/LS2323 and AT90S/LS2343 Instruction Set Summary
MnemonicsOperandsDescriptionOperationFlags#Clock
ARITHMETIC AND LOGIC INSTRUCTIONS
ADDRd, RrAdd two RegistersRd
ADCRd, RrAdd with Carry two RegistersRd
ADIWRdl,KAdd Immediate to WordRdh:Rdl
SUBRd, RrSubtract two RegistersRd
SUBIRd, KSubtract Constant from Register Rd
SBIWRdl,KSubtract Immediate from WordRdh:Rdl
SBCRd, RrSubtract with Carry two RegistersRd
SBCIRd, KSubtract with Carry Constant from Reg.Rd
ANDRd, RrLogical AND RegistersRd
ANDIRd, KLogical AND Register and ConstantRd
ORRd, RrLogical OR RegistersRd
ORIRd, KLogical OR Register and ConstantRd
EORRd, RrExclus ive OR RegistersRd
COMRdOne’s ComplementRd
NEGRdTwo’s ComplementRd
SBRRd,KSet Bit(s) in RegisterRd
CBRRd,KClear Bit(s) in RegisterRd
INCRdIncrementRd
DECRdDecrementRd
TSTRdTest for Zero or MinusRd
CLRRdClear RegisterRd
SERRdSet RegisterRd
BRANCH INSTRUCTIONS
RJMPkRelative JumpPC
IJMPIndirect Jump to (Z)PC
RCALLkRelative Subroutine Call PC
ICALLIndirect Call to (Z)PC
RETSubroutine ReturnPC
RETIInterrupt ReturnPC
CPSERd,RrCompare, Skip if Equalif (Rd = Rr) PC
CPRd,RrCom pareRd
CPCRd,RrCompare with CarryRd
CPIRd,KCompare Register with ImmediateRd
SBRCRr, bSkip if Bit in Register Clearedif (Rr(b)=0) PC
SBRSRr, bSkip if Bit in Register is Setif (Rr(b)=1) PC
SBICP, bSkip if Bit in I/O Register Clearedif (P(b) =0) PC
SBISP, bSkip if Bit in I/O Register is Setif (R(b)=1) PC
BRBSs, kBranch if Status Flag Setif (SREG(s) = 1) then PC
BRBCs, kBranch if Status Flag Clearedif (SREG(s) = 0) then PC
BREQ kBranch if Equal if (Z = 1) then PC
BRNE kBranch if Not Equalif (Z = 0) then PC
BRCS kBranch if Carry Setif (C = 1) then PC
BRCC kBranch if Carry Clearedif (C = 0) then PC
BRSH kBranch if Same or Higher if (C = 0) then PC
BRLO kBranch if Lowerif (C = 1) then PC
BRMI kBranch if Minusif (N = 1) then PC
BRPL kBranch if Plus if (N = 0) then PC
BRGE kBranch if Greater or Equal, Signedif (N
BRLT kBranch if Less Than Zero, Signedif (N
BRHS kBranch if Half Carry Flag Setif (H = 1) then PC
BRHC kBranch if Half Carry Flag Clearedif (H = 0) then PC
BRTS kBranch if T Flag Setif (T = 1) then PC
BRTC kBranch if T Flag Clearedif (T = 0) then PC
BRVS kBranch if Overflow Flag is Setif (V = 1) then PC
BRVC kBranch if Overflow Flag is Clearedif (V = 0) then PC
BRIE kBranch if Interrupt Enabledif ( I = 1) then PC
BRID kBranch if Interrupt Disabledif ( I = 0) then PC
← PC + k + 1 None2
← Z None2
← PC + k + 1None3
← ZNone3
← STACKNone4
← STACKI4
← PC + 2 or 3None1 / 2
− RrZ, N,V,C,H1
− Rr − CZ, N,V,C,H1
− KZ, N,V,C,H1
← PC + 2 or 3 None1 / 2
← PC + 2 or 3None1 / 2
← PC + 2 or 3 None1 / 2
← PC + 2 or 3None1 / 2
←PC + k + 1None1 / 2
←PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
⊕ V= 0) then PC ← PC + k + 1None1 / 2
⊕ V= 1) then PC ← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
← PC + k + 1None1 / 2
(continued)
8
MnemonicsOperandsDescriptionOperationFlags#Clocks
DATA TRANSFER INSTRUCTIONS
MOVRd, RrMove Between RegistersRd
LDIRd, KLoad ImmediateRd
LDRd, XLoad IndirectRd
LDRd, X+Load Indirect and Post-Inc.Rd
LDRd, - XLoad Indirect and Pre-Dec.X
LDRd, YLoad IndirectRd
LDRd, Y+Load Indirect and Post-Inc.Rd
LDRd, - YLoad Indirect and Pre-Dec.Y
LDDRd,Y+qLoad Indirect with DisplacementRd
LDRd, ZLoad Indirect Rd
LDRd, Z+Load Indirect and Post-Inc.Rd
LDRd, -ZLoad Indirect and Pre-Dec.Z
LDDRd, Z+qLoad Indirect with DisplacementRd
LDSRd, kLoad Direct from SRAMRd
STX, RrStore Indirect(X)
STX+, RrStore Indirect and Post-Inc.(X)
ST- X, RrStore Indirect and Pre-Dec.X
STY, RrStore Indirect(Y)
STY+, RrStore Indirect and Post-Inc.(Y)
ST- Y, RrStore Indirect and Pre-Dec.Y
STDY+q,RrStore Indirect with Displacement(Y + q)
STZ, RrStore Indirect(Z)
STZ+, RrStore Indirect and Post-Inc.(Z)
ST-Z, RrStore Indirect and Pre-Dec.Z
STDZ+q,RrStore Indirect with Displacement(Z + q)
STSk, RrStore Direct to SRAM(k)
LPMLoad Pr ogram MemoryR0
INRd, PIn PortRd
OUTP, RrOut PortP
PUSHRrPush Register on StackSTACK
POPRdPop Register from StackRd
BIT AND BIT-TEST INSTRUCTIONS
SBIP,bSet Bit in I/O RegisterI/O(P,b)
CBIP,bClear Bit in I/O RegisterI/O(P,b)
LSLRdLogical Shift LeftRd( n+1)
LSRRdLogical Shift RightRd(n)
ROLRdRotate Left Through CarryRd(0)
RORRdRotate Right Through CarryRd(7)
ASRRdArithmetic Shift RightRd(n)
SWAPRdSwap NibblesRd(3..0)
BSETsFlag SetSREG(s)
BCLRsFlag ClearSREG(s)
BSTRr, bBit Store from Register to TT
BLDRd, bBit load from T to RegisterRd(b)
SECS et CarryC
CLCClear CarryC
SENSet Negative FlagN
CLNClear Negative FlagN
SEZSet Zero FlagZ
CLZClear Zero FlagZ
SEIGlobal Interrupt EnableI
CLIGlobal Interrupt DisableI
SESSet Signed Test FlagS
CLSClear Signed Test FlagS
SEVSet Twos Complement OverflowV
CLVClear Twos Complement OverflowV
SETSet T in SREGT
CLTClear T in SREGT
SEHS et Half Carry Flag in SREGH
CLHClear Half Carry Flag in SREGH
NOPNo OperationNone1
SLEEPSleep(see specific descr. for Sleep None3
WDRWatchdog Reset(see specific descr. for WDR/timer)None1