AVR-RISC Evaluation System (1) : Experiment With Atmel's Latest RISC Processors
AVR-RISC Evaluation System (1) : Experiment With Atmel's Latest RISC Processors
time now, and is generally recognised as a very fast device. The price, too, is
good at less than £3 even in the hobby market. So, substituting a couple of logic
ICs (and their sockets) by an AVR device may already pay off. The most interesting
aspect of this processor is, however, that it features a serial interface with direct
access to the on-chip memory. The general concept of the AVR processor was
already discussed in our January 1998 magazine. The present article aims at
showing some more practical applications of the 90S1200, using easy to obtain
hardware and software.
AVR-RISC evaluation
system (1)
experiment with Atmel’s latest
RISC processors
To give its new AVR processor family a instance, a complete assembler (for downloading. So, if you want to famil-
head start, Atmel has made quite a few DOS as well as Windows) and a simula- iarise yourself with these new processors
software utilities available free of tor. The relevant datasheets and soft- without committing yourself to hard-
charge on their web site. There is, for ware documentation are also free for ware for the time being, our advice is
100k
1 8
OE Vdd. C7 S1 PROG/RUN
C5 IC1
1 NC NC 24 Atmel Assembler to be loaded into the
2 NC NC 23
SG531P
100n 12.0000MHz 3 /RESET Vcc 22
100n
IC2d K2
processor, you need special download
JP2 R9
4
GND OUT
5 4 PD0
PD1
(SCK)PB7
(MISO)PB6
21 PB7 PB6 9
1
8
1k 1 software. Because the author was
5 20 PB6
6 XTAL2 (MOSI)PB5 19 PB5
IC2e
6
unable to find a suitable program on
2
XTAL1 PB4
X1
7
8 PD2(INT0) PB3
18 PB4
17 PB3
PB5
JP3 R8
1k
10
1
11
R10
10k
7 the Atmel web site, he came up with his
9 PD3 PB2 16 PB2
3
8
own solution. The resulting program and
10 PD4(TO) (AIN1)PB1 15 PB1 IC2f
C2 12MHz C1
R24 11 PD5 (AIN0)PB0 14 PB0 PB7
JP1 R7
12 13
R11 4 its source code file (written in Pascal) is
1k 1 10k 9
GND PD6 available on a disk with order code
1k
22p 22p 12 13
5
R6 R13 R12
986020-1. This disk, and the software
100k
100k
100k
T
ISP/
RS232
picked from the Atmel web site then
5V
forms a complete package, and you
R14
14
PB4
20k are ready to get started.
C6 1% R15
10k
IC2 K3
IC2 = 74HC14 100n R16 1%
7 1 PB3
20k
2
1% R17
Example programs
10k
3 PB0
R18 1% DAC
K4 5V 4 PB1 PB2
9...15V D1 7805 5 PB2
20k
R19
A good way to learn about micro-
1%
10k
IC3
R25
6 PB3
R20 1%
processor programming is to test fully
1N4001 7 PB4 PB1
functional programs, and then modify
1k
20k
8 PB5 R21
1%
10k
C3 C4 9 PB6
R22 1%
and extend them. In case of newly
10 PB7 PB0
100µ
25V
10µ
10V
D2 20k
1% R23 released processors, the decisive fac-
20k
FC10HB
1%
tor is often whether or not a supply of
5V
980082-11 ready-made ‘modules’ is available.
PB0 PB1 PB2 PB3 PB4
Such modules may relieve you from the
burden of writing, say, your own char-
acter input/output routines, to mention
but one example. The project disk con-
tains a fair number of such modules
(see T a b l e 1 ), which should help to
unburden beginners, allowing them to
concentrate on more essential matters
Figure 1. Circuit diagram of the AVR evaluation system.
in the learning process. Unfortunately,
a full discussion of all modules on the
disk is beyond the scope of this article.
Those of you who are interested in the
to go to www.atmel.com, where you will shown in Figure 1. Actually, the circuit programming details are referred to the
find lots of interesting stuff, including consists of no more than a six-fold (hex) commented source code files on the
Schmitt trigger which translates the sig- disk, and to the file XAVR.DOC which
- an assembler for the Atmel AVR fam- nals at the serial PC-RS232 interface presents an overview of available pro-
ily; into levels that can be processed by grams, complete with concise descrip-
- a simulator for the AVR family; processor’s serial interface, which is nei- tions and application examples. In this
- example programs illustrating: ther RS232 compatible nor asynchro- article, we present just a few of the
simple arithmetic nous. Then there is a switch that many ideas that may be realized using
EEPROM use enables you to change from ‘‘software the AT90S1200. Our aim is to pick out
download’’ to ‘‘run program’, and a those applications in which speed is the
quartz crystal or crystal oscillator mod- decisive factor. After all, a fast beast
Evaluation system ule which generates the processor like the AVR-RISC processor is by no
Atmel also has available a demonstra- clock signal. If you foresee applications means required to switch a lamp on
tion board and the associated control requiring high accuracy (for example, and off every few seconds! You will not
software. Unlike the above mentioned frequency or time measurements), the find such applications in this article. By
software and documentation, this best choice is the oscillator module (fit- contrast, you will learn, for instance,
material is not free of charge. Because ted in a socket). In that case, only the how various clock signals may be
Elektor Electronics magazine constantly oscillator IC1 is mounted, while X1, C1 derived from a 10 MHz source. Such an
aims at addressing the active (i.e., sol- and C2 are simply omitted. With less application is surely too much to ask of
dering) electronics enthusiast, we critical applications, a simple crystal is, an 8051, while the AT90S120 can man-
started to develop our own experi- of course, the more economical age!
menting system for the AVR-RISC option. If you intend to program lots of
processors. The circuit diagram is processors, then it is advisable to use a
C1
C2
T
T
R24
IC1
X1
980082-1
R3
R4
C7
K1
T
B4 B3 B2 B1 B0
1-280089
ROTKELE )C(
980082-1
(C) ELEKTOR
S1
RUN
JP1
JP2
JP3
K3
R7
R8
PROG
R23 R2
C4
R22 R1
D2
R21
R20
IC2
R19
R25
R18
IC3
R17
C6
R16
R15
R14
R10
R11
R12
R13
R6
R5
R9
C3
DAC
T
D1
K4
H3
H1
One instruction every 66ns: AT90S1200: a quick input/output ports (Port B and Port D) of
applications overview which each pin is individually address-
Tne AT90S1200 may be operated at a Mainly because of its RISC architecture, able as an input or an output. Program
clock frequency of up to 16 MHz. the structure of the AT90S1200 proces- execution runs under the control of the
Because most instructions are executed sor remains wonderfully simple. F i g- central clock frequency which may be
within a single clock pulse, it is possible u r e 3 provides and overview. The sec- any value between 0 and 16 MHz. In
to execute instructions at a rate of tion we are particularly interested in is addition, there is an interrupt control
16 million per second. So, if you want a an array of 30 8-bit registers that may system and a small 8-bit timer/counter.
certain routine to be executed one mil- be used to perform calculations and The complete description of the
lion times in one second, the relevant store results. Then there are two AT90S1200 covers about 50 pages,
program section may have a length of
10 to 16 instructions. Using this number
of instructions quite a lot can be done.
Of course, at the hardware level only,
who can imagine a Windows program
with a length of just a few tens of bytes? Table A
A really fast processor may often be
used when economising on the num- ; semicolon used as comment delimiter
ber of digital ICs while the speed is not
.def sum=20 ; use .def to assign symbolic names to registers
so high as to necessitate the use of mov r2,r3 ;copy contents of register R3 to R2
expensive programmable logic. The ldi r17,r123 ;load register r17 with 123
great thing about such a microcon- add r20,r21 ; register r20 becomes sum r20+r21
troller is that you have access to an adc r20,r21 ; register r20 becomes sum r20+r21+carry
army of registers, and to an accumu- sbi PORTB,2 ; set port B line 2
lator capable of doing sums! Those of clr r27 ; clear r20 to 0
brne loop ; jump to loop when not zero
you who have ever attempted to make sbrs r20,2 ; skip if bit in register set
programmable logic do simple calcu- ; skip next instruction when bit 2 of r20 is set
lations will appreciate this facility.
COMPONENTS LIST
Resistors:
R1,R5,R10,R11 =10kΩ
R2,R6,R12,R13 =100kΩ
R3,R7,R8,R9,R24,R25 =1kΩ
R4 = 5kΩ6
R14,R16,R18,R20,R22,R23 =20kΩ 1% Figure 3. Atmel AT90S1200 processor architecture.
R15,R17,R19,R21 = 10kΩ 1%
Capacitors:
C1,C2 = 22pF ceramic (see text) 17 18 19 20 21
C3 = 100µF 25V radial
C4 = 10 µF 10V radial 1 2 3 4 5 6 7 8 9 10
C5,C6,C7 = 100nF ceramic
Semiconductors:
D1 = 1N4001 B0
D2 = LED red high efficiency
IC1 = SG531P12.0000MHz EPSON
(Eurodis), see text
IC2 = 74HC14
IC3 = 7805
B1
Miscellaneous:
X1 = 12MHz see text
K1 = 24-way Aries 0.3-0.6inch (Farnell)
JP1,JP2,JP3 = 2-way jumper
S1 = slide switch, 1x changeover, PCB
mount
B2
K2 = 9-way SUB-D socket
K3 = 10-way boxheader (optional)
K4 = mains adapter socket, PCB mount 980082-13
PCB: order code 980082-1, see Readers
Services page.
Disk: order code 986020-1, see Readers Figure 4. Because of its speed, the Atmel controller is capable of generating complex
Services page. digital patterns at frequencies well over 10 MHz.