Documente Academic
Documente Profesional
Documente Cultură
by Dr M. Ohsman
AVR-RISC evaluation
system (2)
experiment with
Atmels latest RISC processors
Due to its high clock frequency (up to applications is to study easily imple- ratios. For example, the 12 MHz clock
16 MHz) and its RISC structure, which mented sample programs. The pro- must be divided by 625 to produce
allows it to execute most instructions gram for the first application example, the well-known serial bit rate of 19200
within one clock cycle, the very inex- a simple signal-pattern generator, was pulses per second. A divider based on
pensive Atmel AVR controller can take included in the first part of this article. a microcontroller has the great advan-
on applications that would normally The step from a this simple pattern tage that it is often more flexible than
require the use of more costly pro- generator to a frequency divider is not a classical design. The program listing
grammable logic devices. The easiest very great. You can construct simple shown in Figure 6 (SCDIV625.ASM), for
way to learn how to program such wait loops for relatively large divider example, not only divides by 625, but
Listing figure 9
10k
.def d2 =r18
.def d3 =r19
B3 20k
.def nco0 =r25
.def nco1 =r26
10k
out DDRB,r16
ldi d2,$A7
ldi d3,$01
B0 20k
LOOP: add nco0,d0 ; 29 bit nco summation
adc nco1,d1
20k
adc nco2,d2
adc nco3,d3
Listing figure 12 To PC
1 1
measure: 6
2 2
clr sum0 PD0 5k6 7
3
clr sum1 22p 8
4 4
clr sum2 X2 9
5
waitL: sbic PIND,4 ; wait until we are in a LOW 12MHz
state 5
rjmp waitL X1
22p
waitH: sbis PIND,4 ; wait until line goes high 0
TO 1k
rjmp waitH f in
m1: add sum0,one ; [1] one loop= 6 cycles
20 10 T in
adc sum1,zero ; count 24 bits wide 5V
adc sum2,zero
sbic PIND,4 ; [1/2] 100n 980082-18
keyboard switch
many computers, one keyboard
1N4001 4x case
as PC 1
CNY71-2
5 1
On the other hand, you could buy one
5V DIL BC of the professional switchover boxes
547B 1 = CLK
2 = DATA for keyboards, mice and monitors.
4 = GND
1N4001 220...1000
4 2
5 = VCC
Although these are practically mainte-
470
delay
nance-free (since they work electroni-
cally) and can be modularly extend-
ed, they will put you out of pocket for
+ Ub + Ub
Ub Ub at least 100 per connected PC (!).
+Vcc +Vcc
GND GND
5x
100 BC547B
CTRDIV10/ 0 3 10k
DEC 2
1 10k
IC3 4 21x
2
1k
470k
10k
14 7 1N4148
3
IC2d IC2c & +
4
10
10k
10k
FND500 Figure 1: The schematic diagram of the
9 5 13 1 6
1
8
1
4
5
5 dp
keyboard switch, showing one full set of
4017 6 a
100
7
6
b the circuits to be installed in each PC.
2k7
15 9 overflow
CT=0 8 c
047 9
11
d
The circuit in the lower outlined box is
12
CT5
10 Ta 14
e
f
required for each PC connected to the
100k
100k
100k
100k
100k
1N4148
IC2 g CC CC switch; that in the upper outlined box is
1
10k
7
needed for each PC only if PC1 is not
IC2 = 74HC14
982082 - 11
always switched on.
CD-R formats
all about ISO, Romeo, Joliet and UDF
982083 - 11a
laser light Heating/
gradual cooling
Erased state Recorded state
(higher reflectivity) (lower reflectivity)
982083 - 11b
(just as with a normal CD). This track players) can handle CD-RW disks tain at most (74 minutes) x (60 sec-
serves to guide laser assembly. A coat- properly; suitable players can be rec- onds) x (75 sectors) x (2048 bytes) =
ing of a special organic material is ognized by the designation multi- 650 MB. From this figure, we must sub-
deposited on the polycarbonate layer, read. tract a few megabytes that are
and this organic layer is covered by a reserved for session and directory
reflective layer (gold, for example). Data volume information. The XA standard, which is
The reflective layer is covered by a also shown in Figure 2, has a some-
protective lacquer layer. There is a lot of confusion regarding what different structure but still has a
When a CD-R disk is written, the organ- the amount of data that can be stored net data capacity of 2048 bytes per
ic material is locally heated by the on a CD-R(W). One manufacturer sector for mode 2 form 1.
laser beam. This changes the reflectiv- specifies a capacity of 650 MB, anoth- If you now think that you can use
ity of the gold layer at the location that er claims 700 MB and yet another mode 2 (or XA mode 2 form 2) to put
has been heated, and this change specifies 74 minutes. In principle, all more data on a CD-ROM, you are in
can be sensed as a pit by a CD read- CD-Rs have the same capacity, plus or for a disappointment. These modes
er. Although this is not a true pit as minus a few megabytes. The actual are only intended to be used for CDs
with a normal CD, it can be ade- amount of data that can be stored where error correction is not particular-
quately detected by a CD-ROM drive depends on the type of information ly important, such as video CDs.
or an audio CD player. that is to be put on the disk. Figure 2
In principle, the relatively new compares the various possibilities. The Sessions
rewritable CD (CD-RW) uses the same length of the tack on a CD is divided
construction as the CD-R (see Figure into minutes and seconds (which In order to later add more data to a
1b). It also has a pre-moulded spiral comes from audio CDs). The basic CD that already contains some data,
track that serves as a guide for the length of a standard CD is 74 minutes. we can utilize multiple sessions. A ses-
laser assembly. On top of this there are Each second consists of 75 sectors sion is a block of data that is written to
two dielectric layers that sandwich a that contain data. Each sector of an the CD by the CD-writer in one pass,
special material in which the pits are audio CD contains 2352 bytes (see and it includes a directory section
burned. A reflective layer of gold or Figure 2a), which would amount to placed after the data. A multisession
silver sits on top of these layers, and almost 747 MB for a 74-minute CD (if CD contains one or more additional
finally there is the usual protective lac- we calculate using the computer sessions located after the first session.
quer layer. The storage layer can be thousand = 1024). If we take mega Each time that a new session is added,
switched between two different phas- to simply mean one million (as hard- the directory must be updated. This is
es (an amorphous phase and a crys- disk drive makers like to do), we come done during the writing process by
talline phase), depending on how up with the even more impressive fig- reading the directory information for
quickly it is heated and cooled by the ure of 783 MB! the previous sessions and adding the
laser beam. A lifetime of more than However, if we want to store computer information relating to the current ses-
one thousand phase changes is possi- data on a CD, it turns out that extra sion, to form a new directory that is
ble with present-day CD-RW disks. synchronisation data and error-correc- then written at the end of the current
Each phase of the storage layer mate- tion codes are needed. The original session. This, and the fact that a lead-
rial has a different reflectivity. Since the standard defines mode 1 and out (termination of the previous ses-
difference between the two reflectivi- mode 2, where mode 1 includes a sig- sion) and a lead-in (start of the current
ties of a CD-RW is less than that of a nificant amount of correction data. session) must also be added, cause a
normal CD or a CD-R, CD-RW disks The result is that each sector can certain amount of storage capacity to
cannot be read in all CD-ROM drives. effectively contain only 2048 bytes of be lost: 22 MB for the first session and
Only relatively modern types (and DVD user data. A CD-ROM can thus con- 13 MB for each following session. If the
The CD books
The specifications of the various types of CD format are defined in a number of books that are named after the colours
originally used for their jackets.
Red Book
This is the original standard for audio CDs, as defined by Philips and Sony more than 20 years ago. Here you will find
(among other things) specifications for the audio data format, the structure of the tracks on the CD, the maximum num-
ber of audio tracks (99) and the methods used for error detection and correction.
Yellow Book
This is a supplement to the Red Book, which describes how computer data must be put on a CD. It defines two modes:
mode 1 and mode 2. A later supplement describes the XA format (eXtended Architecture), which allows audio, video and
computer data to be placed on a single CD. This supplement was made necessary by the development of the Photo CD.
Orange Book
This book specifies the formats for CD-R, magneto-optical disks and other types of (re)recordable CDs. It also includes the
multisession standard. Many of the specifications in the Orange Book are also reused in other books.
Blue Book
This defines the organizations of the CD-Erasable and CD-Extra formats (also known as CD-Plus or CD-Enhanced). In CD-
Extra, audio and computer data are stored on two separate parts of the CD, with the computer data always placed after
the audio data to avoid problems with normal audio-CD players. The audio portion is structured according to the Red
Book standard and the computer data portion according to the Yellow Book standard. Multisession capability is derived
from the Orange Book standard.
Green Book
The Green Book contains the standard for CD-i, which was brought to life by Philips. One of the most important features of
this standard is the synchronization of separate audio and video tracks. Both CD-ROM players and audio-CD players can
usually not read such CDs.
White Book
This defines the standards for putting video data on CDs. It also contains the MPEG specification for compressing video
and audio data. Such CDs are organized according to the XA format.
A compact display
controller
driving a display or printer using only two ICs
Design by T. Scherer
master/slave switch
deluxe switch on slave devices
safely and automatically
To enable the large number of periph- plete with a printed circuit board, and ply. I heard crackling and ticking
erals connected to his Macintosh to an enclosure with the necessary plug sounds, and sometimes the monitor
be switched on together with the com- and sockets. Alas, such gizmos do not and other peripherals would suddenly
puter, the author got hold of a mas- work very well when the master come to life with the computer
ter/slave switch DIY kit that came com- device is a switch-mode power sup- switched off.
1k
tor, R5, between K1 and K2. As soon as BTA04
current starts to flow to the master, R5 -600T
drops an alternating voltage which is R5
D5 D6
R2
C6
C5 K3
limited to 0.7 V by D5 and D6. R5, 33
33k
incidentally, allows a master power 10
0W5 100n 16V
consumption of up to 600 watts. Low- SLAVE
pass filter R7-C4 removes high-fre- 2x
1N4007 5 6
quency noise from the alternating volt-
age. As mentioned above, it is partic- IC2b
IC2 = LM324 A1 G
ularly this type of noise that wreaks A2
havoc in commercial master/slave 7
R7
capacitor C6. Buffer IC2b completes D8
27k
9 T1
the current-sense sub-circuit. R11 TRI1
8
The next comparator, IC2c, defines IC2c 10k A2
10
the switch-on threshold of the circuit. P1 R13
The green low-current LED D8 not only G A1
10k R9 BC557 82
acts as an on/off indicator (i.e. circuit 220k R14 BTA04
R6 C7 -600T
connected to the mains), but also pro-
1k
1k
~ 0 ~ 0
H1
H2
Resistors:
TRI1
D8
R1,R2 = 33k
L1
R13
R14
K2 Master K3 Slave R3,R6,R14 = 1k
R8
R5 982063-1
D5 R1
R3 R4 R4 = 15k
D6
K1 D7
T1 R5 = 33, 0.5 W
R2
R7
0 C6 R7 = 27k
IC2
P1 R8,R10 = 820
F1 C5
6.3AT
TR1 C7 R9 = 220k
R6
C4 R9
C3
R11 R11 = 10k
~ R12
R12 = 22k
R10
D2
D1 IC1 R13 = 82
C1 D9 D3
D4 P1 = 10k preset H
H3
H4
Capacitors:
C1 = 47nF 630V (Class X2)
982063-1 (C) ELEKTOR C2 = 220F 25V radial
C3 = 47F 16V radial
C4,C5 = 100nF
C6 = 10F 16V radial
C7 = 10nF
Semiconductors:
D1...D4 = 1N4001
D5,D6 = 1N4007
D7 = 1N4148
D8,D9 = LED
T1 = BC557
Tri1 = BTA04-600T (SGS-Thomson)
IC1 = 78L05
IC2 = LM324
Miscellaneous:
F1 = Fuse 6.3A slow with PCB mount
Figure 2. The carefully designed PCB ensures safe constructing. holder
K1,K2,K3 = 3-way PCB terminal block,
pitch 7.5mm
Tr1 = mains transformer, PCB mount
(Conrad Electronics o/n 506052)
Figure 3. It is essential that the circuit be mounted so that it can not be touched when
L1 = suppressor choke 65 H/5 A
in operation. (Conrad Electronics o/n 534439)
Heatsink for Tri1 (Fischer SK59)
2 LED lenses, transparent (Conrad
Electronics o/n 539910)
PCB, order code 982063-1 (see Readers
Services page).
RF signal generator
part 1: circuit descriptions
An RF signal genera-
tor is used for repair-
ing radio/TV circuits,
checking filters, align-
ing receivers, and for
comparative sensitiv-
ity tests on all kinds of
receivers, whether
home-made, restored
surplus or off-the-
shelf. The generator
described here has an
output frequency
range of 0.5 to A rock-solid RF signal with an accu- receiver RF input and IF (intermediate
rately known frequency and level is a frequency) sections can not be tested
30 MHz, making it must for anyone seriously involved in with any degree of certainty if a trust-
suitable for many repairing radio receivers and other
communications equipment like filters
worthy RF signal generator is not to
hand. Unfortunately, professional-
applications. and even antennas. In particular, grade RF signal generators (like the
mighty Hewlett Packard 8640B in our
design lab) cost an arm and a leg, even
in the surplus trade. None the less, you
will see at least one RF signal generator,
Main specifications home-made, thrown together from
other bits and pieces, or ex-MOD, in
Frequency range: 0.5 MHz to 30 MHz the shack of the more advanced radio
Output level: 0 dBm down to 79 dBm in 1-dB steps amateur, simply because this piece of
Max. output level: 0.63Vpp into 50 test gear is as indispensable as the plain
Output impedance: 50 old multimeter.
AM input The stability of the RF signal gen-
FM input erator described in this article is such
LCD readout that it will meet the (moderate)
Microprocessor controlled demands of many amateurs. Offering
Optional serial interface a frequency range of 0.5 through
30 MHz and an output level down to
80 dBm, it is perfect for testing and
aligning many receivers and their sub-
Design by Guido Brunner circuits like RF/IF amplifiers, mixers
is illustrated
in Figure 1.
The block Figure 1. Block dia-
diagram depends on the current gram of the RF Signal trol loop is not capable
shows that passed by T3. The actual Generator. All intelli- of tracking the insta-
the heart of resonating element in gence is vested in a bility caused by the
the circuit is the oscillator is an L-C microcontroller. modulation signal.
a PLL syn- parallel tuned circuit To make sure it is
thesizer mod- connected to the input not too heavily loaded,
ule keeping a of the difference amplifier. The LC net- the oscillator signal is first buffered by a
VCO (volt- work consists of inductors L1-L5 in FET (field-effect transistor), T4. Next
age-controlled combination with variable-capacitance comes the real amplifier, IC1, a type
oscillator) in check. The diodes (varicaps) D9 and D10. The NE592 which some of you may know
VCO output signal is amplified and other input of the oscillator is from baseband-video amplifiers in
fed to the generator output as well to grounded for RF by capacitor C10. satellite-TV receivers. The amplifier is
the synthesizer input and the input of Depending on the desired frequency biased at half the supply voltage by
the attenuator. The PLL obtains digital range, one or more inductors are opamp IC3b, and its gain is defined by
information on the target VCO fre- switched into the oscillator. This is series network R26-L8. Because of the
quency from a microprocessor module. done by pulling the non-commoned inductor action, the gain decreases at
The micro also takes care of the front- terminals to RF ground using +5V higher frequencies. Because the VCO
panel mounted user interface, which control voltages on PIN diodes D2, D4, strives to maintain a stable output
consists of 3 switches, a rotary encoder D6 and D8. In the highest frequency level, less gain on the NE592 automat-
and an LCD (liquid-crystal display). It range, all inductors are effectively con- ically more gain in the differential oscil-
also controls the amount of attenuation nected in parallel. This is necessary to lator. This purposely-created effect is
at the generator output, across a range make sure that the non-selected induc- essential for reliable starting of the
of 1 dB through 79 dB. An optional tors and their parasitic capacitance can oscillator at higher frequencies.
serial interface is available to enable the not form a series tuned circuit that The NE592 being a differential
RF Signal Generator to be linked to a would prevent the oscillator from amplifier, it has two inputs, but also
PC using an RS232 cable. Functionally, operating at the desired frequency. All outputs. Both are used here. The signal
the instrument is completed by an inductors are off-the-shelf miniature at the first output (pin 7) is applied to
internal power supply. chokes. The frequency range switching emitter follower T5 which supplies the
takes place at 1.024 MHz, 2.304 MHz, actual generator output signal at an
PLL BOARD 5.376 MHz and 13.056 MHz. impedance of 50 (the standard in RF
The circuit diagram of this first module Capacitor C8 provides the neces- test equipment). The other output sig-
to be discussed in detail is shown in sary amount of positive feedback in the nal supplied by the NE592 is used to
Figure 2. It comprises three sub-cir- oscillator. An AF signal may be applied drive two sub-circuits. One branch
cuits: VCO, synthesizer and output to the emitter of T4 to effect amplitude goes to the PLL chip via C23 and R33,
buffer. The VCO and the synthesizer modulation (AM). Frequency modula- the other is used to drive a voltage rec-
together from the PLL. tion (FM) is also possible by superim- tifier/doubler, D11-D12 which in turn
posing an AF signal onto the varicap drives amplitude-control opamp IC3a.
VCO and buffers tuning voltage. Although FM will The desired highest output amplitude
The active element in the oscillator is a cause the PLL to drop out of lock, the may be set using preset P1. The author
differential amplifier built around tran- average frequency remains constant used a setting where 0 dBm (decibel-
sistors T1, T2 and T3, whose gain because the time constant of the con-
100n
R39
C34 C39
IC3 = LM358P
18k
9 16 7 5 11 C36
100 10V 100n
1 2 3 IN AMIN A 11V9 H 4V2
SDA 12 1 R40
C SDA VCC 6
SCL 14 OUT 1k B 10V2 I 0V35
B SCL
IC2 8 5V
DLEN 13 FMIN
A DLEN LOCK C 0V J 5V9
SAA1057 TEST
18 LOCK
+5V
17 10
XTAL DCA D 9V5 K 5V1
X1 TR TCA TCB DCS
15 1 2 3 4 E 0V02 L 9V
4MHz C33 R38 C30 C31 C32 C29 C38 C37
F 0V86 M 2V5
3 A1 A2 A3 A4
T1 A1 5V 5V 5V
4 R6
1k
R7
3k3
R5 8x 10k 1
C1
C4
C5 P1
T2 A2
1 16V 10k K1
100n
R8 R9 RES
9 8 7 6 5 4 3 2 100n
1k 3k3
R1
40
T3 A3
LOCK
31 39
R10 R11 EA/VP P0.0
38 RS
1k 3k3 9 P0.1
RESET 37 R/W
P0.2
T4 A4 36 EN
P1.0 1 P0.3
P1.0 35 DB4
R12 R13 P1.1 2 P0.4
P1.1 34 DB5
1k 3k3 P1.2 3 P0.5
P1.2 33 DB6
5V T5 A5 P1.3 4 P0.6
P1.3 32 DB7
P1.4 5 IC1 P0.7
P1.4
R14 R15 P1.5 6
P1.5
5V
1k 3k3 P1.6 7
P1.6 R2 R3 R4
T1 ... T8 = BC557B T6 A6 P1.7 8
P1.7
R29 R28
R16 R17
28 SDA 3k3 1k
1k 3k3 P2.7 C
27 SCL B5 T12
P2.6 B
T7 A7
26 DLEN
P2.5 A
29 PSEN 25 R27 R26
R18 R19 PSEN P2.4 P2.4
30 24 3k3 1k
1k 3k3 ALE ALE/P P2.3
89C51 23 B4 T11
P2.2
T8 A8
P2.1
22 5V
21 R25 R24
R20 R21 P2.0
3k3 1k
1k 3k3
B3 T10
C7 11
TXD 12 DGCLK
10 INT0 R23 R22
RXD 13 DGDIR
2 INT1 3k3 1k
K2
17 RD T0 14
5V V+ 1 T0 T9
1 16 C1+ C9 16 15 B2
WR T1
6
IC2 3 X1 X2
2 OUT C1 T9 ... T12 = BC557B
14 11 TxD 20 19 18
RS1OUT T1IN S4
7
13 12 RxD
3 RS1IN R1OUT X1 5V
IN 8 9
8 RS2IN R2OUT S1
S3 S2 +5V
C6 7 10
4 RS2OUT T2IN
RS232 4 C2 C3 ENCODER
9 C2+ C10 C12 C11
5 15 MAX232
33p 33p
5
C2 100n 220
V- 11.059 MHz 16V
C8 6
C6 ... C10 = 10 / 63V
980053 - 14
IC2
5V
operate, the MAX232 having on-chip
step-up converters for +10 V and
5 LM317T
+5V
10 V.
270
R1 R2
P O W E R S U P P LY B O A R D
22
As you can see from the circuit dia-
5W C8 C9
gram in Figure 5, the power supply for
820
C1 ... C4 = 4x 47n R3
10k
220
63V 33V
1
63V
10 63V on two old faithfuls, the 7805 and the
400mW
LM317 respectively. These ICs and
980053 - 15
Figure 5. Circuit dia- their usual satellite components have
gram of the power been used so many times in our pub-
supply. Three voltages lished circuits that no further descrip-
from one transformer! tion will be necessary.
by the author and burned into the A single mains transformer rated at
internal program memory by the Pub- 15 V, 8VA, supplies all the necessary
lishers. The 89C51 is available ready- alternating voltages. The mains voltage
AT TENUATOR BOARD programmed from the Publishers or at the primary side is applied via a
Figure 3 shows the circuit diagram of a certain kit suppliers advertising in this double-pole switch and a fuse, both
digitally controlled 8-section pi RF magazine. built into a Euro-style appliance socket.
attenuator with a range of 1 dB to The 89C51 accepts information and
79 dB in 1-dB steps. The resistor com- supplies information. Microcontroller NEXT MONTH
binations we need to realize each of freaks call this I/O for input/output. In next months second and conclud-
the 79 discrete attenuation levels are Well, the input devices are a rotary ing instalment we will be discussing
connected into the circuit by means of shaft encoder, S4, which is used for the the construction of the instrument on
relay contacts. The associated relays are frequency setting, a small keyboard, four printed circuit boards. The article
actuated and de-actuated by micro- S1-S2-S3, the SDA line of the I2C bus will be concluded with notes on the
processor drive signals that form 8-bit and (optionally) the RxD line of the operation of the RF Signal Generator,
combinations at the control inputs MAX232 serial interface. The output miscellaneous matters and optional
marked A1-A8. devices to control are the LCD con- extras.
The theoretical values of the resis- nected to port P0, the attenuator on (980053-1)
tors in the attenuator are realized by port P1), the VCO inductors on port
means of parallel combinations of 1% line P2.0 through P2.3 and, of course,
resistors from the E96 series. the synthesizer chip, by way of the
Each relay coil is shunted by a back- DDA and SCL lines (P2.6 and P2.7).
emf suppressor diode and a decou- Actually, the I2C bus is modified into a
pling capacitor. so-called CBUS by the addition of P2.5
(DLEN) and its pull-up resistor, R2.
MICROCONTROLLER The 89C51 is clocked at
BOARD 11.0592 MHz by an external quartz
All the intelligence we need to imple- crystal, X1. This frequency was chosen
ment a man/machine interface, i.e., because it allows standard baud rates
establish communication between the to be used on the serial interface.
user on the one hand, and the PLL and A classic power-on reset network,
the attenuator on the other, is packed R1-C1, completes the microcontroller
in a microcontroller type 89C51. This circuit.
controller executes a program written This board requires only +5 V to
versatile control
system PLC87(A)
part 2: command list (CL)
programming
The PLC87(A) is programmed using Simatic compatible command lists
(CLs). A CL consists of a sequence of logic combinations and/or instruc-
tions for the PLC to execute. In this second and last instalment we look
at the way command lists are written, and also explain the operation of
some of the more important instructions.
The ports of the microcontroller on the PLC87(A) board are THE COMMANDS
divided in inputs and outputs which form the links between The commands sent to the PLC87(A) by the PC may be
the PLC and the real world. The CL program, which is divided into a number of groups. The Datasheets in this mag-
stored in an EEPROM, interrogates these inputs, and azine list the English versions of the commands, together
arranges for outputs to be set (actuated). Additionally, the with their parameters, if applicable, and short descriptions.
PLC87(A) is capable of using flags (markers), software timers, The Datasheets may be used as Quick Reference Cards for the
flashers and counters. When the PLC is initialised or stopped, PLC87(A) system.
all outputs, flags, etc., are reset to zero.
A CL line consists of an operator and a parameter, or a Bit combinations
command and a variable. Comment may be appended, or a are the result of combining two bit-parameters.
jump label may appear ahead of operators or commands.
After the program start, the CL interpreter, which is stored in A z x.y AND
the controller ROM, first reads the inputs, and stores a copy AN z x.y AND NOT (NAND)
of the bit-image in a register (PAE). Next, the interpreter starts O z x.y OR
to execute the CL from the top line down to the bottom. ON z x.y OR NOT (NOR)
While the processor executes the CL, it does not read the
inputs, but their bit image. Likewise, the output states are first The BCR (bit combination result) is the result of these logic
copied into a register (PAA), and not written into the respec- operations. Valid parameters in position z are I, Q, F, T, C and
tive ports until the PE command (program end) is encoun- (, while x represents the number of the byte, and y the num-
tered in the CL. ber of the bit.
The CL interpreter reads a program line and executes it
immediately. The results of the various logic combinations Allocations
and the instructions are copied to internal registers (BCR, These are used to allocate a certain bit parameter to the BCR.
ACCU1, ACCU2, PAE, PAA), and may be called up for pro-
cessing later. When the PE command is encountered, the S z x.y set when BCR =1
interpreter returns to the start of the CL. This results in a R z x.y reset when BCR = 1
delayed response to events (cycle time). Although the values = z x.y equals (equals BCR)
of inputs and outputs are updated during every cycle, their
status is not modified. Valid parameters are Q, F and C, while x represents the num-
ber of the byte, and y the number of the bit.
Timer functions
The timers T n (0-15) count down a previously loaded value.
Various options are available. If the value becomes 0, interro-
Design by R. Geugelin gating the BCR will produce a 1. Before the start command,
:L KB 160 :JU
:<B END
:S A 0.0 :GOON
: :PRT OVEN OKAY else, display this text
:L FB 1 when temp. > 130C, switch off heater :END
:L KB 180 :PE
:>B
:R Q 0.0 Further programming examples may be found in the subdi-
: rectory PLC87\EXAMPLE on the project diskette, order num-
POS 64 cursor in 2nd display line ber 986026-1.
: (989966-2)
Smartcard-operated
code lock
give expired Smartcards a second life
5k6
5k6
3k9
14 symbol e = B2
1N4148 symbol r = B3
4 6 100n
MCLR RB0
16 7 T1
symbol BLINK = B4
OSC1 RB1 R2
15 IC2 8 symbol h = B5
OSC2 RB2 3k9
17
RA0 RB3
9
BC547
DIRS = %11100110
18
PIC16 RB4
RA1
10 PINS = %00000010
1 F84 RB5 11 high 7
RA2
2 12
RA3 RB6 high 6
3 13
RA4 RB7 low 6
D3
low 7
5
JP2 R9 JP1 R1 high 6
C5
low 6
1k
5k6
27p 1/2 LEARN high 5
if PIN3 = 0 then learn
if PIN3 = 1 then check
V+ 5V learn:
IC1
*
RFU
RST
CLK
for f = 0 to 31
I/O
D1 R10 T2 R11 78L05
22 22
R7 K3 9 7 5 3 1
e = 0
K1 1N4001
BC557 for g = 0 to 7
47
C1 C3 C4 e = e * 2
+
R8 10 8 6 4 2 e = e + PIN4
0 47 10 10
high 6
10k
220n
low 6
next g
h = 32 * PIN0
h = h + f
write h,e
* see text
GND'
RST'
RFU'
CLK'
RFU'
+5V'
+5V'
I/O'
next f
8 7 6 5 1 2 3 4 K4 * siehe Text PINS = 0
GND'
+5V'
+5V'
I/O'
K5 10 8 6 4 2
* voir texte BLINK = 50
* zie tekst goto led
CHIPCARD check:
9 7 5 3 1 for f = 0 to 31
e = 0
RST'
RFU'
CLK'
4 3 2 1 5 6 7 8 18 17
for g = 0 to 7
RST'
RFU'
CLK'
+5V'
GND'
+5V'
I/O'
RFU'
e = e * 2
980061-11 e = e + PIN4
high 6
low 6
Figure 1. The circuit of the electronic next g
code lock consists essentially of a PIC read f,r
find out, these 256-bit microcontroller, a Smartcard reader and if e <> r then other
cards are not really a handful of other components. goto cont
blank, though, because other:
they contain a lot h = f + 32
number in the memory are reserved 64 bytes. read h,r
for the first 96 bits. The next 160 bits This non-volatile memory is capa- if e <> r then error
are, however, at logic 0, and may be ble of recording two card images of cont:
freely changed to logic 1s. 256 bits each. These images may qui- next f
Depending on the application(s) etly remain in the PIC EEPROM for PINS = %00000110
you have in mind, the electronic lock more than ten years, or be modified as goto forever
will either recognize one or two cards many times as you like. error:
that can not be forged, or, by contrast, Because the circuit does not con- PINS = 0
any number of identical cards that may, sume any significant current unless a BLINK = 255
under certain conditions, be duplicated. card is inserted into the connector, it goto led
may operate from a simple 9-volt bat- led:
A PIC16C84 tery, although there is, of course, no for f = 0 to 10
PROGRAMMED IN objection against powering it from a high 1
BASIC! mains adaptor or a rechargeable bat- pause BLINK
The simplicity of the circuit diagram tery (for example, that of an alarm sys- low 1
shown in Figure 1 may come as a sur- tem). pause BLINK
prise given the relative complexity of Whatever power source is used, a next f
the functions it is designed to carry type 78L05 voltage regulator is used to forever:
out. supply the PIC with its 5-volt supply goto forever
Actually, that is because the micro-
controller used, a PIC16C84, contains
almost everything we need; to begin Figure 2. Listing of the program, before compilation, to be stored in the PIC.
with, a data EEPROM with a size of
1-160089
980061-1 ROTKELE )C(
3
G1
G6
G2 G7
K1
D1
RE1
D2
+
C1
0 T1
C5
C2 K5
R2
C3
IC2
JP2 1/2 R1
K2
R3 R5
K4
R9 D3 C6 IC1
R4 C4
JP1 learn R7 R6
K3 R8 R11
X
X
R10
X
X
G3
G8
G4 G5
T2
X
X
980061-1
(C) ELEKTOR
PRACTICAL whose ISO and AFNOR contacts may switched on and off by the relay con-
REALISATION be wired in parallel if you want the sys- tact (K2). This contact is only closed
If you construct an electronic code tem to be able to process both card when the right card is detected in the
lock, based on whatever circuit princi- types (the AFNOR pin arrangement is card reader.
ples, you should observe a minimum now obsolete even in France). The LED has to be mounted so that
number of elementary security mea- (Dotted) components R8/T2 are pro- it is only visible when the system is
sures. vided to allow card connectors with being set up, because its very function
It would have been (too) easy to either a normally-open (NO) or nor- is to inform you of the correct execu-
throw all components that make up mally-closed (NC) contact to be used. tion of each of the steps in the process.
the circuit on the same board as the In the first case, you do not fit Two jumpers, finally, allow you to
inevitable chipcard connector, and pre- R8/T2, and install a short wire linking select between the two available
scribe the use of SMA (surface-mount the base and collector pads reserved modes of operation: learn or normal
assembly) components to keep the size for this transistor. This link is shown as use (1 / 2). It is not necessary or even
of the board within reason. a dotted line. If, on the other hand, you desirable (for obvious reasons) to pro-
We know several examples of pro- have an NC-style connector available, vide access to these jumpers for any
fessional equipment from reputable you have to install these two parts, and purpose other than the process of
manufacturers, having the above-men- no wire link. teaching the system to recognize new
tioned deplorable and over-simplistic As illustrated in Figure 3, a 10-way cards.
construction. flatcable is used to connect the card The programmed PIC for this pro-
In a number of cases, it was suffi- reader to the circuit. This cable is fitted ject is available through our Readers
cient to remove just two screws to get with an IDC (insulation displacement Services under order code 986511-1. It
access to two wires which, when short- connector) socket to be plugged on to should not be installed in its socket
circuited, open the locks the 10-way pinheader on the PCB. before you have checked your con-
The printed circuit board of which Considering the (purposely- struction and verified the presence of
the design (artwork) is shown in Fig- reduced) speed of the signals the correct voltages at several points in
ure 3 has been designed to facilitate fit- exchanged with the Smartcard the circuit.
ting the electronics in a safe place, that (approx. 500 Hz), cable lengths of up to
is, inside a building or room to be pro- 50 cm may be used without problems. PRACTICAL USE
tected (for example, on the inside of a A robust 4-way PCB mount termi- Easy to build, the electronic code lock
door). nal block allows the dc power supply is even easier to use.
The only part which is accessible (9 to 15 volts) to be connected to the As a matter of course, you should
from the outside is the card connector, board (K1), as well as the load to be start by teaching the PIC to recognize
a certain Smartcard. To do so, install JP1 cards sold in France by BP or Mobil 0011 0000 0011 1111 1111 1111 1111 1111
to select LEARN mode. That effectively petrol stations. Once expired these 1100 0000 0000 0000 0000 0000 0000 0000
pulls the RB3 port line of the PIC (pin 9) cards are thrown away by the tens of 0000 0000 1010 0000 0000 0000 0000 0000
to ground. Next, insert the Smartcard or thousands by their users. 0000 0000 0101 0000 0000 0000 0000 0000
payphone card into the reader. A Smartcard worth 24 units (cred- 0000 0000 0000 0000 0000 0000 0000 0000
The LED should light up, indicating its), all used up, contains the following
that the circuit is being powered. After 256 bits:
about one second the LED should start WARNING: Switch the Vpp off!
to flash rapidly. This eye-winking 1000 1000 1000 0000 0010 0000 0000 0010
indicates that the card image (elec- 0011 1100 0111 0101 1000 0010 0010 0100 For the other authorized cards you fol-
tronic contents) has been transferred to 1010 0001 0000 0000 0000 0000 0000 0001 low exactly the same procedure, and
EEPROM, and that it remains there 0000 0000 0011 1111 1111 1111 1111 1111 you use on of these cards to teach the
until another card is inserted, even if 1100 0000 0000 0000 0000 0000 0000 0000 electronic lock the code by which the
you turn off the power supply and 0000 0000 0000 0000 0000 0000 0000 0000 door is opened.
leave it off for months. 0000 0000 0000 0000 0000 0000 0000 0000 The same procedure may be
Having supplied this signal, the 0000 0000 0000 0000 0000 0000 0000 0000 applied with blank (new) cards, pro-
LED indicator goes out, and you can vided they are of the GPM256 type or
safely withdraw the card, which from In the first three lines we find the name similar (256 bits of EEPROM) ask
then on is promoted to master key. of the card manufacturer, which can your supplier.
Now remove the LEARN jumper not be modified. The name string is Whether the card is new or expired,
and insert your Smartcard again. The identical on all 24-unit cards issued up only the first 96 bits have already been
LED indicator should light, and the to now, but different from the one on personalised (by the manufacturer),
relay should be energised the next sec- 12-unit cards, which, fortunately, are the remaining 160 being at 0 and freely
ond or so. It remains energised and the equally easy to obtain (in France). programmable by yourself.
LED remains on, as long as the card is Next come 10 bits all reading 0, fol- Here is an example of what may be
in the connector. lowed by 24 1s (these are the used-up found on a card picked from an actual
Remove the card and try another. credit units), and then 126 0s which batch:
Unless this one has exactly the same are not used by the application.
contents as the master key, the LED If you make the mistake of teach- 0000 0000 1000 0000 0000 0000 0000 0000
should flash slowly, and then go out. ing the electronic lock to recognize 0100 1011 0000 0000 0000 0000 0000 0000
Of course, the relay should not be such a card, then the door can be 1111 1111 1111 0000 0000 1111 1111 1111
energised! opened by anyone having an expired 0000 0000 0000 0000 0000 0000 0000 0000
The above process may be repeated car-wash card originally worth 0000 0000 0000 0000 0000 0000 0000 0000
after changing the jumper in position 24 credit units! 0000 0000 0000 0000 0000 0000 0000 0000
1 / 2, which enables the electronic lock The obvious thing to do is of course 0000 0000 0000 0000 0000 0000 0000 0000
to be taught to recognize a second to personalise the card and so limit 0000 0000 0000 0000 0000 0000 0000 0000
card. the number of authorized cards in
In case you want the lock to recog- accordance with the number of people The buyer of a batch of these cards is
nize just one card, you have to present (card users) who are authorized to totally free to employ ELEKT1G to
it to the system for both positions of open the lock. Cards may be person- write logic 1s into any location(s) in
the 1 / 2 jumper. This is done to avoid alised quite easily using the software the last five lines, as illustrated below:
the system security being weakened by utility ELEKT1G and the associated
leaving one half of the EEPROM in an Smartcard Reader/Writer, both as 0000 0000 1000 0000 0000 0000 0000 0000
undefined state. described in the September 1997 issue 0100 1011 0000 0000 0000 0000 0000 0000
of Elektor Electronics. 1111 1111 1111 0000 0000 1111 1111 1111
ENCODE YOUR OWN The following example goes to show 1111 1111 0000 0000 0000 0000 0000 0001
CARD SERIES how to change any number of the 136 0000 0000 0000 0000 0000 0000 0000 0000
Although the ability of the system to 0s on the card into logic 1, simply by 0000 0000 0000 1100 0011 0000 0000 0000
recognize two different Smartcards will pressing the + key on the PC key- 1000 0000 0000 0000 0000 0000 0000 0000
be sufficient for many applications, board when the cursor is on top of the 0000 0000 0000 0000 0000 0000 1110 0010
there will be cases in which many desired bit, after the card data have
more users need to be authorized to been read. WARNING: Switch the Vpp off!
open one and the same door or lock
(as, for instance, in a laboratory with Space bar: read next bit Of course, you have to be aware of the
controlled access, a club or a block of (auto-repeat) fact that such a card may be copied,
apartments). + key: write 1 but only on to a card with the same 96-
You then turn to cards whose con- (at current location) bit manufacturer-ID, which means that
tents was originally the same, within ESCape key: quit it has to be from the same batch bought
the same series, and you complete the from the same manufacturer. That seri-
encoding by a couple of freely chosen 1000 1000 1000 0000 0010 0000 0000 0010 ously limits the possibilities of cards
bits. 0011 1100 0111 0101 1000 0010 0010 0100 being forged!
As an example, lets use car-wash 1010 0001 0000 0000 0000 0000 0000 0001 (980061-1)
PC control for
MiniDisc player
beam up track titles from your PC
Specifications
For use with Sony MD decks types MDS-JE500 and later
Transmitter range: several metres
Up to 99 track titles
Up to 2032 characters per MD
Suitable for any PC with a free RS232 port
Standard 9-pin RS232 connection
No special software required
May be combined with a track-title database
Energy-saving design
Powered by one 9-V battery
MiniDisc (MD) audio systems are sold have made it to general recognition
by the hundreds of thousands every and commercial success after a number
year in various countries in which this of years. Not surprisingly, several read-
Elektor Electronics is published. After a ers (mostly proud owners of MD
Design by P. Glatzel slow start, the MD system appears to decks) wrote to us with the request to
give some attention to the MiniDisc PC with the power of a small micro- port from TTL to RS232 levels, and the
system. One frequently heard short- controller. This has become possible other way around. The electrolytic
coming of the MD system, we learned, ever since Sony, from their model capacitors around IC4 help the internal
is that entering a track title list is cum- MDS-JE500, started to incorporate soft- circuits in the MAX232 to adapt the
bersome. Although every MiniDisc ware in their MD decks that allows various voltage levels. In this way, the
has sufficient capacity for 256 tracks texts to be read by an infra-red receiver internal charge pump enables a sym-
representing a total of 1,700 text char- and then copied on to a MiniDisc. The metrical voltage to be derived from a
acters, the process of actually entering PC control for MiniDisk players dis- direct voltage of +5 V.
the texts you want is very user cussed in this article forms the link Although the circuit only uses the
unfriendly: lots of cursor and letter between a text file (document) written TxD, RxD and CTS signals on the
keys have to be pressed on the com- on your PC, and the infra-red eye on RS232 port, these are sufficient for reli-
pact remote control before any mean- the MD player. The system allows any able data exchange between the MD
ingful text appears on the display. This PC to beam up to 99 track titles to the control and the PC. The three logic sig-
text function is of special interest to MD deck, which writes them to a nals appear at TTL level on three pins
music collectors. Tracks on old records MiniDisc. If you are not sure if a par- of the microcontroller (P3.0, P3.1 and
(LPs), for example, can be efficiently ticular MD deck will be compatible P3.2) type AT89C2051 from Atmel.
filed together with the name of the with the present circuit, ask the sup- The controller is an 8-bit machine
album, the release number, name of plier if it is suitable for use with the whose instruction set is compatible
the artist(s), etc. In most cases, the advanced MD Title Generator sup- with Intels MCS-51 instruction set. It
available space of 1,700 characters will plied by Sony. If it is, then the present has 128 bytes of RAM and 2 Kbytes of
be more than sufficient. A fine system, circuit can be used also. Flash memory.
really, if only the process of entering The circuit around the controller
texts was a little less awkward. THE CIRCUIT IN includes a standard crystal oscillator
In this day and age, with he prolif- DETAIL operating at 11.0592 MHz.
eration of PCs, it must be possible to The circuit diagram of the MD control is The line marked ACTIVE (P3.5)
simplify the process of conveying a shown in Figure 1. The input is formed plays an important role because it is
track title to a MiniDisc deck, and, by connector K1, a 9-way serial port. used to implement software control of
from there on, to the little disc itself. The output is formed by an infra-red the power supply. You actuate the cir-
The designer of the present circuit sender diode, D3. IC4, a cuit by pressing switch
fully agrees with this opinion, and set MAX232, converts the Figure 1. Circuit dia- S1. The base of transis-
out to combine the functionality of a signals on the serial gram of the MD title tor T2 is then pulled to
generator: simplicity
is trumps!
1 D2
1N4001
5V
D4
5V
D1 T2 IC1
1N4148 BC638
D5 D6
1N4001 78L05
R17 UIN
10k
R13 R15
C11 C12
33k
330k
51k
680
R22 R16
20 C1 C2 C3 C4
2k2
22k
R23
IC2
4k7
1 19
13 5V
T3 S1
7 R24
9 ACTIVE
8 AT89C2051 4k7
R3 R4
C15
BC
100k
10k
10k
2 17 R1
547
3 16 100n
8
6 18
1
X X A0
5 IC3 2
10 4 X1 5 SDA A1
6 3
R14 R2 SCL A0
24C16
22k
47k
C13 C14 7
WC
22p 22p 4
11.0592 MHz
C7
5V
5V
2 R6 R8
V+
3k3
10
1 16
C8 C1+
K1
3 IC4 1
C1
11 14 6 R5 R7
T1IN T1OUT R19
680
33
10 7 2
T2IN T2OUT 1k8
12 13 7
R1OUT R1IN R20
9 8 3 T1
R2OUT R2IN 1k8
4 C5 C6 8
C9 C2+ 1k8
C17 C18 C19 4
MAX232 R18 C16
5 15 100n 9 D3
C2 BC638
V- 470p 470p 470p
5 100
6 25V
C10
980092 - 11
C6 ... C10 = 10 / 63V
C8 R2
R21
R11
R12
R3
R4
R5
R6
R8
R7
C13 D3
IC4
T1
9V T2 C9
IC2
C19
C1
C10 C14
IC3
X1
R17
R18
R20
R19
980092-1 D4
C2 C15 C17 C18
K1
IC1
D2
R22
R23
R24
R16
R15
R13
R14
R1
C3 S1
C4 T3
ground via resistor R22, whereupon Incidentally, the circuit will only Via its input pins 12 and 13, the
the power supply is activated. The respond to this command if no com- microcontroller continuously monitors
microcontroller then receives its sup- munication activity is detected on the the levels of the stabilised and non-sta-
ply voltage, and is initialised. Upon RS232 port. bilised voltages. Actually, the voltages
detecting that the ON line is active, the Although it may appear rather com- at these pins are scaled-down versions
controller pulls the ACTIVE line logic plex at first blush, the power supply is of the full supply levels.
high, causing transistor T3 to be of a straightforward design. Transistor Two of the microcontrollers output
switched on. As a result, the power T2 is the actual on/off switch which lines are used to control LEDs D5 and
supply remains switched on even if conveys the applied direct voltage to D6. As soon as an output drops low,
you release S1. If the circuit has been IC1, at the command of S1 or T3. The the associated LED lights up. Further,
inactive for some time, the microcon- output of IC1 supplies a stable direct two port lines are in use to implement
troller makes the ACTIVE line low voltage of 5 V. Diode D1 protects the the communication with the EEPROM.
again and so causes the whole circuit circuit against accidental supply rever- Both lines (pins 16 and 17) simulate an
to be switched off. In this way, the bat- sals. Although a 9-V battery is the pre- I2C bus, and are connected to the +5-
tery life is considerably extended. ferred power source, the circuit may V rail via a pull-up resistor. The EEP-
There is another benefit, namely that also be powered by an inexpensive ROM, a type 24C16, is used to buffer
you can switch off the circuit by hold- mains adaptor having an output volt- the text which is eventually stored on
ing S1 depressed for about 2 seconds. age between 9 V and 12 V. the MiniDisc. After all, the whole point
RFID systems
using smart cards
CARD ICS
The heart of a contactless smartcard is a
card IC. This single chip stores the data
to be transmitted and ensures their
secure transfer. The IC is usually
mounted together with the capacitor
for the resonant circuit on a small
wafer as shown in Figure 3. All this
Transceiver Transponder
6
Data to be sent
to transponder Modulator
Antenna Coil 1
Oscillator Drivers
V 4050
Data Filter
& Demodulator Coil 2
Decoder
Gain
Data received
from transponder
Signal on
Signal on transponder coil
transceiver coil
Signal on
transceiver coil
Signal on
transponder coil
RF carrier Data
RF carrier Data 980099 - 13
MISCELLANEOUS
Information from the following man-
ufacturers was used in the prepara-
tion of this article.
Philips/Mikron (The Netherlands)
Melexis UK (United Kingdom)
Siemens (Germany)
Temic (Telefunken Microelectronics)
Figure 8. Multimode RFID readers may be housed in (Germany)
disk-shaped or rod-shaped plastic enclosures. These Texas Instruments (USA)
units are particularly suitable for use in car immobi- EM Microelectronic-Marin (Switzer-
lizer systems, as animal ID, in asset tracking, in elec- land)
tronic keys, and many more.
Philips, in association with Mikron, has
a range of RFID products under the
name Mifare. This range includes
readers for use at 13.56 MHz with an
cases dominate in the small units, RFID readers come in the shape of operating range of about 10 cm. The
whereas the more robust types use cards, disks, pills, or rods. Pill-shaped company also produces Hitag units for
metal carrier plates. Units for use in units are particularly suitable for iden- operation in the 125 kHz band with an
damp conditions or in chemical plants tification of pallets, containers, and operating range of up to one metre.
are hermetically enclosed in glass motor vehicles, while small rod-shaped Telefunken Microelectronics offers
cases. Some are very small (2 mm ones are used for integrating into car a range of RFID readers in the
diameter and 12 mm long) and there- keys. Small units (glass or plastic) used 100400 kHz range. These units are
fore suitable for implanting into farm for animal implantation, called animal- inexpensive and particularly intended
animals or domestic pets for recogni- IDs are designed and produced to a for large-quantity production. The
tion purposes. Implanting is carried by standard ISO protocol: ISO 11784/85. range includes a read-only version that
(virtually painless) injection under the RFID systems and components are has a 128-bit PROM and can be used in
skin with the aid of a special veterinary available from a number of manufac- the 100400 kHz range at temperatures
gun. turers as listed below. It should be from 40 C to +125 C. The write unit
is intended for use in the 100150 kHz
band.
Texas Instruments has a family of
RFID readers, named TIRIS, that
Figure 9. Evaluation and demonstration kits of RFID ranges from contactless 64-bit chip-
systems are available from several manufacturers. cards to heavy-duty units for use in
Those shown are from Philips/Mikron. goods vehicles and containers. All units
operate on the same frequency of
134.2 kHz, and use frequency-shift key-
ing (FSK). Many units in the range can
operate at distances of up to two
9 metres, which necessitates the use of
large frame antennas for the reader
and ferrite rod antennas for the trans-
mitter/receiver. The largest unit in the
TIRIS range is housed in a glass tube
31 cm long and 4 cm in diameter.
H = n i = n v/ L [Eq. 1]
where v is the alternating voltage across the coil, L is the self-inductance of the coil, and is the angular frequency, that is, 2f.
The self-inductance of the coil is directly proportional to the square of the number of turns:
L = Lo n 2, [Eq. 2]
H = v/ Lo n [Eq. 3]
Equation 3 shows that a reduction of the number of turns increases the fieldstrength (and simplifies winding the coil).
Practical values for a 120 kHz resonant circuit (antenna) are 0.025 F for the capacitor and 70 H for the inductor. Such an (air-
cored) inductor would consist of 30 turns with a diameter of about 30 mm.
TERMS USED IN combining the two channel outputs. Responser. The receiver in an RFID
Manchester code. This is a bi-phase format reader that accepts and interprets the
RFID SYSTEMS in which each bit in the original signal is signals from the interrogating transmit-
represented by two bits in the derived ter-receiver.
format. The basic rule for the transform
Anticollision
is that 0 is represented by 01 and 1 by 10. Selective addressable multipage transponder
A facility to enable the system to recog-
This ensures that there are never more (SAMPT). A transponder similar to an
nize the correct RFID units when a num-
than two identical bits in series. MPT but whose first page holds a 24-bit
ber of these units are within the operat-
address data field, which can be pro-
ing range.
Multifunctionality. This term pertains to a grammed by the user to enable one of a
card that can be used for several differ- group of transponders to be accessed
Delta modulation (DM). In delta modula-
ent purposes; for instance, a bank card
tion, the level of the sampled analogue
combined with a credit card Smart card. A plastic credit card sized
signal is coded by one bit, positive or
device in which some simple computing
negative, based upon whether a signal
Multipage transponder (MPT). A trans- facilities are embedded. The card con-
sample is greater or smaller than the pre-
ponder whose memory is organized in tains typically a purpose-developed 8-bit
vious value. Because only one bit per
several pages, for instance, 1360 bits in 17 microprocessor accompanied by up to
sample needs to be transmitted, the sam-
pages each holding 80 bits. 20 kbytes of ROM to carry the applica-
pling rate can be increased significantly
tion program, 4 kbytes of EPROM that
to reduce the quantization noise, sim-
Multiple security (access). Access control to provides non-volatile memory of the
plify the anti-aliasing filter, and reduce
a communications system according to card user status, 512 bytes of RAM to
the bandwidth required for transmis-
the security status of the user, and the hold the data associated with the calcu-
sion.
degree of classification of the facility lation for a single transaction, and regis-
required. ters that may be 512 bits long. There are
Delta-sigma modulation (DSM). Delta
currently two types of this card: one
modulation systems cannot handle sig-
Phase shift keying. Only coherent decod- with contact pads along one edge sur-
nals with a d.c. component and have a
ing can recover the data from such a face, and the other that is accessed via
signal-to-noise ratio that is sampling
modulated signal. It is, therefore, pre- radio-frequency signals. The latter was
and modulation frequency dependent.
filtered to narrow the detection band- developed for use in the GSM mobile
Both of these disadvantages are over-
width and minimize the noise before telephone service in which the user has
come by using the delta-sigma tech-
being input to a product detector stage. to input a personal identity number
nique, which employs an integrator cir-
Low-pass filtering is used to recover the (PIN), and if this is accepted, the user
cuit at the input to the modulator. The
data stream from the unwanted har- can proceed to the next stage.
amplitude of the output pulses then con-
monic components of the carrier fre-
veys information about the signal ampli-
quency. Tag. A device attached to an item to be
tude and not just its variation.
tracked. There are two basic concepts:
Read only. An RFID device whose pro- active and passive. An active tag is pow-
Frequency shift keying. Non-coherent
grammed information cannot be modi- ered by a long-life battery, whereas a
demodulation produces two channels in
fied. passive device is signal-powered. An
the decoder, each processing the 0 and 1
RFID reader may be used as a tag.
frequency respectively. Envelope detec-
Read/write (R/W). An RFID device whose
tion in each channel then produces a
programmed information may be Transponder. (1) The name given in satel-
pulse to coincide with the transmission
altered by the user. lite communications to what is called a
of each 0 or 1. The output bit stream is
relay or repeater system in terrestrial
finally produced by combining the two
Responder. That part of an RFID reader communications. (2) In radar engineer-
channel outputs. The coherent technique
that automatically transmits a reply to ing a form of transmitter-receiver that
uses two product detectors, one for each
the interrogating transmitter-receiver. automatically transmits signals when the
channel or bit carrier frequency. The
correct interrogation is received.
decoded data stream is obtained again by
barometer/altimeter
Part 1 meter with many facilities
It is just about ten
years ago that this
magazine published
the design of a barom-
eter/altimeter. In these
ten years electronics
technology has pro-
gressed to develop-
ments that were
unimaginable then. The
present barometer/
altimeter is based on
a precision air-
pressure sen-
sor with inte-
gral signal
processor
from Motorola.
Evaluation,
storing, display
and interchange
of data are
effected by a micro-
controller system.
Features:
7 Barometer function
7 Altimeter (absolute or relative height measurement)
7 Height measurement from 2000 m to +10 000 m
7 Relative height measurement referred to arbitrarily chosen height
7 1 or 2 point calibration
7 EEPROM data logger for 1000 samples
7 Log interval from 10 seconds to 8 hours
7 Log data retrievable sample by sample from the computer
Design by H. Bonekamp
Sensor Die
A distinction must be made (Cross-Section) Sealed Vacuum
between relative height and absolute Behind Diaphragm
height. A relative height, hr, is referred Constraint
to an arbitrarily chosen height, ho: Wafer
p 980097 - 15a
p
h = h h o
r p p
[Eq. 2]
s s SILICONE GEL ABSOLUTE
DIE COAT
STAINLESS STEEL
DIE METAL COVER
P1
THERMPLASTIC
where hr is the relative height, po is the WIRE BOND EPOXY
atmospheric pressure at ho, and the CASE
other parameters are as in Eq. 1.
Measuring relative height can only
be done accurately when the atmos-
pheric pressure at the reference height LEAD FRAME DIE
BOND
is virtually constant. ABSOLUTE ELEMENT
P2 980097 - 15b
5V 5V 5V
5 5VA 5V JP1
C7
C13
R6 1 8x 10k
100n
10
10V 44 2 3 4 5 6 7 8 9
C18 C12
D0
D1
D2
D3
D4
D5
D6
D7
R5
100n 100n
35 32
EA/VP PSEN
10k
5VA 6 15 C8
10 43 D0
RESET P0.0 10
A D 42 D1
R3 P0.1
9
REF+
5 2
P1.0 P0.2
41 D2 5V
25k5 RESET 10V
10 1 3
IC3 40 D3 K1
1% REF IC2 SCLK P1.1 P0.3
C17 14 4 39 D4 1 2
DIN P1.2 P0.4
7 13 5 38 D5 UO 3 4 RS
AIN+ DOUT P1.3 P0.5
100n
IC1 2 8 12 6 37 D6 R/W 5 6 E
AIN DRDY P1.4 P0.6
4 7 36 D7 D0 7 8 D1
AD7715 CS P1.5 P0.7
MPX
R1 AN-5 8
P1.6
D2 9 10 D3
4 11 A D 16
25k5 9 24 RS D4 11 12 D5
CLK P1.7 P2.0
S4100A 1% IN OUT AT89S53 P2.1 25 R/W D6 13 14 D7
2 X1 3 14 INT0 -12JC 26 E 15 16 SW1
R2 R4 P2.2
3 C1 C2 15 INT1 27 SW1 SW2 17 18 SW3
P2.3
25k5
25k5
10k
6 9
BT1
K4 C9 C11 C16
9V P1
100 10 10
15
16
17
18
19
20
D3 4k7 L2
S2 S3 S4 S5 S6
1N4001 C10 4H7
10 10V
U
980097 - 11
Resistors:
K4 R1R4 = 25.5 k, 1%
S1 + BT1 - R5, R7 = 10 k
K3 C10 C14 R5 980097-1
R6 - resistor array 810 k
H2
JP1
R3
H3
D2 P1 = preset 4.7 k
R4
D1
IC4 C7
D3 C2
K2 C11 C12 C18 Capacitors:
C9 IC6 C1, C2 = 0.47 F, MKT (metallized
JP2 X2
IC2 polyester)
R X1 C3C6 = 22 pF, ceramic
C13
C1 C7, C8, C11, C16 = 10 F, 10 V, radial
C6 IC3
C9 = 100 F, 16 V, radial
IC5
I C4 R2
R1 C10 = 10 F, 16 V, radial
C3 IC1
C15
R6
1-790089 Inductors:
ROTKELE )C(
K1
C17
L1, L2 = 4.7 H choke
C8
H4
R7
L1
H1
Semiconductors:
P1 L2 C16 D1, D3 = 1N4001
D2 = BAT85
Integrated circuits:
IC1 = MPXS4100A (Motorola)
IC2 = AD7715AN5 (Analog Devices)
(C) ELEKTOR
980097-1 IC3 = AT89S53-12JC (Atmel)
IC4 = AT24C16 (Atmel)
IC5 = ADM233L (MAX233) (Analog
Devices)
IC6 = LP2950CZ5.0
Miscellaneous:
X1 = quartz crystal 2.4576 MHz
X2 = Quartz crystal 11.0592 MHz
JP1 = 2-terminal 2.54 mm pin strip
and pin jumper (Maplin)
JP2 = 3-terminal 2.54 mm pin strip
and pin jumper (Maplin)
JP2 = 3-terminal 2.54 mm pin strip
and pin jumper
K1 = 210 pin box header
K2 = 9-pin female sub-D connector
K3 = low-voltage socket for board
mounting
K4 = 6-way header for board mount-
ing with mating part for cable fitting
BT1 = 9 V rechargeable battery with
connecting clip
S1 = switch, single on contact
S2S6 = push-button switch
D6-R-RD with cover D6Q-RD-CAP
(ITC)
Enclosure Bopla E435
(1206565 mm) (available from
Phoenix 01296 398355)
Liquid-crystal display 216 digits
5 cm of 20-core flatcable
1 flatcable connector
Socket for IC3
PCB Order no. 980097*
Software Order no. 986031*
* See Readers Services towards the
end of this issue.
Figure 6. Double-sided
printed-circuit board for
the barometer/altimeter.
CONSTRUCTION
Before any construction work is
started, the double-sided printed-cir-
cuit board in Figure 6 must be cut into
two. The smaller portion houses five
push-button switches and connector
K4. When these have been put into
place, fix it to the cover of the enclosure
after this has been prepared according
to the front panel layout in Figure 7.
Owing to the narrowness of the
tracks and the dense population of the
larger portion, it is imperative to use a
Figure 7. Completed proto- small soldering iron and to take even
type printed-circuit board. greater care than usual to avoid solder
splashes on the board. It hardly needs
saying that great care must be taken
Figure 8. Suggested front also to ensure correct positioning of all
panel layout for the barom- components, especially polarized ones.
eter/altimeter. When the board has been com-
pleted (it should look more or less as
the prototype shown in Figure 8), fit it
into the enclosure, and close this with
the cover prepared as described earlier.
In next months Part 2, the pro-
gramming, calibration, software and
operation will be described.
[980097]
ON
POWER
OFF
ENTER
ESCAPE
980097-F
Features
Microprocessor-controlled signal conditioning for bridge-type sensors
Suitable for low-cost sensors: reduction of non-linearity by programmable ROM available.
coefficients The output may be used as
required in the voltage mode (411 V),
External or internal temperature sensor for compensating temperature errors
or current loop (420 mA). Since the IC
64 byte RAM, 4 kbyte program space (ROM) available has an internal voltage regulator, the
488 bit for calibration data available (EEPROM) supply voltage may range from 4 V to
Versatile output signal ranges: 4 V, , 11 V or 420 mA loop 35 V.
Mass calibration easy with 2400 or 9600 baud UART The MLX90308 also contains a com-
Power supply from 5 V to 35 V plete oscillator, a power-on reset facil-
ity, a watch dog, and a UART(2400 or
9600 baud).
DESCRIPTION The interface is housed in a 16-pin
The most noteworthy property of the DIL case. The internal block diagram
MLX90308 sensor interface is the inte- and pinout are shown in Figure 1.
grated controller. This enables the
device to be used for a very wide MODES OF OPERATION
range of applications. The non-linear There are two major modes of opera-
operation of many bridge-type sensors tion: the digital mode and the analogue
can be largely reduced, eliminated or mode.
corrected simply by programmable In the analogue mode, the output
A Melexis Application coefficients. of the pressure sensor bridge is ampli-
Temperature errors can be com- fied via IA and GN and then converted
pensated with the aid of an internal or to the correct output signal form in one
Melexis UK external sensor. of the output stages.
3 Anglesey Close The program memory consists of The sensitivity and offset of the
Chasetown
Staffordshire WS7 8XA 4 kbyte ROM. For the interface, there analogue signal chain are defined by
Telephone/fax 01543 670391 are 64 bytes of RAM, and for the cali- numbers passed to the digital-to-ana-
bration data, there is a 48 8 bit EEP- logue converter (DAC) interfaces from
ANALOG
5 OFC VMO 12
ANALOG SIGNAL CHAIN
CMN
6 VBN VDD 1 11
IO 1
BIDIR I/O
DIGITAL
IO 2 LX11 CORE
UART,
COMS TIMER &
IRQ's
RAM ROM
EEPROM Figure 1. Block dia-
gram and pinout of the
980090 - 11a MLX90308.
the microcontroller (GN[9:0] and A/D and D/A conversions using only one (3) is provided. When this pin is pulled
OF[9:0]). The wide range of bridge off- DAC low, the monitor program is entered
set and gain is accommodated by For saving chip area, the single offset and the chip changes its functionality.
means of a 2-bit coarse adjustment DAC is multiplexed in various ways. In all applications, this pin should be
DAC in the offset adjustment Both fine offset and digital mode sig- pulled high or left floating (there is an
(CSOF[1:0]), and a similar one in the nals are stored on a capacitor. An ADC internal pullup resistor).
gain adjustment (CSGN[2:0]). loop is available via a 10-bit multi-
The temperature signal, TPO, gen- plexer (see also Figure 1). MICROPROCESSOR
erated from the external or internal AND DIGITAL SECTION
temperature sensor, drives an ana- Digital-to-analogue The Type LX11 microcontroller core is
logue-to-digital converter (ADC) inter- Before changing to another capacitor, well specified elsewhere (for instance,
face to provide a 10-bit digital repre- the DAC output must be settled to the in Melexis Standard Products Book) and
sentation of temperature for use in cal- new value. So, MODSEL moves the will therefore not be discussed in detail
culating the main 10-bit DAC inputs. A analogue multiplexer to the so-called in this short article. It has the follow-
similar 2-bit coarse adjustment, open-state 0. At the same time, the ing features:
GNTP[1:0] is also required for the tem- 10-bit multiplexer selects OF[9:0] for
perature signal gain and offset. the offset DAC. After the DAC settling two accumulators, one index, and
In the digital mode, the analogue time, the analogue multiplexer is two interrupt accumulators
sensor signal is converted to digital moved to its final state and the DAC 8-bit I/O ports (see below)
information before being processed by output is stored on a capacitor. wait mode is not implemented
the microcontroller. It is then con- 64 byte RAM
verted with the 10-bit DAC and finally Analogue-to-digital 4 kbyte ROM; 3 kbyte is available
directed to the output. The S/W signal MODSEL connects the for the users application firmware
SAR output to the DAC and the DAC (changed with one mask only);
ANALOGUE SECTION output to the comparator. The SAR 1 kbyte is reserved
A bandgap-stabilized supply regulator register is initialized by a leading edge 488-bit EEPROM, which is acces-
is provided internally; the pass tran- of STC (S/W signal). At the end of the sible only via the I/O ports (see
sistor is external. The bridge-type sen- A/D conversion, the EOC flag is set to below)
sor is typically powered by the regu- 1 and the controller can read the ADC
lated supply (typically 4.75 V). For values. I/O ports
ratiometric operation, the supply reg- The 90308 microcontroller has 15 port
ulator may be disabled by shorting the Power-on reset addresses. Read and write operations
unregulated and regulated supply The power-on reset initializes the state to the same address do not access the
pins (VDD1 and VDD respectively). of the digital part after power up. This same port. In other words, there are 15
The 90308 contains a programma- reset procedure has two phasessee input ports (only six used) and 15 out-
ble on-chip RC oscillator. No external Figure 3. The reset level is typically put ports. See Table 1.
components are needed to set the fre- 3.5 V, while the delay time is given by:
quency (87.8 kHz1%) The micro- Interrupt controller
processor clock is generated by a Tdelay = 26/fRCosc. The 90308 has four interrupt sources:
phase-locked loop (PLL) (614 kHz or two UART interrupts and two timers.
2.46 MHz) that locks on the basic oscil- Test mode When these sources are enabled (out-
lator. For 100 per cent testability, a TEST pin put port), the LX11 core is sent to
x1
x1
VM VMO
VBP
sensor IAO GNO
bridge IA GN
x 20
VBN
CM CMO
INV CSOF [1:0] GN [9:0] CSGN [1:0]
Temp CMN
sens
IO1
IO2
STC EOC
ADC input
TPD
Comp.
10 bit DAC
TPO 10 bit SAR
TMP TEMP
AMP
DARDIS
MODSEL [1:0]
NEXT P
ADCPD ADC
GNTP [1:0]
980090 - 12
Demonstration material
A complete set of demonstration mate-
rial is available to bona fide designers
upon request. It contains:
10 samples 90308 with versatile
Internal Reset 1
demonstration firmware
0 a demonstration board
Tdelay a serial cable for connection to a PC
980090 - 13 special software for communication
Phase 1 Phase 2 and calibration
a demonstration description
With the demo set, a working sensor
interface can be built and calibrated
4 SOURCE CODE FILE [ INCLUDE FILE ]
Table 1. Input-ports
7 6 5 4 3 2 1 0 bitnumbers
port msb msb-1 msb-2 msb-3 msb-4 msb-5 msb-6 lsb portname
0 Table 3. Absolute maximum ratings
1 RX7 RX6 RX5 RX4 RX3 RX2 RX1 RX0 UART receive VDD1 (regulator active): 35 V
2 PTPI PTMI PUTI PURI interrupt register VDD (regulator disabled): 7V
3 IRQ1 IRQ0 EOC TESTB WCB input register Die temperature: +160 C
4 EEI7 EEI6 EEI5 EEI4 EEI3 EEI2 EEI1 EEI0 EEPROM read Storage temperature range: 55 C to +150 C
5 Working temperature range: 40 C to +140 C
6 Supply current (at 25 C ambient):
7 ADC9 ADC8 ADC7 ADC6 ADC5 ADC4 ADC3 ADC2 ADC input 1 current mode: 2.1 mA
8 IBP1 IBP0 ADC1 ADC0 ADC input 2 voltage mode: 5 mA
Table 2. Output-ports
7 6 5 4 3 2 1 0 bitnumber
port msb msb-1 msb-2 msb-3 msb-4 msb-5 msb-6 lsb portname
0 DIGMPD OUTM1 OUTM0 WDTSTA ETPI ETMI EUTI EURI UARTMR control
1 TX7 TX6 TX5 TX4 TX3 TX2 TX1 TX0 UART transmit
2 ATPI ATMI AUTI AURI interrupt register
3 AWD MUX2 MUX1 MUX0 STC ADCPD MODSEL1 MODSEL0 output register
4 EEO7 EEO6 EEO5 EEO4 EEO3 EEO2 EEO1 EEO0 EEPROM write
5 EEA5 EEA4 EEA3 EEA2 EEA1 EEA0 EEPROM address
6 VEE1 VEE0 EBW EBE EWR ERD EER EEPROM control
7 CADJ7B CADJ6 CADJ5 CADJ4 CADJ3 CADJ2 CADJ1 CADJ0 clkadj register
8 OFBUFPD DARDIS OBP1 OBP0 BPDSEL1 BPDSEL0 BPASEL1 BPASEL0 output II register
9 GN9 GN8 GN7 GN6 GN5 GN4 GN3 GN2 DACGN I register
10 GN1 GN0 DACGN II register
11 OF9 OF8 OF7 OF6 OF5 OF4 OF3 OF2 DACOF I register
12 OF1 OF0 DACOF II register
13 IINV GNTP1 GNTP0 CSOF1 CSOF0 CSGN2 CSGN1 CSGN0 output III register
14 TURBO OUTM2 INEXTP TPD output IV register
Reference:
Versatile Control System PLC87 (A), Elektor Electronics October & November 1998
DATASHEET
#
Syntax Parameter(x.y) BCR AC1 AC2 Meaning Function
CU C x 07 >,? - - count up Cx = Cx + 1 on pos. edge of BCR
CD C x 07 >,? - - count down Cx = Cx - 1 on pos. edge of BCR
SD T x 0 15 >,? - - start Tx, on-delayed start Tx as on-delayed Timer if BCR=1
PLC87 (A)
AC2 = accumulator 2
BCR = bit-combination result
> = operation reads register
? = operation depends on register status
= = operation writes to register
- = no change to register
11/98