+ All Categories
Home > Documents > Volume 2 Issue 3 March 2000 -...

Volume 2 Issue 3 March 2000 -...

Date post: 14-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
81
Volume 2 Issue 3 March 2000
Transcript
Page 1: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 1999 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, Febuary 1999 - www.epemag.com - XXX

Volume 2 Issue 3March 2000

Page 2: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 164

Copyright 2000, Wimborne Publishing Ltdand Maxfield & Montrose Interactive Inc.,

PO Box 857, Madison, Alabama 35758, USAAll rights reserved.

WARNING!The materials and works contained within EPE Online — which are made available

by Wimborne Publishing Ltd and Maxfield & Montrose Interactive Inc — arecopyrighted. You are permitted to download locally these materials and works and tomake one (1) hard copy of such materials and works for your personal use. Internationalcopyright laws, however, prohibit any further copying or reproduction of such materialsand works, or any republication of any kind.

Maxfield & Montrose Interactive Inc and Wimborne Publishing Ltd have used theirbest efforts in preparing these materials and works. However, Maxfield & MontroseInteractive Inc and Wimborne Publishing Ltd make no warranties of any kind, expressedor implied, with regard to the documentation or data contained herein, and specificallydisclaim, without limitation, any implied warranties of merchantability and fitness for aparticular purpose. Because of possible variances in the quality and condition ofmaterials and workmanship used by readers, EPE Online, its publishers and agentsdisclaim any responsibility for the safe and proper functioning of reader-constructedprojects based on or from information published in these materials and works.

In no event shall Maxfield & Montrose Interactive Inc or Wimborne Publishing Ltd beresponsible or liable for any loss of profit or any other commercial damages, includingbut not limited to special, incidental, consequential, or any other damages in connectionwith or arising out of furnishing, performance, or use of these materials and works.

Page 3: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 84Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 164

PROJECTS AND CIRCUITS

TEACH-IN 2000 - Part 5 - Waveforms, Frequency and Time by John Becker

Essential info for the electronics novice, with breadboard experiments and interactivecomputer simulations.

208

PRACTICALLY SPEAKING - by Robert PenfoldA novice’s guide to resistors and potentiometers

228

CIRCUIT SURGERY - by Alan WinstanleyOpamp Differentials; Hot Regulator; Conventional Current Flow

223

REGULARS AND SERVICES

NEWS - Barry Fox highlights technology’s leading edge. Plus everydaynews from the world of electronics.

231

READOUT - John Becker addresses general points arising. 235

SHOPTALK - with David Barrington The essential guide to componentbuying for EPE Online projects.

240

EDITORIAL 165

SERIES AND FEATURES

HIGH PERFORMANCE REGENERATIVE RECEIVER - Part 1by Raymond Haigh

Beautifully designed receiver covering 130kHz to 30MHz global broadcast and amateur bands

173

TECHNOLOGY TIMELINES - Part 2 Days of Later Yore, plus Fundamental20th Centuary electronics by Clive “Max” Maxfield & Alvin Brown

Who, what, where, and when - the fascinating story of how technologydeveloped in the past millennium.

198

EPE ICEBREAKER - by Mark StuartReal-time PIC In-Circuit Emulator, programmer, debugger, and development system

183

PARKING WARNING SYSTEM - by Tom WebbAvoid having an unwanted rear entrance to your garage!

167

INGENUITY UNLIMITED - hosted by Alan WinstanleyDelay-On Timer, 555 Power Supply, PIC Adapter Socket; Shaky Dice, ...

194

NET WORK - THE INTERNET PAGE surfed by Alan WinstanleyRadio Bygones Message Board; Search Engines; Disappearing URLs

221

AUTOMATIC TRAIN SIGNAL - by Robert PenfoldEasy-to-build, low-cost Starter Project for model railways

179

NEW TECHNOLOGY UPDATE - by Ian PooleMagnetic memories threaten conventional and Flash devices

196

Page 4: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - XXX

BASH, WIND, WIREOccasionally a project comes along that makes you realize just how clever some of our modern ICs

are. One such project is the Micro-PICscope to be featured next month (see the Next Month page formore details). When the editor of the hard copy edition of EPE – Mike Kenward – was an apprentice withthe Ministry of Aviation (now MoD), back in the distant past, he built a Wireless World Oscilloscope – inthose days Wireless World (now Electronics World) actually published constructional projects.

To build the ‘scope they first spent a week “chassis bashing”, and they also had to weld up the sides ofthe aluminum chassis (and if you have ever tried welding aluminum you will know that many of them had tostart again when the prized chassis fell into holes under the welding torch!) Then they fitted thetransformers, valve bases, switches, potentiometers, tagstrips, and the oscilloscope tube, inside its mu-metal screen; after which they could start wiring it all up. Oh, by the way, they also had to wind their ownmains transformer and EHT transformer before we started on the electronics.

By the time the unit was finished it weighed about 10kg and measured around 500mm x 300mm x250mm, plus the performance was rather limited and it took five minutes to warm up! Now just 30 years onwe can do roughly the same thing with two chips and a liquid crystal display (LCD), put it in your pocket,power it from a battery and build it for under 20 UK Pounds. Accepted the performance is very limited andso, too, is the display, but it is a useful little tool for any hobbyist. We expect it to be very popular and thereare a couple of other PIC-based items of test gear in the pipeline.

TERRYWe dedicate this issue to Terry Farmiloe, the Typesetting Manager of the printed edition of EPE, who

died on Jan. 2nd, aged 61. Terry had a gruff exterior that hid a heart of gold. While his name will not beknown to readers, he has been responsible for running the EPE typesetting department, and thus theproduction of EPE and other publications, for the last 10 years.

Good luck on your onward journey, Terry, we miss you greatly. Our sympathy goes to your lovingfamily.

EPE Online, March 2000 - www.epemag.com - 165

Page 5: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 166

MICRO-PICSCOPEIt’s astonishing what opportunities are continuing to be revealed for the recently introduced

PIC16F87x series of microcontrollers. The Micro-PICscope is a prime example of a design ideawhose implementation was greatly simplified by using one of these devices.

The Micro-PICscope is a handy little item of test gear and of benefit to anyone’s workshop. Us-ing an alphanumeric liquid crystal display, it is basically a signal tracer, but one with the great ad-vantage that it shows a representation of the signal waveform being traced. This is shown acrosseight of the LCD character cells and is a real-time trace of the monitored waveform.

Not only that, the display also shows the frequency of the signal being monitored, and its peak-to-peak voltage. The frequency range covered is basically for audio, but frequencies well to eitherside of this range can be traced.

Several ranges of control are offered by push-button selection, covering the sampling rate, andsynchronization on/off for the ‘scope display. The signal input is switchable to provide differentmaximum peak voltage monitoring ranges. Selection of AC or DC input is provided.

The entire design requires only two ICs, a PIC microcontroller and an opamp, plus a 2-line by16-character intelligent LCD. Probably the simplest and cheapest ’scope ever.

FLASH SLAVECameras have undoubtedly increased in sophistication over the last ten years or so, with fea-

tures such as auto-focus and built-in flashguns now being commonplace. On the other hand, a few“standard” features seem to have become rarities that are featured on little more than a few up-market cameras. The humble flash socket certainly falls into this category.

For most users, this lack of an external flash connector is probably of little consequence, but itis a major drawback for anyone wishing to go beyond simple “point and shoot” flash photography.This easy-to-build, inexpensive little unit will fire a secondary flash without any connections to thecamera, thus overcoming the problem.

GARAGE LINKThis circuit helps to prevent the garage door (or either door in the case of a double garage hav-

ing twin doors) being left open all night. It works by establishing a radio link between the garageand some point inside the house. The unit indoors then provides an audible warning in the form ofa short bleep every 45 seconds. It could also be used to monitor a range of other things around thehome.

Page 6: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 167

This is a device to aid you inparkiar in a garage by providing avisual and audible warning. It iseasily set up by mounting it ontothe wall at the end of the garage.

The device produces a codedinfrared (IR) beam which detectsthe proximity of the vehicle bybouncing IR off it as itapproaches, without beingconfused by other IR sources.When the vehicle is within thepreset range, an audible warningis given and a group of lightemitting diodes (LEDs) are turnedon.

The block diagram in Fig.1shows how the circuit is split upinto separate sections.

INFRARED CODINGA system based on a

continuous IR signal would fail inthis type of application, since thereceiving circuit would be heavily

removed. An HT12D decoderthen decodes the signal to givea steady output.

CODEDTRANSMITTER

Either the HT12A or HT12Btransmitter devices may beused in the coded transmissioncircuit. They work in exactly thesame way except the four dataoutputs of the HT12A areinverted as compared with theHT12B. However, since theseoutputs are not used in thiscircuit, this is of no importance.

Referring to the full circuitdiagram in Fig.2, pins A0 to A7of the transmitter IC2 set thecoded signal for the IRtransmission, which can only beaccepted by a decoder chip(IC3 in Fig.2) with the samesettings. The printed circuitboard is designed so that pinsA0 and A1 are connected to the0V supply line, pins A2 to A7being left unconnected.

Pin 9 of IC2 is connected to0V and pin 18 connected to the

How to avoid having an unwanted rear entrance to your garage!

PARKING WARNING SYSTEMby TOM WEBB

influenced by stray backgroundIR emission from lights etc. Acoded IR signal is better sincethe receiver can be set up toonly accept a specific code.

There are a number ofencoding and decoding ICsavailable, but two from Holtekare used for this circuit. TheHT12B transmitter encodes thesignal and adds a 38kHz carriersignal for greater reliability. Aseparate demodulating sensordetects the coded signal andprovides a clean outputwaveform with the 38kHz carrier

Fig.1. Parking Warning System block diagram.

MONOSTABLEINFRA-REDENCODER &TRANSMITTER

INFRA-REDRECEIVER &DECODER

BUZZERAND/ORL.E.D.s

CAR

Fig.1. Parking Warning System block diagram.

Page 7: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 168

positive supply, which shouldnot exceed +5V. IC2 pins 11 to14 are not used. The pinslabeled X1 and X2 are theoscillator control pins, andrequire a 455kHz ceramicresonator (component X1) alongwith resistor R6 and twocapacitors, C2 and C3.

The Dout pin provides acoded output superimposed ona carrier signal of 38kHz which,with the aid of Darlingtontransistor amplifier TR2,operates the IR light emittingdiode D1.

Potentiometer VR1 allowsthe transmission power to bevaried. Ballast resistor R8prevents a power supply shortcircuit through D1 and TR2when VR1 is set to minimumresistance.

IC2 pin 10 is connected toground to hold the transmitterperpetually triggered.

INFRAREDRECEIVER

The IR sensor/amplifier/demodulator, IC1, is housed ina package resembling a smallpower transistor. The receiverrejects all IR transmissionsexcept the required 38kHzsignal, and provides a cleanoutput (easily viewed on anoscilloscope). There are threepossible receivers that performthe functions required, but intests the best performer for thiscircuit was the PIC26043S (nota PIC microcontroller!).

When the detector detects asignal having a frequency of38kHz, its output goes high.Transistor TR1 inverts this leveland supplies it to the decoderIC3 at DIN (pin 14).

The code to which IC3responds is set by its pins A0 to

A7. Since pins A0 and A1 ontransmitter IC2 are connected to0V, the same pins on IC3 are alsoconnected to 0V.

Resistor R4 sets theoscillation frequency for IC3 tothe required 150kHz. The value ischosen to suit a power supply ofbetween 45V and 5V. When IC3receives a correctly coded signal,its pin 17 (VT) goes high. Thistriggers the monostable formedby IC5a and IC5b. When the VTpin of IC3 is open circuit (nosignal being received), resistorR7 draws the input pin of themonostable to 0V. Oncetriggered, the monostable’soutput remains high for a periodset by the values of C4 and VR2.

The formula used to calculatethis period is T = 07 x R x C.With VR2 set to 100k, theperiod will be 07 x 01M x 47uF= 329 seconds.

Constructional Project

bc

e

a

a

a

a

a

k

k

k

k

k

D3

D4

D5

D1IR

bc

e

bc

e

IC3HT12D

IC5a4001

IC5b4001

IC5c4001

IC5d4001

IC1PIC-26043S

TR1BC184L

TR3BC184L

TR2TIP122 ORTIP121

1

2

3

4

5

6

7

8

9

18

17

16

15

14

13

12

11

10

A0

A1

A2

A3

A4

A5

A6

A7

VSS

V

VT

OSC1

OSC2

DIN

D11

D10

D9

D8

DD

R247k

R447k

R54k7

R94k7

R310k

R7100k

R610M

R8100Ω

R10330Ω

R1100Ω

VR21M

VR1470Ω

GND

+VE

C1100µ

C61000µ

C447µ2

13

6

9 13

5

8 12

4

10 11

14

7

N.C. N.C.

WD112V

D21N4001

C5100n

C2100p

C3100p

S1

+12V D.C.

+

0V

POWERINPUT

(SEE TEXT)

IC2HT12B

1

2

3

4

5

6

7

8

9

18

17

16

15

14

13

12

11

10

A0

A1

A2

A3

A4

A5

A6

A7

VSS

V

DOUT

X1

X2

L/MB

D11

D10

D9

D8

DD

X1455kHZ

OUT

IC47805

INOUT

COM

Fig.2. Complete circuit diagram forthe Parking Warning System. The

transmitter is the lower section(IC2/TR2) of the circuit.

Page 8: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 169

The output from themonostable, at IC5b pin 4, isfed to transistor TR3 via resistorR9. When the output level ishigh, TR3 is turned on anddrives the warning buzzer WD1and turns on LEDs D3 to D5.Diode D2 prevents back EMF

from the buzzer which mightotherwise damage the circuit.R10 is a ballast resistor to limitthe current through the LEDs.

POWER SUPPLYPower to the circuit is

intended to be from a 12V mainsadapter as the circuit will need tobe left switched on for longperiods of time. A supply of 12Vis required in order to power thebuzzer. The power supply isregulated down to 5V by IC4 tosuit the rest of the circuit.

If a buzzer is not being used,then diode D2 can be omitted anda supply of 5V (or 45V) could beused by inserting a wire link in theplace of regulator IC4 (betweenits In and Out pins). However, inthis case, the value of LEDballast resistor R10 should bereduced to about 180 ohms. Thisalso means that batteries couldbe used as the standby current isless than 10mA.

Capacitors C5 and C6decouple the power fed to IC4.Capacitor C1 and resistor R1smooth out the voltage suppliedto the receiver device, IC1.

CONSTRUCTIONApart from the buzzer and

LEDs, all the components arecontained on a single printedcircuit board (PCB). The topsidecomponent layout and full sizeunderside copper foil master areshown in Fig.3. This board isavailable from the EPE OnlineStore (code 7000258) atwww.epemag.com

Begin construction bysoldering in the resistors and thefour wire links. Ensure the correctorientation in the PCB forcomponents C1, C4, C6, TR1 toTR3, D1 and D2. Capacitors C2,C3 and C5 may be connectedeither way round.

Note that on the IR diode,D1, the long leg is likely to bethe cathode (k), but check thiswith the component supplier’scatalog.

Infrared receiver IC1 has a“dome” on its sensitive side,which should face outwardsfrom the PCB. Once solderedin, IC1 should be bent back toso that the dome is facingupwards.

Use IC sockets for IC2, IC3and IC5. Do not insert the dual-in-line (DIL) ICs untilconstruction has beencompleted and fully checked.

CASINGTwo plastic cases will be

needed as the LEDs need theirown separate case in order tobe seen through the rearwindscreen of the car.

The circuit board ismounted in its own case onsmall PCB supports which firmlysecure it in place, see Fig.4.Drill holes in the case to suit thepositions of the IR receiver andIR diode, see photographs. Thehole for the IR receiver shouldnot be too small otherwise therange will be reduced. Ifmaximum range is requiredthen the IR receiver should bepositioned right by the hole.

If you prefer to haveplugged connections for thepower supply input and for theoutput to the LEDs, suitableholes should also be drilled fortheir sockets. You also need ahole for the power on/off switchif you decide to use one,although one was not used onthe prototype.

Additionally, two holes arerequired to allow adjustmentaccess to the two presetpotentiometers, using a smallscrewdriver. All holes should bedrilled accurately to correspond

Constructional Project

COMPONENTSResistors

R1, R8 100 ohms (2 off)R2, R4 47k (2 off)R3 10kR5, R9 4k7 (2 off)R6 10MR7 100kR10 330 ohms

See also theSHOP TALK Page!

CapacitorsC1 100u radial electrolytic, 25VC2, C3 100p (2 off)C4 47u radial electrolytic, 25VC5 100n ceramicC6 1000u radial electrolytic, 25V

SemiconductorsD1 IR diodeD2 1N4001 rectifier diodeD3 to D5 red LEDs (3mm or 5mm)TR1, TR3 BC184L npn transistors (2 off)TR2 TOP122 (or TIP121) npn Darlington transistorIC1 PIC26043S IR receiverIC2 HT12B (or HT12A) encoderIC3 HT12D decoderIC4 78L05 +5V 100mA regulatorIC5 4001B quad NOR gate

MiscellaneousS1 s.p.s.t. toggle switch (optional)WD1 buzzer, 12VX1 455kHz resonator

Printed circuit board availablefrom the EPE Online Store, code7000258 (www.epemag.com);plastic case to suit (2 off, see text);14-pin DIL socket; 18-pin DILsocket (2 off); connectors forpower and LED cables (see text);PCB pillars (4 off); connectingwire, solder, etc.

$29Approx. CostGuidance Only

PotentiometersVR1 470 ohm miniature horizontal skeleton presetVR2 1M miniature horizontal skeleton preset

Page 9: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 170

with their respectivecomponents.

The LEDs mounted in theirseparate case can be connectedto the circuit using singlescreened wire, as shown in

Constructional Project

Fig.5.

TESTINGThe first check

is to make sure the voltageregulator IC4 is the correct wayaround. Connect the circuit tothe 12V power supply and thencheck that 5V is present on theoutput pin of IC4. If it is, thendisconnect the power and insert

the remaining chips, correctlyorientated.

Testing of the IR modulespresents a problem as if onedoesn’t work then the other willseem not to be working as well.If in doubt use a voltmeter oroscilloscope as follows:

Test the voltage on the VTpin (pin 17) on IC3 of thereceiver module. It should

ak

R9

R3 R

2

R1

R7

R8

R6

C1

D1

C4

C6

TR3

TR2

TR1 IC4

IC1bce

+

+

+

R10

R4

R5

C5

C2

C3

a

kX1

D5(k)

D3(a)

WD1

WD1+

V++

0V0VVR1

VR2

e

c

b

b

c

e

OUTCOM

IN

+VEGND OUT

258

D2

VIA S1

Fig.3. Printed circuit board topside compo-nent layout and (top right) approximately

full-size underside copper foil master.

D4 D5D3a aa k kk

L.E.D.S CONNECTEDIN SERIES

OPTIONALJACK PLUG

SCREENEDCABLE

Fig.4 (below). Wiring from the circuitboard to the optional LED jacksocket and power connector.

HOLE TO ADJUSTTIME BUZZER ORL.E.D.S ARE ON

INSIDE VIEW

+

+

+

POWER

BUZZER

OPTIONAL JACKSOCKET TO CONNECTTO L.E.D. BOX

OPTIONALPOWERCONNECTOR

HOLE TOADJUSTRANGEOF IR

Fig.5 (above). The LEDs mounted ina separate case and connected viascreened cable and jack plug to the

Page 10: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 171

normally be at 0V but change toabout 5V when a signal isreceived. Now check thevoltage on the pins of IC1. Pin 3should be at 5V and pin 2 at 0V.When a signal is not beingreceived, pin 1 (the output pin)should be at just under 4V.When a signal is received thisvoltage should fall by about 1V.

Note that as the signal is

oscillating, a voltmeter providesa rather approximate guide tovoltage. If an oscilloscope isavailable it should be possibleto view the encoded signal, inwhich case the trace will riseand fall between 4V and 0V. Ifthis test fails then try sending asignal from a TV remote controlunit. The signal will not bedecoded, but you will at least

know if the receiver IC isworking, and hence determine ifthe fault lies in the transmitter orreceiver or both.

If the output from IC1 isworking, test the signal at pin 14(Din) of IC3 on the receivermodule. It should be at about0V when no signal is received,rising to about 13V (as seen ona voltmeter) when a signal isreceived. Again, an oscilloscopewill show that the signal actuallypulses to about 5V.

If the VT pin on the receiveris working then simple voltmetertests should establish theposition of any other faults.

If the circuit is triggeredstraight away then IC1 may bereceiving IR straight from the IRdiode D1, through strayreflection inside the case. If thishappens the transmitter shouldbe surrounded by a rolled pieceof black card.

SETTING UPThe presets VR1 and VR2

can be adjusted to suit theuser’s own particular needs. Thefollowing is a summary of theirfunctions:

VR1: Adjusts the range ofthe IR beam by decreasing orincreasing the power goingthrough IR diode D1. Reducingthe resistance extends therange.

VR2: Sets the time thebuzzer and LEDs stay on bycontrolling how muchrecharging current is input to themonostable. Reducing theresistance reduces the time.

COMMONPROBLEMS

Typical mistakes include dryjoints and bridged pads, i.e.adjacent pads accidentally

Constructional Project

Completed circuit board mounted inside its box.

The transmitter/receiver case and the smaller LEDbox with their lids removed. Note the “tube” of blackcard to stop stray reflections from reaching the IR

receiver chip.

Page 11: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 172

joined together with solder.Other problems include failureto insert wire links. Also checkthat the components arecorrectly placed, and the correctway round. Note again thatsome IR LEDs are unusual inthat the longer lead denotescathode (k).

IN USE

This Parking WarningSystem should be set up withthe IR sensors lining up with theextremity of the car, e.g.bumper. The LED box shouldbe positioned so as to be seenthrough the rear windscreen.The time the LEDs and buzzerare on, and the range of the IRcan easily be changed using ascrewdriver to adjust the presetsVR1 and VR2.

Constructional Project

Completed remote LEDwarning box.

Page 12: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 173

ORIGINS OFREGENERATION

Almost a hundred years ago,scientists and engineers inEurope and America were tryingto develop more sensitive circuitsfor the reception of radio signals.

C. S. Franklin in England andA. Meissner in Germany wereboth working on similar lines, butthe credit for discovering thebenefits of applying positivefeedback to a tuned circuit isgenerally attributed to that greatAmerican radio pioneer, E. H.Armstrong. Known as

developed across it.Armstrong (and others)

discovered that, by connectinga triode valve to the tunedcircuit and feeding back a tinyportion of the amplified signal tothe coil, its Q can bedramatically increased. By thismeans, Q factors of severalthousand can be achievedbefore the onset of oscillation,and the wanted signal is greatlyamplified.

It is this phenomenon whichimparts such a high degree ofsensitivity and selectivity tosimple regenerative receivers.

POPULARITYRegenerative radio sets

were produced in large numbersthroughout the ’twenties. Skill isrequired to get the best out ofradios of this kind: in particular,the regeneration control has tobe carefully adjusted whenreceiving weak signals. Largelybecause of this, the easilyoperated superhet (alsoinvented by Armstrong) beganto challenge the popularity ofthe regen’ in the ’thirties.

During the Second WorldWar, Germany manufacturedregenerative sets for militaryuse, and the Britishincorporated circuits of this kindinto clandestine transceivers.Manufacture for domestic

Provides continuous coverage from 130kHz to30MHz. Capable of receiving broadcast and amateurstations from around the world.

HIGH PERFORMANCEREGENERATIVERECEIVER by RAYMOND HAIGH

“regeneration”, the techniqueproduces a truly dramaticincrease in receiver sensitivityand selectivity.

Armstrong filed his patent inOctober 1913, just two monthsbefore his 23rd birthday. At thisamazingly young age he hadpushed forward the frontiers oftechnology and made man’sdream of long-distance radioreception a reality.

HOW IT WORKSTuned circuits, formed by

an inductor (coil) and acapacitor, are crucial to theworking of radio receivers. Byvarying one of thecomponents (usually thecapacitor), the circuit can betuned to resonate at aparticular frequency.

This combinationmagnifies a signal to which itis tuned. The degree ofmagnification is dependant onthe quality of the tuned circuit,and this is defined by a figureof merit known as the Q-factor. A figure of 100 iscommon. If a signal of 1mV isapplied to a tuned circuit witha “Q’’ of 100, a voltage of 100x 1mV, or 01V will be

Page 13: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 174

listeners continued almost to theend of the valve era, with Ever-Ready producing a two-valvebattery-operated set (theirModel H) during the ’fifties.

AVOIDINGPROBLEMS

Regenerative receivers areeasily overloaded by powerfulsignals. They are also affectedby aerial characteristics.

When an aerial system,which is directly connected tothe tuned circuit, is resonant atthe reception frequency (or aharmonic), it absorbs energyand inhibits regeneration.Known as “suck-out”, thephenomenon manifests itself asdead spots in the tuning range.

Overload and “suck-out”,together with an erraticfeedback control, can ruin theperformance of regenerativeradios. They are avoided in thisdesign.

WAVE TRAPPowerful local radio

transmitters can swampregenerative receivers (theyeven cause problems withsuperhets of advanced design).The answer to this is theinclusion of what is known as a“wave trap”.

An inductor L1 andcapacitor C1 form a paralleltuned circuit, which presents ahigh impedance at resonance,see Fig.1. When the inductor/capacitor combination is set tothe frequency of the offendingtransmitter it blocks it out.

The problem is invariablyencountered on MediumWaves, and suitable componentvalues to tackle this problem,should it arise, are scheduled inTable 1.

Constructional Project

b

ce

bc e

g2 g1

d s

g

d s

B1

9V T

O 1

2V

TR4

BC

239C

R13

2M2

C18 10n

R12

10k

C17

100

R11

220

S1A

ON

/OFF

C16 1

R14

470

C19 1

TO V

R8

TO V

R8

AU

DIO

OU

TPU

T

C15 1

C1

33p

TO22

0p

C2

100

AE

RIA

L

L1R

WR

3312

08N

O

SK

1/P

L1

L2 (SE

ETAB

LE 2

)

C3

100n

R3

100k

SK

2/P

L2

EA

RTH

C4

100n

R.F

.A

TTN

.

TR

1B

C55

7

VR

11k

SK

3/P

L3

R2

22k

R1

100

FIN

ETU

NE

TU

NE

VC

136

5p R6

C8

VC

225

p

R7

1M

C5

47

CC

7

C6

100n

R5

4k7

TR2

2N38

19R4

10k

C9

10nC

1010

0nC

1110

0

C14

10n

C8

VR

422

k

C12 1

C13

100n

TR3

BF98

1

VR

310

0k

RE

GE

N

VR

210

k

R8

470

R10 10k

R9

100

+

A B

+

++

+

+

+

+

D

*

*

**

*

**

*

*

*

*

LOG

.

ee

bb

cc

BC

557

BC

212

2N38

19

BF9

81B

F960

BF9

613S

K81

BC

239C

BC

237

BC

238

dg

sg1

g2 s

d

LEA

DO

UTS

FO

R A

LTE

RN

ATI

VE

TR

AN

SIS

TO

RS

SE

E T

EX

T A

ND

TA

BLE

S F

OR

CO

MP

ON

EN

TS

MA

RK

ED

w

ec

b

0V

Fig.1. Circuit diagram of the High PerformanceRegenerative Receiver.

Page 14: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 175

CIRCUIT DETAILSThe circuit diagram of the

High Performance RegenerativeReceiver is shown in Fig.1.Grounded-base transistor, TR1,acts as a radio frequency (RF)amplifier. Whilst its mostimportant function is to isolatethe regenerative stage from theaerial, it also provides a usefulamount of gain.

Signal input is fed to theemitter (e) of TR1, andpotentiometer VR1 acts as anattenuator: an essential featurethat prevents overload onstrong signals. Bias is fixed byresistors R2 and R3, and C4 isthe base (b) bypass capacitor.The RF stage is decoupled fromthe supply rail by R1, C2, andC3.

The output impedance of agrounded-base stage is highenough for TR1 to be connecteddirectly to the tuned circuit, andthe use of a pnp device enablesits collector (c) to be taken tosupply negative via the coil L2.

DETECTOROld valve receivers

invariably combined thefunctions of signal detection andregeneration (or Qmultiplication) in a single stage.

With the use of transistors, betterresults, without recourse tospecially designed coils, can beachieved by separating them.

Field effect transistor TR2,biased by resistor R5 into thenon-linear region of itscharacteristic curve, functions asa sensitive, drain-bend detector.

Source decoupling at RF andaudio frequencies (AF) isprovided by capacitors C5 andC6. The output of TR2 isdeveloped across drain loadresistor R4 and C9, R8 and C14remove residual RF.

Q-FACTORDual-gate MOSFET TR3

provides the modest amount ofRF gain required for regenerationor Q multiplication. Arranged as aHartley oscillator, feedback fromTR3 source (s) is connected to atapping on coil L2, via biascomponents resistor R6 andcapacitor C8. (Hartley oscillatorswere introduced in detail in theJuly 1999 installment of our six-part series on oscillators. Formore details bounce over towww.epemag.com/

frmoscii.htm, Ed.)Preset potentiometer VR4 is

included on the printed circuitboard (PCB) for use during thesetting-up process, after which itis shorted out and replaced byfixed resistor R6. Bypasscapacitor C8 assistsregeneration when the feedbackwinding is comparatively small.It is not required on all coilranges.

Feedback, or regeneration,is controlled by potentiometerVR2, which adjusts the voltageon gate 2 of TR3, therebyvarying its gain. Preset VR3fixes the range of control,capacitor C12 decouples gate 2and eliminates potentiometernoise, and resistor R10 andcapacitor C13 decouple thestage from the supply rail.

When the tuning coil L2 isremoved for band changing, thesignal gates of TR2 and TR3are kept at 0V by resistor R7.

TUNED CIRCUITThe receiver is tuned by

inductor (coil) L2 and variablecapacitors VC1 and VC2. The

BB405B

VR7100k

VR6100kD1

1/2 OFKV1236

TUNINGCAPACITORTO TR3 g1

C201n

KV1236

C21100n

D11/2 OFKV1236

BANDSET

R15470k

BANDSPREAD

OV (GND)

TO+9V TO +12V

FROMRECEIVERVR5

1k

C22100n

a

a

a

k

k

k

BB405B

Fig.2. Alternative electronic tuning sys-tem. For fine tuning only, delete VR5 andC22, use a BB405B varicap diode, and

B26V TO 9VSK1

IC1TDA7052

VR84k7LOG.

VOLUME

TOC19

2

3

AUDIOINPUT

1

68

5

C23100n

C24220

OUTPUT

LS18

ON/OFF

S1B+

0V

PHONES

Fig 3. The audio power amplifier stage.

C1 pF

334768

120220

Frequency (kHz)at max inductance

(core fully in)

Frequency (kHz)at min inductance

(core fully out)

13001100900700550

170014001200900700

Page 15: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 176

larger of the two capacitors,VC1, acts as a coarse (Bandset)tuning control. The smaller one,VC2, provides fine(Bandspread) tuning. Thesecomponents are discussed later.Fixed capacitor C7 limits themaximum value of VC1 on theshortwave ranges. The reducedswing makes tuning less criticaland consistent regenerationeasier to achieve.

Details of the coverageobtained with a range of Tokocoils, together with theassociated values of C7, R6,and C8, are given in Table 2(next month).

AUDIO AMPLIFIERThe base (b) and emitter (e)

Constructional Project

COMPONENTSResistors

R1, R9 100 ohms (2 off)R2 22KR3 100kR4, R10, R12 10k (3 off)R5 47kR6 various values (see text and Table 2 next month)R7 1MR8, R14 470 ohms (2 off)R11 220 ohmsR13 2M2*R15 470k

All 0.25W 5% carbon film

$56Approx. CostGuidance Only (Excluding batteries and tuning capacitors)

PotentiometersVR1 1k rotary carbon (logarithmic law if obtainable)VR2 10k rotary carbon, linearVR3, *VR7 100k enclosed horizontal preset (2 off)VR4 22k enclosed horizontal preset*VR5 1k rotary carbon, linear*VR6 100K rotary carbon, linearVR8 4k7 rotary carbon, logarithmic

Semiconductors*D1 KV1236, KV1235, or BB405B varicap diode (see text)TR1 BC557 pnp silicon transistorTR2 2N3819 n-channel field effect transistorTR3 BF981 n-channel dual-gate MOSFETTR4 BC239C npn silicon transistorIC1 TDA7052 low voltage 1W power amplifier

See also theSHOP TALK Page!

All capacitors 12V working or greater

MiscellaneousL1 RWR331208NO inductor (TOKO), only required if "wave trap" is needed (see text)L2 tuning band coils (TOKO), (8 off) see text and Table 2 (next month)PL1 to PL8 9-pin D-type plugs for L2 (8 off) see Table 2 for other componentsS1 d.p.d.t. toggle switchSK1, SK2 screw terminal post (Aerial and Earth)SK3 9-pin D-type socket (for plug-in tuning coils)SK4 switched stereo jack socketB1 9V to 12V battery packB2 6V to 9V battery pack

Printed circuit boards available from theEPE Online Store, codes 7000254(receiver), 7000255 (Electronic Tuning),and 7000256 (Amplifier); 9-pin D-typeplugs (8 off for tuning coils); aluminum ordiecast box; 8-pin DIL socket; plasticcontrol knobs (4 small, 1 large); reductiondrive for tuning capacitor; multistrandconnecting wire; card for tuning dial; nuts,bolts, washers, and stand-offs; solderpins, solder, etc.

Note: All components marked with anasterisk (*) are for the optional electronictuning system.

Capacitors (continued)C5 4u7 radial electrolyticC7 axial polystyrene, see text and Table 2 (next month)C8 ceramic, see Table 2 (next month)C9, C14, C18 10n disc ceramic (3 off)C12, C15, C16, C19 1u radial electrolytic (4 off)*C20 1n (1000p) or 50p polystyrene (see Fig.2)C24 220uF radial electrolyticVC1 365p Jackson O-type air-spaced tuning capacitor (see text)VC2 25p Jackson C804-type air-spaced tuning capacitor (see text)

CapacitorsC1 axial polystyrene, See Table 1C2, C11, C17 100 uF radial electrolytic (3 off)C3, C4, C6, C10, C13, *C21, *C22, C23 100nF disc ceramic (8 off)

bias of audio amplifier, TR4, arefixed by resistors R13 and R14.Signal output is developedacross collector (c) load resistorR12; and R11 and C17decouple the stage from thesupply.

The low value of emitterbypass capacitor C16 results ingain-reducing negativefeedback at the lower audiofrequencies. This improvesclarity. Coupling and DCblocking capacitors C15 andC19 have a low value for thesame reason.

Response to the higheraudio frequencies is curtailed bycapacitor C18. Constructorswho find the tone too “bright”should increase the value of thiscomponent to 47nF or 100nF.

ELECTRONICTUNING

The use of a separate Q-multiplier stage (TR3) makesthe receiver tolerant ofelectronic tuning. (Thesomewhat modest Q of highcapacitance varicap diodesinhibits the operation of mostregenerative sets).

A suitable, add-on,electronic tuning circuit is givenin Fig.2. Potentiometer VR6controls the reverse bias onvaricap diode D1 and varies itsjunction capacitance. This formsthe coarse, or Bandset, tuningcontrol.

Potentiometer VR5 permitsa small adjustment of the bias

Page 16: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 177

voltage, and acts as the fine, orBandspread, control. PresetVR7 fixes the lowest level thebias voltage can fall to, therebydetermining the maximumvalue of the tuning capacitance.(Diode junction capacitanceincreases as the reverse bias isreduced.)

The varicap diode D1 iscoupled into the main circuit viaDC blocking capacitor C20 andresistor R15 isolates the signalpath from the potentiometerchain. Potentiometer noise isprevented by capacitors C21and C22.

High value varicap diodeshave a relatively large minimumcapacitance, and an additionalcoil may be needed in order tosecure continuous coverage.Furthermore, performanceabove 20MHz or so is not quiteas satisfactory as that affordedby a traditional variablecapacitor.

These disadvantages do notapply when the electronic tuningcircuit is used with a VHF diodesolely to provide fine tuning(VR5 is omitted and the top endof VR6 is connected directly tothe positive supply rail). Thisarrangement has the advantageof low cost and conveys afreedom to locate the DC

operated Bandspread control ina position remote from thetuned circuit. The prototypeReceiver, shown in thephotographs, incorporates thisarrangement.

POWER AMPLIFIERThe circuit diagram of the

additional, single chip, audiopower amplifier stage is given inFig.3. This amplifier has its own6V to 9V power supply to avoidany possible interaction with thereceiver section. Designedaround a TDA7052 low voltagepower amp IC, the only externalcomponents are capacitors C23and C24 which ensure thestability of the device.Potentiometer VR8 acts as thevolume, or AF gain, control.

The power amplifier IC1 isshort-circuit protected, requiresno heatsink and can deliver aclean 1W of audio into an 8ohm speaker with a 6V supply.It is also claimed that there areno switch-on or switch-off clickswith this device.

POWERSUPPLIES

Current drain isextremely modest, beingonly 2mA for the radiosection and 50mA forthe power amplifier whenit is delivering a goodspeaker volume (5mAwhen ’phones are used).

Battery supplies are,therefore, eminentlysuitable, and anypossibility of hum andinterference from themains is avoided(regenerative receiversare very susceptible tothis and require acarefully designedsupply unit when they

are mains powered).The power amplifier current

swings between 6mA and 60mAor more when it is being drivenhard. The resulting supplyvoltage fluctuations woulddisturb the operation of the Q-multiplier, despite heavydecoupling.

Separate battery suppliesfor the Receiver and PowerAmplifier sections are,therefore, stronglyrecommended. They areessential when electronic tuningis adopted. A double-pole toggleswitch, S1a and S1b, connectsthe two separate battery packsinto circuit.

COMPONENTSBefore we commence

construction, a few words nowon choice of components mayhelp. Readers are also directedto our Shoptalk page for detailsof possible suppliers for someoff those “hard to find” items.

Constructional Project

The chassis of the prototype was fab-ricated from aluminum and a woodencase with hinged lid holding the loud-speaker made to house the receiver.The lid can be raised and held up by ahinged wire frame (shown above)when in use.

Page 17: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 178

CoilsAll of the inductors used in

this Receiver are from the Tokorange. Their frequencycoverage is shown in Table 1and Table 2 (next month)together with suitable tuningcapacitor values.

Coils can also be handwound. As a very rough guide,when 20mm to 25mm diameterformers are used, feedbacktappings should be about 10turns up from the “earthy” endon Long waves, 5 turns onMedium waves, and 2 or 3 turnson Shortwaves.

TransistorsTransistor types are not

critical. The Q-multiplier circuitworks well with a range of dual-

gate MOSFETS, including the40673 and the MFE201. The3N201 was not tried, but itshould prove satisfactory.

A 2N2905 pnp transistorworked well in the RF stage,and a 2N5827 or a 2N5828should be suitable for TR4.

The alternative devicesmentioned here have differentcase styles to those depicted inFig.1, and the lead-outs must bechecked.

Tuning CapacitorsA Jackson 365pF O-type

air-spaced tuning capacitor isthe preferred component forbandset control VC1, and a25pF Jackson C804 type isideal for VC2, the Bandspreadcontrol. If this latter valueproduces a bandspread tuning

rate which is too fast, connect a10pF or 5pF polystyrenecapacitor in series with it toreduce its swing.

Inexpensive, polythenedielectric variables, of the kindused in transistor portables, canalso be used. Some of thesehave comparatively low values,and both sections may needconnecting in parallel to obtainthe required tuning range. (Aswing of at least a 10pF to200pF is needed to givecontinuous coverage from150kHz to 30MHz with the coilslisted in Table 2). The 25pF FMtuning section of one of thesecapacitors can act as thebandspread control VC2.

If salvaged tuningcapacitors are used, make surethat they are clean and dry, thatthe rotor contacts aresatisfactory, and that the vanesare not shorting.

Varicap diodes are retailedby a number of suppliers andshould not be too hard to find.Any 450pF varicap designed for9V bias, should be suitable forfull electronic tuning.

NEXT MONTHIn Part 2 next month we’ll

go over the constructionaldetails for this project.

Constructional Project

Page 18: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 1999 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 179

This very simple project,suitable for beginners, is a two-color (red/green)signal for a modelrailway. It uses asimple form ofautomatic operation,and if you stop thetrain in front of thesignal it automaticallyswitches from “green”to “red”. When thetrain is restarted thesignal automaticallyswitches to “green” again.

To an onlooker it appears asthough the signal is changingcolor and the train is respondingto the change. In reality the trainand the signal are bothresponding to changes in thetrack voltage. The signal will, infact, go to “red” wherever thetrain is stopped on the layout, but

wave rectifier circuit. Thevoltage on the track is a DCsignal, but its polarity dependson the direction of the train.

To operate the main circuitreliably it is importantthat the input signalhas the correctpolarity, and thepurpose of the rectifieris to ensure that themain circuit is fed witha positive signalregardless of thetrain’s direction. Theoutput of the rectifier

is fed to a potentiometer thatenables the output voltage to bereduced. This enables the userto adjust the threshold voltageat which the signal changesstate.

The threshold level used isnot critical, but the signal shouldnot go to red while the train isstill moving. On the other hand,some types of train controller

An easy-to-build, low cost starter project for yourmodel radio system.

AUTOMATIC TRAIN SIGNALby ROBERT PENFOLD

this is of no practicalimportance, as the state of the

signal is irrelevant except whenthe train is approaching it.

SYSTEM OPERATIONThe block diagram of Fig.1

helps to explain the way inwhich the Automatic TrainSignal functions. The voltagefrom the track is fed to a full-

FULL-WAVERECTIFIER

LOWPASSFILTER

VOLTAGEDETECTOR

TRESHOLD GREEN

RED

Fig.1. Block diagram for the Automatic Train Signal.

B19V

VR122k

R410k

R61k5

R339k

R51k5

R110k

R22k2

THRESHOLD

ON/OFF

D4 D1

D2 D3

SK1

SK2 C122µ

IC1LF351N

C2100n

D1 TO D4ALL 1N4004

3

2

7

4

6

D5GREENL.E.D.

D6REDL.E.D.

(6 x AA)

S1

a

k

a

k

Fig.2. Complete circuit diagram for the Automatic Train Signal

Page 19: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 1999 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 180

never produce an output levelthat is right down at zero volts,and the threshold level must behigh enough to ensure that thesignal does go to red when thetrain stops.

It cannot be safely assumedthat the signal across the tracksis a steady DC potential. Themotor in the train is likely tointroduce large amounts ofnoise onto the track voltage,which might not be a simple DCsignal anyway. Many traincontrollers use some form ofpulsed output signal, where themotor is controlled by varyingthe average output signal.Others use the rectified but non-smoothed output from a mainstransformer.

In order to avoid problemswith noise on the input signal,and to accommodate pulsedcontrollers, the output from thethreshold control is fed to alowpass filter. This provides areasonably smooth DC outputsignal at a potential that is equalto the average input voltage.

Finally, this signal is appliedto a simple voltage detectorcircuit. With an input voltage ofup to about 18V the detector

circuit activates the red signalLED, but with higher inputpotentials it switches on thegreen LED instead.CIRCUIT OPERATION

The full circuit diagram forthe Automatic Train Signal isshown in Fig.2. The voltagefrom the rail tracks is connectedto sockets SK1 and SK2, whichfeed into a full-wave bridgerectifier (D1 to D4). The positiveDC output signal from therectifier circuit is fed to avolume control style variableattenuator (VR1) and then to asimple lowpass filter comprisedof resistor R1 and capacitor C1.

The cut-off frequency of thisfilter is low enough to ensurethat there are no problems withflickering of the signal lightswhen the track voltage is nearthe threshold level. On the otherhand, it is not so low that theunit is slow responding tochanges in track voltage.

An operational amplifier,IC1, is used here as a voltagecomparator. Resistors R3 andR4 form a potential divider thatbiases the non-inverting input ofIC1 (pin 3) to about 18V. Theoutput of IC1 at pin 6 will gohigh if the inverting input (pin 2)is taken below this potential, orlow if it is taken above thereference level.

The voltage fed to theinverting input will be very lowwith the train stationary, sendingthe output of IC1 high. As aresult red LED D6 is switchedon, but green LED D5 isswitched off.

When the train is started,the voltage fed to the invertinginput rises, and eventuallybecomes greater than thereference level at the non-inverting input. The output ofIC1 then switches to the lowstate, switching off D6 andswitching on D5. Things revert

to their original states when thetrain is stopped again, with thered LED switched on.

ON TRACKThe current consumption of

the circuit is about 7mA. A PP3size battery is just aboutadequate to supply this, but abattery pack consisting of six AAsize cells in a holder will providecheaper running costs.

Operation from a mainspower supply unit is made slightlyawkward by the fact that neithersupply rail can be earthed. This isbecause one of the input lines

Constructional Project

COMPONENTSResistorsR1, R4 10k (2 off)R2 2k2R3 39kR5, R6 1k5 (2 off)

See also theSHOP TALK Page!

All 0.25W 5% carbon film

CapacitorsC1 22u radial electrolytic, 25VC2 100n ceramic

SemiconductorsD1 to D4 1N4004 rectifier diodes (4 off)D5 green LED, 3mm or 5mm diameter (see text)D6 red LED, 3mm or 5mm diameter (see text)IC1 LF351N opamp

MiscellaneousB1 9V battery pack (6 x AA cells in holder)S1 s.p.s.t. miniature toggle switchSK1, SK2 4mm socket (2 off)

Medium size plastic case (see text);0.1 inch pitch stripboard, size 20holes x 20 strips; 8-pin DIL socket;control knob; PP3 battery clip;multistrand connecting wire; single-sided solder pins, solder, etc.

$11Approx. CostGuidance Only(Excluding Batteries)

PotentiometerVR1 22k rotary carbon, linear

Page 20: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 1999 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 181

might be earthed, and neither ofthese lines connects to a supplyrail of the signal circuit.

Earthing one rail of thesignal circuit could produce anunwanted connection that wouldprevent the unit from working,and could result in a heavycurrent flowing through the inputrectifier circuit. The mostpractical solution is to use a 9Vor 12V regulated batteryeliminator. These use doubleinsulation and have neithersupply rail earthed.

CONSTRUCTIONThe Automatic Train Signal

circuit is built up on a piece ofstripboard containing 20 holesby 20 copper tracks. Thecomponent layout, together withdetails of breaks required in thecopper strips, is shown in Fig.3.

Construction follows alongthe normal lines with a standardsize board being cut down to thecorrect size using a hacksaw.Next drill the two mountingholes, which have a diameter of3mm and accept Metric M25

mounting bolts. There are just sixbreaks in the copper strips. Thesecan be made using a special toolor by using a small hand-heldtwist drill bit of about 5mmdiameter.

The board is now ready forthe components and the threelink-wires to be added. It isgenerally considered best to startwith the small components andwork up to the largest, but in thiscase the components are all quitesmall.

It is probably best to workacross the board methodically,being careful to get everything inthe right place. In the cases ofIC1, C1, and the four rectifierdiodes (D1-D4) you must also becareful to fit them the right wayround. The LF351N used forIC1 is not a static sensitivecomponent, but as with anyDIL integrated circuit it is stilladvisable to mount it on theboard via a holder.

It might be possible tomake the link-wires usingthe wire trimmed from theresistor leads, but one or two

of them might be too long topermit this. They will then haveto be made from 22s.w.g. or24s.w.g. tinned copper wire. Fitsingle-sided solder pins at thepoints where connections will bemade to the controls, LEDs, andsockets.

CASING UPIf the unit is powered from a

PP3 size battery it should bepossible to fit it into practicallyany small plastic box. Amedium size case about150mm or so long will have tobe used if an AA battery pack isto be accommodated.

Threshold control VR1 andOn/Off switch S2 are mounted

Constructional Project

VR1

1

20

2

19

3

18

4

17

5

16

6

15

7

14

8

13

9

12

10

11

11

10

12

9

ABCDEFGHIJKLMNOPQRST

ABCDEF

GHIJKL

NO

QRST

8

17

46

19

2

14

7

18

3

16

5

20

1C2

R1

R5

R6

R3

R4

R2

+

C1

ON/OFF

THRESHOLD

S1

k

k

k

k

k

k

a

a

a

a

a

a

D1

D3

D4

D2

FLAT

FLAT

D5

D6

TOB1

RED

BLACK

SK1

SK2

Fig.3. Stripboard component layout, inter-wiring to off-board components and details

of breaks required in the undersidecopper strips.

Page 21: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 1999 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 182

on the front panel, while inputsockets SK1 and SK2 aremounted on one side or at therear of the case, seephotographs. An exit hole forthe lead to the signal LEDs isrequired in one side or the rearof the unit. The circuit board ismounted in any convenientspace, and it is advisable to usesome extra nuts or shortspacers between the board andthe case. This avoids anytendency for the board to buckleand break when the mountingnuts are tightened. To completethe main unit the hard wiring isadded. This is all shown in Fig.3and is perfectly straightforward.

SIGNAL BOXConstruction of the “signal”

is left to the ingenuity ofindividual constructors. At itsmost basic the signal can justconsist of a very small plasticbox for the two LEDs. However,it should not be too difficult tofabricate a more convincingsignal from balsa wood, bits ofdowel, etc. Provided you knowwhat you are doing, it wouldprobably be possible to adapt aready-made signal “tower” towork with this circuit.

The size of the signal mustbe varied to suit the gauge of

Constructional Project

the model railway, as must thesize of the two LEDs. For theusual smaller gauges 3mmdiameter LEDs are the bestchoice, but for larger gauges5mm types would be better. TheLED current is not very high, so“high brightness” types arepreferable.

Unlike filament bulbs, LEDswill only work if they areconnected with the correctpolarity. Having the cathode (k)lead slightly shorter than theanode (a) lead is the normalway in which the polarity of aLED is indicated. There mayalso be a “flat” on the cathodeside of the encapsulation.

TESTINGInput sockets SK1 and SK2

must be fed with the trackvoltage, and the way in whichthis is done must be varied tosuit the equipment with whichthe signal is used. In mostcases the easiest way is tomake up a twin lead fitted with4mm plugs to connect to SK1and SK2, and small, insulatedcovered, crocodile clips at theother end. The powerconnectors on the track areoften quite crude, and willpermit power to be tapped offusing the crocodile clips.

Alternatively, by simplyleaving some bare wire at theends of the leads it might bepossible to make connections tothe screw or spring connectorson the train controller, beingcareful to leave the connectionsto the track intact. Failing that, itwill be necessary to make up adual supply lead to enable boththe signal and the track to befed from the controller.

With Threshold control VR1at a roughly middle setting thesignal should work quite well,with “red” and “green” signalsbeing obtained when the train isrespectively stopped andrunning fast. The signal willprobably be at “red” when thetrain moves very slowly, orpossibly at “green” when thetrain has stopped. A littleexperimentation with varioussettings for VR1 should soonget the signal switching states atthe start/stop track voltage ofthe train.

Note that the more simpletypes of controller tend toprovide a start voltage that ismuch higher than the one atwhich the train stops. Thethreshold voltage of the signalthen has to be set at acompromise level somewherebetween these two voltages.

Layout of components inside the small plastic box. Note, theinput sockets must be fed with the track voltage.

Page 22: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 194

b

c e

+ + +

+

+

S1

FS1500mA

T1

L

N

E

230V

0V

C21000µ25V

C31000µ50V

C510µ50V

4.7mA

C410µ50V

C11000µ35V

a a

a

a

a

a

a

a

a

k k

k

kk

a

k

k

k

k

k

k

D11N4004

D21N4004

D61N4148

D81N4148

D71N4148

D91N4148

D31N4004

R1680Ω0.25W

R2270Ω0.25W

D418V0.5W

D518V0.5W

D10REDL.E.D.

TR12N1711

IC1LM317T

a

ZENERUNDERTEST

EXTERNALVOLTMETER

+

VZ

VR122k

IN OUT

ADJ

42V

10V

0V

The Purpose of the circuit dia-gram illustrated in Fig.1 is to helpin measuring the value of anunidentified Zener diode. It is cen-tered around a common LM317voltage regulator (IC1), which isconnected in its constant-currentmode. The current is set to under5mA, being calculated by the for-mula I = 125V/R, and this flowsthrough the Zener diode beingtested. A voltmeter can be con-nected in parallel with the Zenerand the Zener voltage read di-rectly. By adjusting control poten-tiometer VR1, it is possible to varythe voltage on transistor TR1emitter (e), which provides an ad-justable voltage to the current lim-iter. VR1 is then adjusted until theLED D10 illuminates to indicatethat current is flowing, when thetest voltage may be read. The cir-cuit operates from a mains powersupply. To measure diodes up to,say, 33V DC, it is normally neces-sary to use a transformer of 30VAC output, but by using a voltage

trebler circuit, based arounddiodes D1 and D2 and capacitorsC1 and C2, it is easy to use amuch lower secondary voltage(e.g. 10V AC) and raise this to auseful 42V DC (10V AC x 1414 x3) which is current limited to about35mA. Due care must be takenwhen working with these highervoltages, and extreme careshould be exercised to ensurethat all diodes and electrolytic ca-pacitors are correctly polarized.

Gianfranco De DominiciGreenock, Scotland

Microcontroller Interface

for AC Monitoring PICthe value

The circuit of Fig.2 was de-signed in order to interface aPIC microcontroller to a stan-dard clip-on DVM (digital volt-meter) current probe. The PICdevice chosen must have an

ROLL-UP, ROLL-UP!Ingenuity is our regular round-up of readers' own

circuits. We pay between $16 and $80 for all materialpublished, depending on length and technical merit.We're looking for novel applications and circuit tips, notsimply mechanical or electrical ideas. Ideas must be thereader's own work and must not have been submittedfor publication elsewhere. The circuits shown haveNOT been proven by us. Ingenuity Unlimited is open toALL abilities, but items for consideration in this columnshould preferably be typed or word-processed, with abrief circuit description (between 100 and 500 wordsmaximum) and full circuit diagram showing all relevantcomponent values. Please draw all circuit schematicsas clearly as possible.

Send your circuit ideas to: Alan Winstanley, IngenuityUnlimited, Wimborne Publishing Ltd., Allen House, EastBorough, Wimborne, Dorset BH21 1PF. They could earnyou some real cash and a prize!

Win a Pico PC-Based Oscilloscope• 50MSPS Dual Channel Storage

Oscilloscope• 25MHz Spectrum Analyzer• Multimeter• Frequency Meter• Signal Generator

If you have a novel circuit idea whichwould be of use to other readers, then a PicoTechnology PC based oscilloscope could beyours.

Every six months, Pico Technology will beawarding an ADC200-50 digital storage oscil-loscope for the best IU submission. In addition,two single channel ADC-40s will be presentedto the runners up.

Zener Diode Tester A tap on the knee

Fig.1. Zener Diode Tester.

Page 23: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 195

analogue input and the softwaredepends on the application used.The circuit utilizes low-noiseLMC6084 operational amplifiers(IC1a and IC1b) as a precisionrectifier and a filter (IC1c) withpre-settable gain to give a re-sponse to the average current.The interface circuit requires alow impedance current probe pro-viding 1mV per ampere to be con-nected to the input. The accuracyof the circuit is about as good asthe 8-bit ADC used within the mi-crocontroller when one per centresistors are employed.

Gerard la RooyNew Zealand.

Reverse PolarityIndicator-Connection Pro-tection Connection Pro-tection

In order to provide reversepolarity protection for some 12Vand 24V DC equipment, the cir-cuit diagram of Fig.3 was devised.This uses a MOSFET power tran-sistor, TR2, to virtually eliminatethe problem of undesirable for-ward voltage drop, which wouldbe apparent if ordinary rectifierswere used for protection, and thecircuit even outperformed aSchottky diode in this respect.The voltage drop is determined bythe on-resistance of TR2 and thecurrent flowing into the load.Since the MOSFET is used in itsreverse-conducting mode it is fea-sible to expect an effective on-resistance of about 20 per centbelow the manufacturer's specifi-cations, which are usually given inforward conducting mode. Twolight-emitting diodes (LEDs D2and D3) are incorporated to indi-cate correct or reversed polarities.

The circuit can be scaled upby paralleling MOSFETs or byplacing a Schottky diode in paral-lel with the transistor, to get thebest of both worlds. It is advisable

to heatsink the MOSFET becauseof its significant positive tempera-ture co-efficient.

Gerard la RooyNew Zealand.

AF Sweep Signal Generator More Scope

The purpose of the audio fre-quency (AF) Sweep Generator cir-cuit in Fig.4 (shown in stages) is toprovide an audio test signal in therange of 20Hz to 20kHz. This canbe set either to a single frequencyor a sweep range of up to ten oc-taves, which can be used to checkthe frequency response of an audioamplifier etc.

The design provides Squarewave, Triangular wave, and an ap-proximate Sine wave. The outputlevel is 0V to 6V RMS.

On the RampThe first stage of the generator

gives a continuous 0V to 11V to 0Vramp, which is used to sweep theaudio frequency output, and mayalso be used as a timebase for anoscilloscope. This should be set totwo seconds per cycle using VR1,as the 20Hz to 40Hz octave needsa certain amount of time to com-plete a few cycles. This stage alsoprovides fixed triangle and squarewave outputs.

Sine of the TimesThe second stage produces a

logarithmic curve so that ten divi-sions across an oscilloscope tubecorrespond to ten octaves: 20Hz,40Hz, 80Hz, 160Hz, 320Hz, 640Hz,1,280Hz, 2,560Hz, 5,120Hz,10,240Hz and 20,480Hz. Its twooutputs labeled +Vc and Vc con-nect to the third stage, which is avoltage-controlled oscillator (VCO).The two signal voltages requiredare +7V and 7V for 20kHz, 35Vfor 10kHz, 175V for 5kHz etc.,down to about 170mV for 20Hz. Asquare wave is also provided by the

VCO.The final stage buffers the

triangle wave produced and sets itto 6V (24V pk-pk) and a non-linear impedance formed bydiodes D18 to D27 and neighbor-ing resistors, R43 to R47, is usedto generate an approximation to asine wave. The output is also setto 6V RMS (about 17V pk-pk) us-ing VR8. It is best to use a sinewave for frequency responsecurves, as square or triangularwaves contain odd harmonics.

Power SupplyA mains power supply pro-

vides +15V and 15V, togetherwith a 5V reference. For theopamps, LF353s are recom-mended, particularly where theopamp is used as a comparatoras it has a good slew rate. This isalso required to produce a rea-sonable triangular wave at 20kHz.

An LF353 gives a fairly sym-metrical positive and negative out-put, although it was found neces-sary to set a voltage differentialusing diodes on the positive andnegative supply rails. The result-ing 136V and 142V gives a fairlygood 12V output swing. On theprototype, the square, triangularand sine wave outputs were con-nected to a switch and a 5 kilohmpotentiometer, and then on tophono sockets. The ramp andsquare wave output signals werealso brought out to front panelsockets for use as a timebase sig-nal. The ramp can be used aschannel B input for X/Y plotting, oruse a slow timebase (01sec/div.),and trigger the oscilloscope on thefalling or rising edge of the squarewave.

J.D. GrayLondon N10

Ingenuity Unlimited

Page 24: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 183

This project combines Mi-crochip’s MPLAB developmentsoftware with the advanced self-debugging features of the latestPIC chips. The result is a user-friendly advanced developmentsystem for a very low cost.

DEVELOPMENTSYSTEMS

Developing projects with mi-crocontrollers is extremely inter-esting, especially the ability toalter the way hardware respondsjust by making simple changes toprogram code.

The problem is that eachchange of code has to be written,compiled (converted into suitableform for loading) and pro-grammed into a chip before it canbe tested. Several low cost sys-tems – such as the EPE PICtutorare available (see our web pageat www.epemag.com for moredetails) and are adequate for thedevelopment of simple programs,but for larger changes and pro-grams it can be tedious, and er-rors are almost as easy to intro-duce as to eliminate.

Better methods of testing pro-grams rely on more advancedsoftware that can “run” in a virtualchip on a PC screen and ad-vanced hardware which commu-nicates with the program in thePC, reads input pins, andswitches output pins to match thelevels of the virtual chip. Such a

ging (ICD). This requires a chipwith special built in hardware(known as a “Background De-bugger”) and software whichcan communicate its status viaa serial link.

The chip is fitted to its work-ing printed circuit board (PCB)and all external hardware isconnected and active. Code isthen programmed, run, and de-bugged under PC control, until itis running correctly. For Mi-crochip PIC users, the goodnews is that the PIC16F877 andits close relatives the ’876, ’874,and ’873 have built in ICD facili-ties and can be used to develop

A real-time PIC In-Circuit Emulator (ICE), programmer,debugger, and development system

EPE ICEBREAKER by MARK STUART

system is called an In-CircuitEmulator or “ICE” and profes-sional systems are available forpractically every type of micro-controller.

The problem with this iscost. A professional ICE for thePIC series of chips costs a rea-sonable 2000 UK Pounds or so– not a lot if you are a profes-sional programmer being paidtwice that each month – butmore certainly enough to makeyour eyes water if you are anamateur!

Just lately a new type of de-velopment system has ap-peared called In-Circuit Debug-

LK1RE2

RC0

RC1

RC2

RC3

RC4

RC5

RC6

RC7

15

16

17

18

23

24

25

26

RD1

RD2

RD3

RD4

RD5

RD6

RD7

RD019

20

21

22

27

28

29

30

C210p

OSC 2

VSS(GND)

VSS(GND)

RA0

RA1

RA2

RA3

RA4

RA5

VDD(+V)

VDD(+V)

OSC 113

C110p

2

3

4

5

6

7

X120MHz

14

RB1

IC1PIC16F877

RE0

RE19

10

RB2

RB3

RB4

RB5

RB6

RB7

35

36

37

38

39

40

1

8

RB034

33

R1410k

0V (GND)

LK2

D75V1

D65V1

D85V1

R111k

R13470!

R1210k

PL1

+5V

a

k

a

k

a

k

MCLR11

32

12

31

16

59

Fig.1. Minimum circuit for using the PIC16F877 as a“background” debugger.

Page 25: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 184

code which can be run in theseand smaller chips in the range –such as the most popularPIC16F84.PIC IN-CIRCUITDEBUGGING

This article is intended as aneasy introduction to ICD with verysimple demonstration programs,users can then progress to usingthe more complicated features ofthe chips. It is not intended as aprogramming tutorial, but the op-eration of some programs is de-scribed in the course of demon-strating the ICD hardware.

Simple programs can beloaded, run and debugged withoutknowing much about the entireICD system which is extremelycomplicated and occupies manypages of the PIC data sheets.The Microchip web site(www.microchip.com) providesan enormous amount of informa-tion for those wishing to knowmore.

MINIMUM ICD SET UPThe minimum hardware re-

quired for ICD, using thePIC16F877, is shown in Fig.1.Communication to a computerserial port is achieved via thePort RB6 and RB7 pins of thechip, which cannot be used forother functions. As there areplenty of other port pins availablethis is not a significant limitation.

Port RB6 receives data fromthe computer, and RB7 transmitsdata to the computer. Both ofthese pins operate at simple 0Vto 5V logic levels. Some com-puter serial port output pins swing10V positive and negative, and solimiting resistors and 51V Zenerdiodes are used for protection.

The serial data sent back tothe computer should also be ca-pable of swinging 10V, but it hasbeen found that practically all

computers read serial data cor-rectly when 0V to 5V swings areused. A third connection linksthe serial port RTS output to theVPP or MCLR pin of the chip.This allows control of the pro-gramming voltage(programming at 5V, as op-posed to the 12V normally re-quired) and resetting of the chipby the computer.

After a Reset, the chipchecks if pins RB6 and RB7 areshorted to 0V. If they are, it ig-nores the ICD functions and justruns the code directly startingfrom location 0. Links fitted inthe positions marked LK enforcethis option.

As well as the hardwareconnections, the computerneeds to run a program to com-municate with the chip, and thechip must have a program tocommunicate with the com-puter. The program in the chipis loaded and copy-protectedinto the upper half of the chip’s8K program memory.

It may seem wasteful to usehalf of the chip’s memory forprotected code, but in practice,the 4K remaining is a vastamount of space for the PICprogram and it is very doubtfulthat it will ever be filled. Once

working code has been devel-oped and debugged it can beloaded and will run alone in anychip in the 16x range – the pro-tected communication code is re-quired only in the chip used fordebugging.

Connections for suitable se-rial leads are shown in Table 1.These are standard connections,but can be made up with 4-waycable (flat telephone cable isideal) if required. Take care whenmaking leads to get the pin num-bering correct – it is very confus-ing, the only safe way is to readthe molded numbers on the con-nectors.

The port connections for thePIC 16F877/874 and the alterna-tive connections for the 28-pinPIC16F876/873 versions of thechip are shown in Fig.2.

HARDWAREWhilst the minimum system

could be used, it is unlikely thatany PIC application would oper-ate without external hardware.Most systems have power sup-plies, input switches, output de-vices and so on. It is irritating andtime consuming to have to set upthese simple hardware require-ments when the object is to get a

Constructional Project

Page 26: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 185

program written and tested.EPE ICEbreaker was designedto include a number of input andoutput devices along with a sol-derless connection system sothat many applications could betested from a notebook PC with-out the use of a soldering iron.

The full ICEbreaker circuitdiagram is shown in Fig.3,whilst Fig.4 gives the PCB de-tails.

Resistors R11 to R13, andR14, Zener diodes D6 to D8 andlinks LK1/2 are the same as theminimum system. PL2 allowsthe power and computer con-nections to be extended so that

the PIC could be fitted into an-other board with other hardwareand still debugged via the samecomputer lead.

Voltage regulator IC2 allowsa range of power adapters to beused connected to 21mm powersocket SK5. Links 3 and 4 allowpositive inner or outer connec-tions to be set. If accidentalpower reversal is possible, thepositive link connection can bemade using a 1A diode (e.g.1N4001) instead of a piece ofwire. Power is indicated by light-emitting diode (LED) D5 via resis-tor R8.

Switch S1 provides an alter-native hardware reset which canbe useful for stopping programsquickly and for restarting fromlocation 0.

For ICD operation the PICneeds accurate timing. A 20MHzcrystal X1 together with capaci-tors C1 and C2 provide the stan-dard oscillator components. Alter-native positions (X2) and (C3, C4)are to be used with 28-pin chips.

Resistors R15 and R16 allowRC oscillator options to be used ifrequired for testing or runningfully debugged code, but as RCoscillator stability is poor, this op-

tion is not recommended forICD use. Other crystal frequen-cies can be used and the com-puter serial port speed alteredaccordingly. 20MHz gives thefastest communication (38,400BAUD) and is best if there areno other special frequency re-quirements.

Stepping motor driving is avery popular PIC application.Transistors TR1 to TR4 and as-sociated resistors R2 to R5 andprotection diodes D1 to D4 pro-vide four open collector driversfor four-phase unipolar motors.Connectors PL3 and PL4 allowfor 254mm and 2mm pitch mo-tor connectors. Input to thedrivers is via SK4. The transis-tors can also be used individu-ally as simple open-collectornpn switches for driving relays,lamps and similar loads up to24V and 400mA.

Two other output transistorsare fitted. TR5 is a simple opencollector npn device and TR6drives a double-polechangeover relay RLA. Thesetwo devices are useful for bidi-rectional control of a DC motor.RLA can be wired as a revers-ing switch and the motor can be

Constructional Project

ICE9-way to 9-way

Computer1235

73 TxD2 RxD5 GND

ICE9-way to 25-way

Computer1235

42 TxD3 RxD

7

Table 1: Serial LeadConnections.

7

8

9

6

10

11

12

13

1

2

3

4

5

15

14

16

17

18

19

20

40

39

38

37

36

35

34

33

32

31

30

29

28

27

26

25

24

23

22

21

7

8

9

6

10

11

12

13

1

2

3

4

5

1514

16

17

18

RA2/AN2/VREF

RA2/AN2/VREF

RA3/AN3/VREF

RA3/AN3/VREF

MCLR/VPP/THV

MCLR/VPP/THV

GND/(VSS)

GND/(VSS) RB1

RB1

RB2

RB2

RB3/PGM

RB3/PGM

RA1/AN1

RA1/AN1

RA0/AN0

RA0/AN0

OSC1/CLK IN

OSC1/CLK IN OSC2/CLK OUT

OSC2/CLK OUT

GND(VSS)

GND(VSS)

RD7/PSP7

+VE(VDD)

+VE(VDD)

+VE(VDD)

RB7/PGD

RB7/PGD

RB6/PGC

RB6/PGC

RB5

RB5

RB4

RB4

19

20

21

22

23

24

25

26

27

28

RA5/AN4/SS

RA5/AN4/SS

RE0/RD/AN5

RE1/WR/AN6

RE2/CS/AN7

RA4/TOCKI

RA4/TOCK1

RC0/T1OSO/T1CKI

RC0/T1OSO/T1CKI RC1/T1OSI/CCP2

RC1/T1OSI/CCP2 RC2/CCP1

RC2/CCP1 RC3/SCK/SCL

RC3/SCK/SCL

RD0/PSP0

RD1/PSP1

RC4/SDI/SDA

RC4/SDI/SDA

RC5/SDO

RC5/SDO

RC6/TX/CK

RC6/TX/CK

RC7/RX/DT

RC7/RX/DT

RD4/PSP4

RD6/PSP6

RD2/PSP2

RD3/PSP3

RD5/PSP5

RB0/INT

RB0/INT

PIC16F876 AND 873

PIC16F877 AND 874

Fig.2. Port connections for the PIC16F877/874 and the alternative 28-pin PIC16F876/873.

Page 27: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 186

turned on and off by TR5.Many applications require

display of information, and anintelligent LCD module is anideal display device. X3 hasstandard 4- or 8-bit drive capa-bility, and requires a minimumof six output lines for driving. Allpins are available at connectorSK1. Preset VR1 allows thecontrast of the LCD to be al-tered to suit the lighting condi-tions and viewing angle.

Just two input devices arefitted. S2 and S3 are simplesingle-pole push-to-makeswitches with pull-up resistorsR6 and R7.

Whilst the circuit diagramseems simple, the PCB layoutshows that there are far moreconnection points, and that aprototyping area with a solder-less breadboard is provided.Each side of the main inte-grated circuit (IC) sockets thereare spaces for rows of turned-pin sockets. The inner two rowsconnect to the adjacent IC pins,whilst the outer two rows arepower and ground connections.

Turned-pin socket strips canbe fitted in all rows, but it ismore practical to have a singlerow of sockets each side of thechip and leave the other spacesblank so that pull up or pulldown resistors can be solderedin position if required. An addi-tional “patch” area is providedbelow IC1 and is ideal foradding “permanent” hardwaresuch as LEDs or presets.

ICEBREAKERSOFTWARE

ICEbreaker must be runfrom a PC with at least Win-dows 95. This helps keep thesoftware simple, and is not aserious restriction as PCs thatcan run Win95 are available at

Constructional Projectvery low prices. A standardPentium 133 without specialsound, graphics or multimediais more than adequate providedit has a spare serial port (COM1 – 4).

The software is designed tobe run in conjunction with Mi-crochip’s MPLAB software. Thisis available from many sources– the Microchip web site is theideal one as it allows the verylatest version to be loaded, al-ternatively the Microchip CD-ROM is widely available andgood for those without internetaccess.

MPLAB is used in “editoronly” mode to allow assemblylanguage source code to bewritten and then assembled toproduce the necessary .HEXcode for programming into thechip. MPLAB also produces a.COD file which is used by theICEbreaker software to keeptrack of the program executionwhen debugging, single step-ping and running the program.Like many other PC programs,MPLAB has a lot of featuresthat are not regularly used, how-ever the advanced featuresdon’t get in the way when usingit at the simple level required byICEbreaker.

The ICEbreaker software isa simple stand-alone applicationthat can be run directly from afloppy disk if necessary. Thisarticle assumes that the con-tents of the ICEbreaker disk arecopied into a new folder(directory) on the C-drive, whichhas been labeled “icebreak”.The only files required are ice-break.exe and icebreak.ini, butit is also convenient to storeprogram files in the same direc-tory.

ICEbreaker and MPLABshould be run together, and the“Alt” and “Tab” keys or thetaskbar buttons used to switch

from one to the other.

CONSTRUCTIONThe EPE ICEbreaker

printed circuit board componentlayout and (approximately) fullsize copper foil master areshown in Fig.4. This board isavailable from the EPE OnlineStore (code 7000257) fromwww.epemag.com

Assembly of the board isstraightforward. Begin by fittingseven 12mm pillars with shortM3 screws before adding anycomponents. Refer to the com-ponent layout drawing and thenfit plain uninsulated wire links inall of the positions shown. Fittwo-way pin headers in the posi-tion for LK1 and LK2 so that twoshorting links can be connectedif required.

Links LK3 and LK4 providethe facility to set the input powersocket for positive or negativeinner connection. For positiveinner fit the links in position B,for negative fit them in positionA. As mentioned previously it ispossible to add a diode in placeof one of the links to protectagainst polarity reversal. To dothis, fit the cathode of the diodeto the point marked with a +sign, and the anode of the diodeto the appropriate A or B posi-tion.

Fit the diodes and resistorsnext, taking care to identify thetype and polarity. Usually thecathodes are marked with ablack or dark blue band, whichshould be positioned to matchthe line on the component lay-out diagram. The transistorsTR1 to TR6 are all the sametype and are fitted with theircurved sides as shown in thediagram. They should be fittedclose to the board surface sothat they cannot get bent and

Page 28: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 187

Constructional Project

bc e

bc e

bc e

bc e

bc e

bc e

RLA 2

OU

T

CO

M.

INIC

27805

C6

100

nC

5100

n

RLA

2

RLA

1

TR

6ZTX

451

NC

1

PO

LE 1

NO

1

NC

2

PO

LE 2

NO

2

SK

5

PO

WE

RIN

PU

T

LK3/4

SK

6

14(

10)

13(9

)

L.C

.D.

CO

NN

EC

TIO

NS

STEP

PIN

GM

OTO

RC

ON

NEC

TIO

NS

R3

R2

220

!22

0 !220

!220

!

D1

30V

TR

1ZTX

451

ak

R4

PL4

D2

30V

TR

2ZT

X45

1

k a

LK5

LK6

PL3D

7D

6

D3

30V

TR3

ZTX

451

k aR

5

C1 (

C3)

10p

C2 (

C4)

10p

16 x

2 L

.C.D

. D

ISP

LAY

1413

1211

109

87

65

4

X3

R6

4k7

S2

CO

NTR

AS

T

R1

4k7

SK

1

D5

D4

D3

D2

D1

D0R/W

RS

E

32

1

VR

110

k

X1

(X2)

20M

Hz

R15

(R16

)

R7

4k7

R8

1k

D5

L.E.D

.

S3

ka

D7

5V

1

P4

P1

P2

P3

MC

LR

RE

SET

STE

PP

ER M

OTO

RD

RIV

ER

IN

PU

TS

TR4

ZTX

451

30V

k a

ZTX

451

D4

30V

0V

12/3

1(8

/19)

SK

4S1

LIN

K F

OR

FR

EE

RU

NN

ING

1(1)

TR

AN

SIS

TO

RC

OLL

EC

TO

R

TR

5ZTX

451

SK

7/T

C

R9

470!

470 !

TR

AN

SIS

TO

RBA

SE

D8

5V1

ak a

D9

1N40

01

SK

7/R

D

R10

k a

RE

LAY

DR

IVE

R

RB

7

RB

6

OS

C1/

CLK

IN

OS

C2/

CLK

OU

T

+V

11/

32(2

0)

PIC

16F

876

/873

PIC

16F87

7/8

74

IC1

PU

SH

BU

TTO

NC

ON

NE

CTIO

NS

LK

1

39(2

7)

40(2

8)

PL2 LK

2

D6

5V1k a

k

R12

10k

R13

470

!

R11 1k

PL1

R14

10k

1 5

6 9+5V

SK

2

SK

3

1C

23

C4

*

* SE

E T

EXT

+5V

MC

LR0V

B7

B6

SK

7/TB

0V

Fig.3. Complete circuit diagram for the EPE ICEbreaker.

Page 29: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 188

moved around when the boardis handled.

Use turned-pin socket stripsfor the 40 and 28-way IC posi-tions, and position a second rowof sockets alongside. Note thatthere is also the option of anarrow-bodied version of the28-pin device, and holes havebeen drilled to allow for this typeto be used. If required, socketstrips can be fitted for bothtypes without causing any diffi-culty. Also fit turned-pin socketstrips for SK1, SK2, SK3, SK4,SK6, and the three connectionsTB, TC, and RD. Also fit two 13-way strips to the upper andlower rows of the patch area –these are the positive and nega-tive “rails” and make very con-venient connection points fortaking power to the breadboard.

Fit pin headers for PL2, PL3and PL4 – the holes for theseare made tight to give extrasupport and so the pins mayneed pressing home against ahard surface. Fit push-switchesS1, S2 and S3, preset VR1, re-lay RLA and the voltage regula-tor IC2; an M3 screw and nutshould be used to secure thetab. A heatsink is not requiredfor most applications, but thereis space to fit a low profile type,or even a small piece of alu-minum if higher current loadsare to be used.

The 20MHz crystal and itsassociated capacitors C1 andC2 should be fitted if the (usual)40-pin device is being used forIC1. If a 28-pin version is usedthen fit these components to thealternative locations X2, C3 andC4. If both types of device maybe used, it is possible to fit twocrystals and two pairs of capaci-tors.

DISPLAY MODULEThe LCD module fits above

the board on 16mm long 6BA orM2.5 screws. Fit the four screwsfrom the track side of the boardand secure them with nuts. Fitfour more nuts and positionthem equally so that the LCDlies level and approximately10mm from the board. The con-nections to the LCD are madeto allow it to be unplugged foraccess to IC2 and for use inother applications.

Fit a 16-way pin-to-pin con-nector to the board, with theslightly thinner pins upwards. Fit(but do not solder) a 16-waywirewrap turned-pin socket stripto the LCD so that the socketsface downwards and plug ontothe pin-to-pin connector. Makesure the LCD is level, solder thewire wrap pins to the LCD andcut off the excess. The LCD cannow be secured by fitting an-other four nuts.

The serial port connectorPL2 and power connector SK5fit directly onto the board. Makesure that they are pressed fullyhome before soldering.

The solderless breadboardis secured to the board simplyby its self-adhesive backing.

Make sure that it is accuratelypositioned (and the right wayup) before pressing it firmly intoplace.

TESTINGOnce the hardware has

been assembled and before fit-ting IC1, check for dry joints,solder bridges and componentpolarities.

Once everything looks cor-rect, connect the power supply.Check that D5 lights and, if ameter is available, check the 5Vregulated supply. The LCD con-trast control VR1 should alterthe density of a single top rowof block characters as the LCDinitializes itself for one-linemode.

Switch off, insert IC1 andconnect a suitable lead betweenSK1 and the serial port of thePC, which has MPLAB and theICEbreaker software (see theShoptalk page) installed.

SOFTWAREINITIALISATION

Constructional Project

Display module removed from the PCB to reveal the regulatorIC mounted underneath.

Page 30: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 189

Constructional Project

R14D6 R11

R12R13

PL1

D7 D8

PL2

LK1LK2

S1

RESET SK5B6 B7 0V

MCLR+5V

IC1

IC1

R7

R6

S3

S2

SK3 SK2

P1P2

P3P4

R2

R3

R4

R5TR4

TR3

TR2

TR1PL3

PL41C

23

C4e b c

e b c

e b c

e b c

X1R15

C1

C2

D5

C4

R8

R16

C3

X2

VR1

a

k

D1

D2D3

D4

akak

akak

akTR5

TR6R9

R10

D9

RLA2

SK6

SK1

NC2

NO2NC1

P1

P2

NO1RLA1

RLA2

e

eb

bc

c

COIL

D7

D6D5D4

D3D2

D1

D0E

R/WRS

RDTB

TC

a

a a

k kk

R1

IC2

INCOM.

OUT

LCD DISPLAYX3

C5

C6

LK3/4A

A

B

B

LK5

257

ICEBREAKER

9

5

6

1

SK4

(40-PIN)

(28-PIN)

SK7

14 1

POWER IN

Fig.4. Printed circuit board component layout and (approximately) full-size copper foilmaster pattern.

Page 31: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 190

Run MPLAB, select the “project” tab and then“new project”. In the directory box select c:\ ice-break and set up a project named ib.prj and editthe project so that it contains the simple test pro-gram ib1.asm which is included on the ICEbreakerdisk. Close the “Project Edit” window then select“File” and ib1.asm. This will open the ib1.asm fileon the MPLAB screen.

Next select “Project” and “Make project”. Thiswill then run the MPASM program and produce

files called ib1.lst, ib1.hex, ib1.cod, and ib1.err inthe icebreak directory. The ib1.err file will contain afew warning messages, which can be ignored.

Leave MPLAB running, but minimize it by click-ing on the appropriate box. Open the icebreak fileand double click on icebreak.exe to start the pro-gram. The screen will display the main ICEbreakerwindow as shown in Fig.5, and possibly the Watchand Source windows (Figs. 7 and 8). In the main ICE-breaker window click on “Options” and then select“Programmer” this will produce the communicationsset up box shown in Fig 6. In this box set up the serialCOM port that you are using. If a 20MHz crystal isfitted the Baud box must be set to 38400. Other crys-tal frequencies can be used and the Baud rate ad-justed proportionally – e.g. a 5MHz crystal would op-erate at 38400/4 or 9600 Baud. Once set up close thebox by pressing OK.

Back in the mainbox select “File” and“Open”, which will re-veal a standard file se-lect dialog window list-ing the files in the ice-break directory. Selectand load ib1.asm andthen open the sourcecode window by select-ing ‘Window’ and then‘Source’. The windowshould contain theib1.asm source file withnumbered lines asshown in Fig.7.

Before the programcan be run it must besent to IC1 by selecting

Constructional Project

COMPONENTS

See also theSHOP TALK Page!

$60Approx. Cost Guidance Only

ResistorsR1, R6, R7 4k7 (3 off)R2 to R5 220 ohms (4 off)R8, R11 1k (2 off)R8, R10, R13 470 ohms (3 off)R12, R14 10k (2 off)R15, R16 See text

All 0.25W 5% carbon film

CapacitorsC1 to C4 10p ceramic, 2.5mm pitch (4 off), see textC5, C6 100n multilayer polyester (2 off)

SemiconductorsD1 to D4 30V 400mW Zener diodes (4 off)D5 3mm low-current red LEDD6 to D8 5.1V 400mW Zener diodes (3 off)D9 1N4001 diodeTR1 to TR6 ZTX451 npn transistors (6 off)IC1 PIC16F877P20 microcontroller, pre-programmedIC2 7805 voltage regulatorX1 (X2) 20MHz low-profile crystal (see text)X3 16x2 alphanumeric LCD module

MiscellaneousSocket strips to make up the following: 11-way (SK1); 1-way (SK2, SK3 -- 2 off); 4-way (SK4); 6-way (SK6)SK5 2.1mm PCB power connectorS1 to S3 s.p.s.t. push-to-make switches (3 off)RLA d.p.c.o. 5V coil relay (BT47)

PCB available from the EPE Online Store code 7000257(www.epemag.com); breadboard; 9-way 90o male D-typeconnector (PL1); 6-way 0.1in. pin header (PL2, PL4 -- 2 off);6-way pin strip, 2mm pitch (PL3); 2-way 0.1in. pin headerwith DP link plug (2 off -- LK1, LK2); socket strips, 20-way(4 off), 14-way (2 off), 13-way (2 off); 16-way pin-to-pin stripfor LCD; 16-way long-pin socket strip for LCD.

Hardware: 12mm M3 HEX pillars (7 off); M3 screw x 6mm(7 off); screws CSK (4 off) and 12 nuts (6BA or M2.5) forLCD mounting.

PotentiometerVR1 10k carbon preset

Layout of components on the completed EPEICEbreaker PCB.

Fig.5. Main ICEbreakerwindow.

Page 32: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 191

“Program” and then “Program”in the main ICEbreaker window.A progress bar appears andICEbreaker sends the programto the first 4K of the programmemory in IC1. Once this iscompleted, it should be possibleto step, run, and reset the codeone line at a time using the“Step” button in the main win-dow. In single step mode, ateach step, a highlight line pro-gresses through the sourcecode window, and the main ICE-breaker window shows the Pro-gram Counter, the contents ofthe W register and the Statusregister bits.

Sometimes the highlightdoes not track the source codeexactly, and is one line aboveor below the current line. This isdue to the communications be-tween the computer and IC1and depends upon the waysome of the source code is writ-ten; it is only a minor inconve-nience as the actual line of codeis easily worked out from theprogram counter in the ICE-breaker main window.

Other registers may be setup in the “Watch” window – se-lect “Windows”, “Watch” in themain window. Fig.8 shows themain Watch window and Fig.9the “Add” window. Registersmay also be “Watched” by set-ting the first location and enter-ing the number of registers in

the “Array” box.The selector box in the

“Watch Add” window allows achoice of locations, labels andregisters to be selected. It is im-portant to understand that someof these options are not whatthey seem, for example the Woption returns not the value ofthe W register, but the number0 which has been assigned tothe label W in the fifth line ofthe source code.

TESTING APROGRAM

Once some familiarity hasbeen achieved with the ICE-breaker windows, it is time toconnect some hardware andsee how it operates. As with allgood microcontroller hardwaresystems, the first thing to do isflash a LED! The ib1.asm pro-gram counts up throughPORTA, which is set to outputmode, and so all that is neces-sary is to connect a LED frompin 2 of IC1 via a current limit-ing resistor (anything from100 to 2k2) to 0V.

Using solid core 1/0·6 con-necting wire links it is an easymatter to put the LED and resis-

tor on the breadboard andmake the two connectionsto the turned-pin socketstrips. The row of 13 sock-ets at the bottom of thepatch area is a good placeto find 0V. Provided theprogram has been set upcorrectly and loaded intoIC1, the LED should flashwhen the program is set to“Run”.

In order to flash theLED slowly, the programhas three nested countingloops. To single step

through them would take years,and so it is impractical to goright through all of the states ofPORTA. The alternative to sin-gle stepping is to insert a break-point and run the program tothere.

Select “Options”,“Breakpoint” from the main ICE-breaker window and set thevalue to 24. Fig.10 shows the“Breakpoint” setting window. En-tering a breakpoint highlightsthe line in the “Source” window.“Reset” and then “Run” the pro-gram and it will now stop at thebreakpoint. Press run again andit will loop again to the samebreakpoint – each time incre-menting the value at PORTA sothat the LED on PORTA 0 turnson and off alternately. Try con-necting the LED to IC1 pin 3PORTA 1 and see that itswitches every other loop.

Now that a LED can beflashed, it is just a few moresteps to controlling all sorts ofperipheral devices, and whilstthe PIC16F877 cannot run theproverbial “Power Station” it iscapable of an amazing numberof very complicated feats. Thedevelopment of longer pro-grams controlling more hard-ware is so much easier when itis possible to test the programs

Constructional Project

Fig.6. Setup box.

Fig.7. Source file window.

Page 33: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 192

quickly in this way. Single step-ping and watching the programand data registers allows evencomplicated routines to betested and debugged, and sim-ple changes can be made andchecked immediately.

To make a simple changeto the ib1 program, select“Program”, “Code” from the ice-breaker main menu and thenselect location 14. The contentscan be read and should be30FF, which means MOVLWFF. Modify the value to 3010which will load the value 10 in-stead of FF and press the“Write” button. Clear the break-point, “Run” the program, andsee the change in speed.

The program in IC1 hasbeen modified, but rememberthat the Source Code has not,and so will need changing to thenew value once the requiredspeed has been set. To modifythe source code run MPLAB,modify ib1.asm, recompile thecode by selecting “Project”,“Make project” (or by pressingthe appropriate shortcut button)and then switch back to ICE-breaker .

Select “File”, “Reopen” andthe modified source code willappear in the ICEbreaker“Source” window. To completethe operation select “Program”,“Program” and the new code willbe loaded into IC1. Although theprogram in IC1 had alreadybeen modified, it is always goodpractice to reprogram with thenewly compiled code to preventsimple errors creeping in – es-pecially when a number of mod-ifications might have beenmade.

As well as changes to theprogram memory, the sameprocedure can be used to mod-ify the EEPROM, and register

files. Changing register file con-tents is particularly useful whencombined with single stepping,as it allows routines to be testedwith a range of values, for ex-ample a timing loop can be setup with 00 in the loop countingregister and single stepped tosee what happens at the end ofthe loop.

Once experience is gained,the range of tools available willbe understood, and it will be-come easy to set up and checksimple routines and combinethem into full programs.

OTHER PROGRAMSProgram ib2.asm is a sim-

ple driver for the stepping mo-

tor. Connect PORTA 0 to 3 tothe four stepping motor drivesockets P1 to P4 and then fol-low the procedures used forib1.asm to compile, load andrun the program. Notes are in-cluded in the code suggestingmodifications that can be madeto the code for altering speed,direction, and duration of travel.

Program ib3.asm runs theLCD. It uses six connectionsfrom PORTC 2 to 8 to connectto RS, E, and D4, 5, 6, and 7 ofthe display in that order. Thecode initializes the display, andthen can be set up as a subrou-tine to write any character toany display location. The sourcecode has notes to explain theoperation and to suggest possi-ble changes for more advancedapplications.

COMPLETEDPROGRAMS

Once a program has beendebugged and is working cor-rectly, it can be programmedinto another PIC16F877 or anyother suitable PIC chip using anappropriate programmer (PICToolkit Mk2 from the May andJune issues of EPE Online isideal – www.epemag.com/0599p1.htm). The ICEbreakercode does not have to be in thechip and so any blank chip canbe used with this method. TheICEbreaker board can only pro-gram chips that already containthe special icebreak code – thisis necessary because the chiphas to communicate with thePC via the standard serial portinterface. Chips with icebreakcode are readily available – seethe Shoptalk page.

Once programmed, ICE-breaker chips will run normallyin other circuits if required to do

Constructional Project

Fig.8. ICEbreaker “Watch”window.

Fig.9. ICEbreaker “WatchAdd” window.

Fig.10. ICEbreaker“Breakpoint” window.

Page 34: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 193

so but it is important to makesure that the two pins RB6 andRB7 are connected to 0V. Thisis because the ICEbreaker soft-ware automatically starts to run,and immediately checks forground connections on thesepins. If it finds that they aregrounded, the program jumps tolocation 0000 and starts runningthe program from there, as anormal chip would.

THE NEXT STEPSIt is tempting to continue

and describe the many featuresof the PIC16F877, but it really isan impossible task because thechip is so powerful (see also ourPIC16F87x Mini Tutorial in theOct ’99 issue of EPE Online).The beauty of the PIC range ofdevices is that it is possible torun the same code on many dif-ferent chips.

EPE ICEbreaker allows pro-grams that are intended to berun on much simpler chips to bechecked and debugged. All thatis necessary is to ensure thatthe ports and register addressesare compatible with the smallerchips. Applications for thePIC16F84 are particularly suit-able for development using ICE-breaker, and so the programspreviously published by EPEcan be used. Note though thatthe MPLAB environment usesMPASM code, and so the PICToolkit Mk2 software will benecessary to convert the origi-nal TASM source code toMPASM assembly language.

ICEbreaker provides an ad-vanced way to learn program-ming. Along with the PIC pro-gramming and data sheets andback issues of EPE, it will be-come an indispensable tool forlearning, development, and test-ing of PIC projects.

Constructional Project

Page 35: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 196

Memory is one of thecrucial elements in today’stechnology. There have beenmany improvements in diskbased technology over recentyears, but there are similarlevels of progress taking placein the memory more directlyassociated with the CPU itself.

To illustrate this, it was lessthan thirty years ago whenferrite core memory was used.Fortunately this was supersededby electronic forms of memorywhen the levels of integration ofcircuits grew to a sufficientdegree to allow them to beused.

Now there are a variety ofdifferent forms of memory thatcan be used dependent uponthe exact requirement thatneeds to be fulfilled. SRAM,DRAM, EPROM, EEPROM anda variety of others includingFlash memories are available,each having their own forte andarea where they perform to theirbest.

However, if it were possiblefor only one type of memory tobe used, then this could lead tomore efficient use of thecircuitry, and possible costsavings. For this to be feasible,an all-purpose, yet low costmemory would need to beavailable, and this may be justaround the corner because anew technology is about to hitthe market.

Known as magnetoresistance random accessmemory, or MRAM, the newmemory is creating significantinterest in the semiconductor

industry. It is a non-volatile formof random access memoryclaimed to be faster than Flash,which will be its maincompetitor when it is launchedonto the market. However, asprices fall and MRAM gainswider acceptance it is likely thatit will be used in many morememory applications.

SPECIFICATIONSFor a given speed and

geometry the new MRAMtechnology consumes lesspower and this is a particularlyimportant factor in today’stechnology where many itemsare battery powered. The powerreduction also means that thepower supply requirements forthe unit as a whole may bereduced, and this can reflect ina decrease in costs – all-important in today’s fiercelycompetitive marketplace.

As the speed of the newdevices is faster than Flash, thistoo is another selling point asthe speed of flash devices canbe such that it impacts on theoperation of the whole unit.Although not much faster at the

moment, improvements areanticipated that will give thenew technology a significantadvantage.MRAM has further advantages.It does not suffer from the wearout mechanism experiencedwith Flash devices. Althoughgreat improvements have beenmade in this area with Flashdevices, they still have a limitedlife and this means that theycannot be used in high usageareas of a computer’sarchitecture.

OPERATIONThe operation of the new

memories is based around astructure known as a magnetictunnel junction (MTJ). Thesedevices consist of sandwichesof two ferromagnetic layersseparated by thin insulatinglayers.

A current can flow acrossthe sandwich arising from atunneling action and itsmagnitude is dependent uponthe magnetic moments of themagnetic layers. These layerscan either be the same, whenthey are said to be parallel, or inopposite directions when theyare said to be antiparallel.

Magnetic tunnel junctionscomprise sandwiches of twoferromagnetic (FM) layersseparated by a thin insulatinglayer which acts as a tunnelbarrier (Fig.1). In thesestructures the sense currentusually flows parallel to thelayers of the structure, while thecurrent write is passedperpendicular to the layers ofthe MTJ sandwich.

IAN POOLE INTRODUCES THE MRAM, WHICH (IT IS HOPED) WILL POSE A REALTHREAT TO “FLASH” MEMORIES AND OTHERS.

TOP LEAD

FREE FERROMAGNET

TUNNEL JUNCTION

PINNED FERROMAGNET

ANTIFERROMAGNET

SEED LAYER

BOTTOM LEAD

SUBSTRATE

Fig.1. Structure of anMRAM cell.

Page 36: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 197

The resistance of the MTJsandwich depends on thedirection of magnetism of thetwo ferromagnetic layers.Typically, the resistance of theMTJ is lowest when thesemoments are aligned parallel toone another, and is highestwhen antiparallel.

To set the state of thememory cell a write current ispassed through the structure.This is sufficiently high to alterthe direction of magnetism ofthe thin layer, but not the thickerone. A smaller non-destructivesense current is then used todetect the data stored in thecell.

CONSTRUCTIONA wide range of structures

and materials have beeninvestigated to obtain theoptimum structure. In view ofthe potential of the newtechnology a number ofmanufacturers are investigatingdifferent approaches. Motorola,IBM and many others all believethere is a future for the newidea.

IBM have fabricatedjunctions using computer-controlled placement of up toeight different metal shadowmasks. The masks weresuccessively placed on any oneof up to twenty 25mm diameterwafers with a placementaccuracy of approximately 40um. By using different masks,between 10 to 74 junctions of asize of approximately 80 x80um2 could be fashioned oneach wafer.

The tunnel barrier wasformed by in-situ plasmaoxidation of a thin aluminumlayer deposited at ambienttemperature. Using thistechnique, large levels of

variation in resistance due tomagnetoresistive effects wereseen. Investigations into thedependence of MR on theferromagnetic metalscomprising the electrodes weremade.

It was anticipated that themagnitude of the MR wouldlargely be dependent on theinterface between the tunnelbarrier and the magneticelectrodes. It was found thatthick layers of certain non-ferromagnetic metals could beinserted between the tunnelbarrier and the magneticelectrode without quenching theMR effect. However, the MRwas quenched by incompleteoxidation of the aluminum layer.

OTHERDEVELOPMENTS

IBM is not the onlymanufacturer investigatingthese structures. Apart fromMotorola, IMEC, Europe’sleading research center for thedevelopment and licensing ofstate-of-the-art microelectronicstechnologies, is also makingsignificant developments withMRAM technology.

They have succeeded indeveloping a demonstrationMRAM matrix cell array with aDRAM style of architecture.This brings MRAM technology astep closer to the production ofa viable alternative to theexisting non-volatile memory.The memories produced in thisdevelopment used a similarstructure to that employed byIBM, i.e. two magnetic layersseparated by an insulatinglayer.

Bit-selective addressingwas based around a GaAsdiode. The GaAs technologywas selected because of its

flexibility and tolerance relativeto silicon.

In the next stage ofdevelopment it is hoped to usea silicon diode or transistor toreduce the fabrication costs.This will bring the final versionnearer and ensure that its unitcosts will be such that it caneffectively compete withexisting technologies.

The new MRAM technologyis an exciting development thatcould revolutionize currenttrends in electronic memory.The migration from magneticcore memory in the early 1970sproved to be a major stepforwards. Now the introductionof MRAMs could provide similarlevels of benefit.

New technology Updates

Page 37: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 198

The purpose of this series isto review how we came to bewhere we are today (technology-wise), and where we look likeending up tomorrow. Our firststep is to cast our gaze into thedepths of time to consider thestate-of-the-art as the world waspoised to enter the 20th Century.

In Part 1 we consideredphysics, electronics, andcommunications prior to 1900. Inthis installment we shallfirst examine the state ofcomputing prior to 1900.We shall then turn ourattention to the keydiscoveries infundamental electronicsthat occurred in the 20thCentury.

COMPUTINGPRIOR TO 1900

The first tools used asaids to calculation wereman’s own fingers. Thus,it is no coincidence thatdigit refers to a finger (ortoe) as well as anumerical quantity.Similarly, small stones or pebblescould be used to represent largernumbers than fingers and couldalso store intermediate results forlater use. This explains whycalculate is derived from the Latinword for pebble (calculus).

special words like dozen(meaning 12) and gross(meaning 12 x 12). The fact thatwe have 12 months in a yearand 24 hours in a day (2 x 12)are also related to these base-12 systems.

However, the numbersystem with which we are mostfamiliar is the decimal system,which is based on ten digits: 0,1, 2, 3, 4, 5, 6, 7, 8 and 9. Thename decimal is derived fromthe Latin decam, meaning ten.As this system uses ten digits, itis said to be base-10 or radix-

10, where the term radixcomes from the Latinword meaning root.

THE ABACUSThe first actual

calculating mechanism(at least that we know of)is the abacus. Someauthorities hold that thefirst abacus wasinvented by theBabylonians sometimebetween 1,000 BC and500 BC, but othersbelieve that it wasactually invented by theChinese.

Although the abacusdoes not qualify as amechanical calculator, itcertainly stands proud as one offirst mechanical aids tocalculation.

THE SLIDE RULE

TECHNOLOGY TIMELINESPart 2 - DAYS OF LATER YOREby Alvin Brown and Clive “Max” Maxfield

DECIMAL NUMBERSYSTEM

Throughout history, humanshave experimented with avariety of different numbersystems. For example, theancient Babylonians used abase-60 system, which is whywe have 60 seconds in a minuteand 60 minutes in an hour.Some people used their fingers

and their toes for counting, sothey ended up with base-20systems, which is why we stillhave special words like score,meaning twenty.

Similarly, some groupsexperimented with base-12systems, which is why we have

Boldly going behind the beyond, behind which no onehas boldly gone behind, beyond, before!

Napier’s Bones, simple multiplication tables in-scribed on wood or bone. John Napier went on

to invent logarithms. Courtesy of IBM.

Page 38: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 199

In the early 1600s, Scottishmathematician John Napierinvented a tool called Napier’sBones. These were simplemultiplication tables inscribedon strips of wood or bone.Napier also invented theconcept of logarithms, whichwere used as the basis for theslide rule by the Englishmathematician and clergymanWilliam Oughtred in 1621.

The slide rule was anexceptionally effective tool thatremained in common use forover three hundred years.However, like the abacus, theslide rule does not qualify as amechanical calculator in themodern sense of the word.

REDISCOVEREDNOTEBOOKS

Leonardo da Vinci was agenius: painter, musician,sculptor, architect, engineer,and so forth. It is well knownthat he sketched conceptdesigns of such futuristicdevices as tanks andhelicopters, but until quiterecently there was no indicationthat he had ever turned hismind to mechanical calculation.

However, two of da Vinci’snotebooks dating from aroundthe 1500s were rediscovered in1967. These priceless tomescontain a wealth of drawings,some of which may represent a

mechanical calculator (see Part1). Working models of amechanical calculator looselybased on these drawings havesince been constructed,although some people believethe reconstruction is far moresophisticated than anythingLeonardo had in mind.

FIRST MECHANICALCALCULATOR

Sometime around1625, theGermanastronomerandmathematician WilhelmSchickardwrote a letter to a friend statingthat he had built a machine that“… immediately computes thegiven numbers automatically;adds, subtracts, multiplies, anddivides’’. Unfortunately, theoriginal machine was destroyedin a fire, but working modelshave since been constructedfrom Schickard’s notes.

ARITHMETICMACHINE

For reasons unknown, manyreferences ignore Schickard’sdevice and instead credit theFrench mathematician, physicist

and theologian, Blaise Pascalwith the invention of the firstoperational calculating machine.In 1642, Pascal introduced hisArithmetic Machine, which couldadd and subtract numbers(multiplication and divisionoperations were implemented byperforming a series of additionsor subtractions).

STEP RECKONERMechanical calculation was

taken a step further in the 1670sby a German Baron calledGottfried von Leibniz. Afterreceiving his bachelor’s degree atseventeen years of age, Leibnizdeveloped Pascal’s ideas and, in1671, introduced the StepReckoner. In addition toperforming additions andsubtractions, the Step Reckonercould multiply, divide, and

evaluate square roots.The mechanical calculators

created by Pascal and Leibnizwere the forebears of today’sdesktop computers, andderivations of these devices werein widespread use for over twohundred years until theirelectronic counterparts finallybecame available and affordablein the early 1970s.

FIRST MECHANICALCOMPUTER

In the 1800s, books ofmathematical tables such as

Special Feature

A modern construction of a mechanical calculator in-spired by a drawing in one of Leonardo da Vinci’s note-

books. Courtesy of IBM.

Blaise Pascal’s Arithmetic Machine. Courtesy of IBM.

Page 39: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 200

logarithmic and trigonometricfunctions were in great demandby navigators, engineers, andso forth. Such tables weregenerated by teams ofmathematicians working dayand night on derivatives of theprimitive mechanical calculatorsinvented by Pascal and Leibniz.These mathematicians werereferred to as computersbecause they performed all thecomputations.

In 1822, the eccentricBritish mathematician andinventor Charles Babbageproposed building a machinecalled the Difference Engine toautomatically calculate thesetables.

Babbage had only partiallycompleted the DifferenceEngine when he conceived theidea of a much moresophisticated machine called anAnalytical Engine. (This is oftenreferred to as Babbage’sAnalytical Steam Engine,because he intended for it to bepowered by steam).

The Analytical Engineincluded many concepts thatwould eventually be featured in

modern computers,including a processingunit that could changethe flow of a programdepending on the resultsof previouscomputations. Babbageworked on the AnalyticalEngine from around1830 until he died in1871, but sadly it wasnever completed in hislifetime.

FIRSTCOMPUTERPROGRAMMER

Augusta AdaLovelace, the daughterof the English poet LordByron, was one of the

few people who had any cluewhat Babbage was talkingabout. Ada created a programto compute a mathematicalsequence known as Bernoullinumbers, which would havebeen extremely interesting hadBabbage’s machine everactually worked.

Ada is now credited asbeing the first computerprogrammer, and the ADAprogramming language wasnamed in her honor in 1979.

In fact, one of Babbage’searlier Difference Engines waseventually assembled by a teamat London’s Science Museumfrom his original drawings. Thefinal machine was constructedfrom cast iron, bronze and steel,

consisted of 4,000 components,weighed in at a whopping threetons, and was 10 feet wide and6·5 feet tall (3m x 2m).

In the early 1990s, more thanone hundred and fifty years afterits conception, Babbage’sDifference Engine performed itsfirst sequence of calculations andreturned results to 31 digits ofaccuracy, which is far moreaccurate than most of today’selectronic pocket calculators!

TABULATINGMACHINES

These days we can onlyimagine the problems besettingthe American census takers in thelatter part of the 19th Century,because it was estimated that the1890 census would include morethan 62 million Americans.

The problem was that theexisting system of making tallymarks in small squares on rolls ofpaper and then adding thesemarks together by hand was time-consuming, expensive, and proneto error. In fact it was determinedthat if the existing system wereused for the 1890 census, thenthe processed data would not beready until after the 1900 census,by which time it would be largelyworthless!

During the 1880s, a lecturerat MIT called Herman Hollerithcame up with a solution to thisproblem, which was to usepunched cards to represent thecensus data, and to then read

Special Feature

Modern construction of Babbage’s Dif-ference Engine. Courtesy of IBM.

Gottfried von Leibniz’s Step Reckoner of 1671. Courtesy of IBM.

Page 40: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 201

and collate this data usingmachines.

The result of Hollerith’slabours was an automatictabulating machine with a largenumber of clock-like countersthat were used to accumulateand display results. Operatorsused switches to instruct themachine to examine each cardfor certain characteristics, suchas gender, profession, maritalstatus, number of children, andso forth.

An electrically controlledsorting mechanism detectedany cards that met the specifiedcriteria and gathered them intoa separate container. The abilityto quickly and easily collatedata in this way drovestatisticians of the time into afrenzy of excitement.

Following their applicationto the census problem,Hollerith’s machines provedthemselves to be extremelyuseful for a wide variety ofapplications, and some of thetechniques they used were toprove significant in thedevelopment of the digitalcomputer in the 20th Century. Infact, in February 1924,Hollerith’s company changed itsname to International BusinessMachines, or IBM!

POISED ONTHE BRINK…

So now we arepoised on the brinkof the 20th Century.It’s 11:59pm onDecember 31st1899. QueenVictoria is still onthe throne ofEngland. Lightbulbs areconsidered to beamazingly cool (butalmost no-one has

electricity in their homes). Thevacuum tube has yet to beinvented. Rudimentarytelephones are available only tothe favored few, and“computers” are the ill-usedmathematicians who furiouslyhand-crank their mechanicalcalculators in the dead of night!

Tick-tock, tick-tock . . . thesecond hand is wending its waytowards the beginning of a newcentury. Who can guess whatsurprises the future will hold?

FUNDAMENTALELECTRONICS IN

THE 20TH

CENTURYFor our purposes here,

electricity may be considered toconsist of vast herds ofelectrons migrating from oneplace to another through someconducting medium like acopper wire. The art ofelectronics comes in controllingthese herds: telling them whento start, when to stop, where togo, and what to do when theyget there.

However, as with most things(especially small children),control is easier to talk about thanit is to achieve. With theexception of simple manipulationand modulation using devicessuch as transformers, orrectification using crystals, themost sophisticated form of controlprior to the beginning of the 20thCentury was the mechanicalswitch (or its electromechanicalcounterpart, the relay).

When it comes to coarsecontrol like turning a light bulb onor off, then a mechanical switchis definitely worth considering, butif you’re looking for fine control,mechanical switches generallyleave something to be desired.Similarly, a mechanical device isonly of use if you only wish to turnsomething off every now andthen, but such devices have amaximum capability of only avery few cycles per second.

So one key requirement aswe entered the 20th Century(“we” meaning the human race,not the authors personally youunderstand) was for a moresophisticated way to controlelectricity.

VACUUM TUBES –FLEMING’S DIODES

As we discussed in Part 1,the American Inventor ThomasAlva Edison demonstrated hisfirst incandescent light bulb in1789 (one year after the Englishinventor Sir Joseph Wilson Swandemonstrated his bulb, but let’snot delve into that debate againhere).

Four years later in 1883, anengineer working for Edison –William Hammer – observed thathe could detect electrons flowingfrom the lighted filament to ametal plate mounted inside thebulb. Even though Hammerdiscovered this phenomena, it

Special Feature

Hollerith’s Tabulator/Sorter unit.Courtesy of IBM.

Page 41: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 202

subsequently became known asthe Edison Effect, becauseEdison was the man in charge.

Sad to relate, Edisonhimself did not take the time toinvestigate the effect anyfurther. This was unfortunate,because electronics as we nowknow it might have taken agiant leap forward had he doneso.

In fact it wasn’t until theEdison Effect’s twenty-firstbirthday in 1904 that theEnglish electrical engineer,John Ambrose Fleming, fileda patent for the first vacuumtube device based on thiseffect. (Due to the fact thatthese devices are createdusing evacuated glass tubes,they are still referred to simplyas tubes in America. Howeverin England they became morecommonly known as valves,because this name – derivedfrom pneumatic and hydraulicvalves – better reflected theircontrol function.)

What Fleming haddiscovered was that theelectrons in his vacuum tubeonly flowed from the cathode(the heated filament) to apositively charged anode.

Thus, Fleming had created aform of diode, which is a devicethat only conducts electricity inone direction.

This was of particularinterest, because someelectrical equipment like radioswill only work withunidirectional, or direct current(DC), but most electricalsupplies are based on

alternating current(AC), because thisprovides a moreefficient way totransport electricityover long distances.Fleming’s vacuum tubediode could thereforebe employed in therole of a rectifier toconvert AC to DC.

LEE DEFOREST’STRIODES

In 1907, theAmerican inventor Leede Forest introduced a

third electrode called the grid intohis version of a vacuum tube.The resulting three-terminaldevice was called a triode.

This device was particularlycunning, because a small signalapplied to the grid could be usedto control a much larger signalflowing between the cathode andthe anode. The result was adevice that could be used toamplify signals, and de Forestused his triodes to build many ofthe early radio transmitters (healso presented the first live operabroadcast and the first newsreport on radio).

In addition to acting as anamplifier, de Forest’s triodescould also be used in the role ofswitches (the presence orabsence of a signal on the gridterminal could turn the output –the anode – on or off). This abilityto act as switches meant thatvacuum tubes were destined toplay a significant role in digitalcomputing.

As we shall see in a futureinstallment, early digitalcomputers (circa 1940) wereeither mechanical orelectromechanical (based onrelays), but they soon came to beconstructed from vacuum tubeswitches, because these weremuch, much faster.

Unfortunately, vacuum tubeshave a number of disadvantages,not the least that the metalforming the cathode evaporatesover time causing a performancedegradation. Also, in addition torequiring dangerously highvoltages, vacuum tubes occupy alot of space, they generate a lotof waste heat, and they are notparticularly reliable, whichbecomes especially noticeablewhen they are used in largenumbers.

For example, the ENIACcomputer, which was constructedat the University of Pennsylvania

Special Feature

Sir John Fleming (1849-1945),British physicist and inventor ofthe thermionic valve. Courtesy of

the Science Photo Library.

An Audion triode from about 1914.Right: An MO Valve Co. triode from

about 1920. Courtesy of Radio Bygones(www.radiobygones.com).

Page 42: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 203

between 1943 and 1946, usedapproximately 18,000 vacuumtubes. This monster was 10 feet(3m) tall, occupied 1,000 squarefeet (93 m2) of floor space, andrequired 150 kilowatts of power,which was enough to light asmall town at that time.

However, whilst it was atremendous achievement for itstime, ENIAC was painfullyunreliable due to the vacuumtube technology of the day. Infact 90 per cent of ENIAC’sdown-time was attributed tolocating and replacing burnt-outtubes – sometimes as many as50 a day!

CRYSTAL GAZINGThe fact that certain crystals

have special properties hadbeen known for a long time. Forexample, in 1880, the Frenchphysicist Pierre Curie haddiscovered the piezoelectriceffect. In this case, certaincrystalline substances producean electrical charge if they aresqueezed, and correspondinglythey change size if an electriccurrent is applied to them.

This effect subsequentlyfound many diverse applicationsin electronics, from sensors(including microphones) toactuators (including extremely

loud alarms).Prior to

Fleming inventinghis vacuum tubediode, early radiosrelied on the use ofcrystals forrectification. At thattime no one reallyunderstood howcrystals couldconvert an ACsignal into its DCcounterpart, andfollowing theadvent of thevacuum tube most

people really couldn’t care less.However, some scientists,

inventors and engineers didremain interested in crystals ingeneral, especially as theybegan to discover more of thespecial properties associatedwith different crystallinestructures. For example, in1907 a letter from Mr. H.J.Round was published in theAmerican Electrical Worldmagazine as follows:

To the editors of ElectricalWorld: Sirs – During aninvestigation of theunsymmetrical passage ofcurrent through a contact ofcarborundum and othersubstances a curiousphenomenon was noted. Onapplying a potential of 10 voltsbetween two points on a crystalof carborundum, the crystalgave out a yellowish light.

Mr Round went on to notethat some crystals gave outgreen, orange, or blue light.This is quite possibly the firstdocumented reference to theeffect upon which light-emittingdiodes (LEDs) are based.

Similarly, as far back as1926, Dr Julius Edgar Lilienfieldof New York filed for a patenton what we would nowrecognize as an npn junction

transistor being used in the role ofan amplifier (the title of the patentwas the Method and apparatusfor controlling electric currents).

SEMICONDUCTORSSome substances facilitate

the conduction of electricity andare therefore known asconductors. Other materials resistthe flow of electricity, and theseare known as insulators. What theearly pioneers didn’t fullyunderstand is that by addingimpurities to certain crystallinestructures, it is possible to createa special class of materialsknown as semiconductors, whichcan exhibit both conducting andinsulating properties.

Sad to relate, seriousresearch into semiconductors didnot really commence until WorldWar II. At that time it wasrecognized that devices formedfrom semiconductors hadpotential as amplifiers andswitches. If it proved possible tocreate them, these new devicescould be used to replaceprevailing vacuum tube

Special Feature

Part of the ENIAC computer. Courtesy of IBM.

The first ever transistor,created on 23 December1947. The photo scale isapproximately twice life

size. Courtesy of Bell Laborato-ries/Lucent Technologies.

Page 43: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 204

technology, with the advantagesthat they would be muchsmaller and lighter, they wouldconsume much less power, andthey would be far more reliable.

TRANSISTORSIn the early 1940s,

scientists at Bell Labs in theUnited States started toexperiment with impure crystalsof germanium. The first truesemiconductor componentswere two-terminal diodedevices. On the 23rd December1947, a team comprising thescientist William BradfordShockley and the theoreticalphysicists John Bardeen andWalter Brattain succeeded increating the first point-contacttransistor (whose name wasderived from transfer resistor).

Like the triode, this was athree terminal device that couldbe used both as an amplifierand a switch. Once they hadproved that their creationworked, the team broke up tocelebrate the Christmasholidays, which is why many(lesser) references state that thefirst transistor did not make anappearance until 1948.

In 1950, Shockley inventeda new type of device called abipolar junction transistor (BJT),which was more reliable, easierand cheaper to build, and gavemore consistent results thanpoint contact devices. Then, in1962, Steven Hofstein andFredric Heiman at the RCAresearch laboratory atPrinceton, New Jersey, inventeda new family of devices calledfield effect transistors (FETs).

Although germaniumexhibits more desirableelectrical characteristics, for avariety of reasons silicon iseasier to work with, and so bythe late 1950s silicon hadreplaced germanium as the

semiconductor of choice. (Assilicon is the main constituent ofsand and one of the mostcommon elements on earth –silicon accounts forapproximately 28 percent of theEarth’s crust – we aren’t in anydanger of running out of it in theforeseeable future.)

Very quickly after the firsttransistors had been developedthey started to appear incommercial products. Forexample, 1952 saw theappearance of the transistor-based hearing aid, quicklyfollowed by Sony’s pocket-sizedtransistor radio. It was alsoobvious to computer scientiststhat they could now makemachines much smaller (the sizeof a room instead of a house), butonly a very few forward thinkershad any idea as to what was yetto come …

INTEGRATEDCIRCUITS

Sometime after the inventionof the transistor, people began tothink that it would be a good ideato be able to fabricate entirecircuits on a single piece ofsemiconductor. In fact, the firstpublic discussion of this conceptis generally credited to a BritishRadar expert, G. W. A. Drummerin a paper he presented as farback as 1952. However, it wasnot until 1958 that a youngengineer called Jack Kilbyactually succeeded in creatingmultiple components as a singledevice.

To a large extent the demandfor miniaturization was driven bythe requirements of the Americanarmed forces and also by rocketresearch. At that time, onetechnique that was receiving a lotof attention was the Micro-Moduleprogram, which was sponsored bythe US Army Signal Corps.

Special FeatureTIMELINES1901: Hubert Booth invents the

first vacuum cleaner.1902: Robert Bosch invents the

first spark plug.1902: America. Millar Hutchin-

son invents the first elec-trical hearing aid.

1904: England. John AmbroseFleming invents the vac-uum tube diode rectifier.

1904: First ultraviolet lampsare introduced.

1904: First practical photoelec-tric cell is developed.

1906: First tungsten-filamentlamps are introduced.

1907: America. Lee de Forestcreates a three-elementamplifier vacuum tube(triode).

1908: Charles Frederick Crossinvents Cellophane.

1909: Leo Baekeland patentsan artificial plastic thathe calls Bakelite.

1909: General Electric intro-duce the world’s firstelectric toaster.

1910: First electric washingmachines are introduced.

1910: France. Georges Claudeintroduces neon lamps.

1911: Dutch physicist HeikeKamerlingh Onnes dis-covers superconductiv-ity.

1912: The Titanic sinks on itsmaiden voyage.

1912: America. Dr Sidney Rus-sell invents the electricblanket.

1913: William D. Coolidge in-vents hot-tungsten fila-ment X-ray tube. ThisCoolidge Tube becomesstandard generator formedical X-rays.

1914: America. Traffic lights

Page 44: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 205

Using this technique, all ofthe components were createdwith a uniform size and shape,and the wiring was built into thecomponents themselves. TheseMicro-Modules could then besnapped together to formcircuits.

Texas Instruments wasworking on the Micro-Moduleprogram when Jack Kilby joinedthe company in May 1958. Inthe middle of the summer, mostof the plant was to shut downfor a mass vacation, but as anew employee Kilby did nothave any vacation time coming,so he was left to his own

devices.In a desperate attempt to

avoid being consigned to workingon Micro-Modules for the rest ofhis career, Kilby startedpondering the fact that multipledevices such as resistors,capacitors and transistors couldbe fabricated on a single piece ofsemiconductor and connectedtogether in situ to form acomplete circuit.

As soon as his boss returnedfrom vacation, Kilby explained hisideas and received permission toexperiment further. On 12thSeptember 1958, he powered uphis first prototype – a phase shift

oscillator – whichimmediately started tooscillate atapproximately 13MHz.

Althoughmanufacturingtechniquessubsequently tookdifferent paths to thoseused by Kilby, he is stillcredited with themanufacture of the firsttrue integrated circuit.

The original bipolarjunction transistorswere manufacturedusing the mesa process

Special Featureare used for the first time(in Cleveland, Ohio).

1917: Clarence Birdseye pre-serves food using freez-ing.

1919: The concept of flip-flop(memory) circuits is in-vented.

1919: Walter Schottky inventsthe tetrode (first multiple-grid vacuum tube).

1921: Czech author KarelCapek coins the termrobot in his play R.U.R.

1921: Albert Hull invents themagnetron (a microwavegenerator).

1921: Canadian-AmericanJohn Augustus Larsoninvents the polygraph lie-detector.

1921: First use of quartz crys-tals to keep radios fromwandering off-station.

1923: First neon advertisingsign is introduced.

1923: First photoelectric cell isintroduced.

1926: America. First “pop-up’’bread toaster is intro-duced.

1926: America. Dr Julius EdgarLilienfield from New Yorkfiled for a patent on whatwe would now recognizeas an npn junction tran-sistor being used in therole of an amplifier.

1927: Harold Stephen Blackconceives the idea ofnegative feedbackwhich, amongst otherthings, makes hi-fi ampli-fiers possible.

1927: First five-electrode vac-uum tube (the pentode)is introduced.

1928: Joseph Schick inventsthe electric razor.

1928: America. First quartz

The first integrated circuit, created by Jack Kilby ofTexas Instruments in 1958. Courtesy of Texas Instruments.

The first microprocessor, Intel’s 4004, of1971. Courtesy of Intel.

Page 45: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 206

Special Featurecrystal clock is intro-duced.

1930: America. Sliced breadarrives.

1936: Fluorescent lighting ar-rives.

1938: Hungarian Lazlo Biropatents the first ball-pointpen.

1938: Walter Schottky discov-ers the existence ofholes in the band struc-ture of semiconductorsand explains metal/semi-conductor interface recti-fication.

1938: America. Claude E.Shannon publishes anarticle (based on hisMaster’s thesis at MIT)showing how Booleanalgebra could be used todesign digital circuits.

1939: Light-emitting diodeswere patented byMessers Bay andSzigeti.

1943: German engineer PaulEisler patents the printedcircuit board.

1945: Percy L. Spensor inventsthe microwave oven (thefirst units go on sale in1947).

1947: America. PhysicistsWilliam Shockley, Wal-ter Brattain, and JohnBardeen create the firstpoint-contact germaniumtransistor on the 23rdDecember.

1948: First atomic clock con-structed.

1950: Maurice Karnaugh in-vents Karnaugh Maps(circa 1950), whichquickly become one ofthe mainstays of thelogic designer’s tool-chest.

1950: America. Physicist

William Shockley inventsfirst bipolar junction tran-sistor.

1952: England. First public dis-cussion of integrated cir-cuits is credited to aBritish radar expert,G.W.A. Dummer.

1954: America. C. A. Swansoncompany markets thefirst “TV Dinner’’.

1955: Velcro is patented.1957: America. Gordon Gould

conceives the idea of thelaser.

1958: America. Jack Kilby,working for Texas Instru-ments, succeeds in fabri-cating multiple compo-nents on a single pieceof semiconductor.

1959: Swiss physicist Jean Ho-erni invents the planarprocess, in which opticallithographic techniquesare used to create tran-sistors.

1959: America. Robert Noyceinvents technique forcreating microscopic alu-minum wires on silicon(leads to development ofintegrated circuits).

1960: America. TheodoreMaimen creates the firstlaser.

1962: America. Steven Hof-stein and Fredric Heimanat RCA Research Labinvent field effect transis-tors (FETs).

1962: America. Unimation in-troduces the first indus-trial robot.

1967: America. Fairchild intro-duce an integrated circuitcalled the Micromosaic(the forerunner of themodern ASIC).

1968: America. First StaticRAM IC reaches the

emitter into the base.One of Hoerni’s colleagues,Robert Noyce, invented a tech-nique for growing a layer of sili-con dioxide insulator over thetransistor, and then etching thislayer to expose small areasover the base and emitter. Thinlayers of aluminum were subse-quently diffused into these ar-eas to create wires. The pro-cesses developed by Hoerniand Noyce led directly to mod-ern integrated circuits.By 1961, both Fairchild andTexas Instruments had an-nounced the availability of thefirst commercial planar inte-grated circuits, comprising sim-ple logic functions. Only nineyears later in 1970, Fairchildintroduced the firstsemiconductor-based 256-bitstatic RAM, while Intel an-nounced the first 1024-bit dy-namic RAM.Then in 1971, Ted Hoff et al atIntel invented the world’s firstcomputer on a chip – the 4004microprocessor. The successorsof this device (the 4040, 8008and 8080) heralded a new areain computing. Systems smallenough to fit on a desk could becreated with more processingpower than monsters weighingtens of tons only a decade be-fore.Almost unbelievably, individualscould now own their own per-sonal computer. As we shall seein future parts, the effects of

market.1970: America. Fairchild intro-

duce the first 256-bitstatic RAM called the4100.

1970: America. Intel announcethe first 1024-bit dy-namic RAM, called the1103.

1971: America. Intel creates

Page 46: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 207

NEXT MONTHIn Part 3, we shall consider thedevelopment of communica-tions in the 20th Century.

HUMBLEAPOLOGIESBefore you reach for your penor computer keyboard to sendus a stern letter of chastise-ment, we crave your indulgenceand ask you to accept our hum-blest apologies for all of thethings we had to leave out. Thehistory of cunning devices suchas light-emitting diodes (LEDs),laser diodes, phototransistorsand suchlike would make fasci-nating reading.Who could deny that intercon-nection and packaging tech-nologies like printed circuitboards (PCBs), flexible circuitboards, hybrids, and multichip

modules (MCMs) really deservean article in their own right. Im-age capture and display technolo-gies like charge-coupled devices(CCDs), cathode ray tubes(CRTs), liquid crystal displays(LCDs) and so forth are certainlyentitled to be acknowledged.Devices and techniques such asmasers, lasers, fiber optics, mag-netrons (leading to both Radarand microwave ovens), mercurydelay lines and magnetic corestores also deserve a hearing.And of course a tremendous vari-ety of other technologies, rangingfrom plastics to storage(batteries), have all played alarge part in the evolution of elec-tronics as we know it today.Unfortunately, space limitationsmeant that when “push came toshove” we had to make somestern decisions. And when onepeels the outer layers away, it be-comes obvious that the three ab-solutely core electronics develop-ments of the 20th Century are thevacuum tube, transistor, and inte-grated circuit, as discussedabove. Of course, if you disagree(or if you simply crave more oncethis series is finished), please feelfree to vent your feelings by inun-dating the Editor with your lettersand emails.

Special Featurethese developments are still un-folding, but it is not excessive tosay that electronics in general,and digital computers in particu-lar, have changed the worldmore significantly than almostany other human invention.

MORE INFOThe way in which componentslike transistors and integratedcircuits perform their magic isdiscussed in greater detail inBebop to the Boolean Boogie(An Unconventional Guide toElectronics), while the history ofthe early computers is dis-cussed in more detail in BebopBYTES Back (An Unconven-tional Guide to Computers). Bysome strange quirk of fate, bothof these books are availablefrom the EPE Online Store atwww.epemag.com

Page 47: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 208

Greetings again! We expectyou’ve got your breadboard cou-pled to the computer, allpowered-up and ready to go. But,wait, is the oscillator on yourbreadboard the same as that de-scribed in Fig.4.1 and Fig.4.3 ofTeach-In Part 4 last month? Ifnot, make it so, then we’re readyto start…

MAKING WAVESLast month, we left you with

the suggestion that you shouldexplore two of our simulation pro-grams: Computer as FrequencyCounter and Pulse Input Wave-form Display. (Remember thatthis software is available for freedownload from the EPE OnlineLibrary at www.epemag.com,Ed.)

In the second of these pro-grams, at some stage of your ex-perimentation, hopefully you pro-duced a screen display that lookssomething like that in Photo 5.1.It is waveforms that are the mainsubject of our discussion thismonth.

PART 5 – Waveforms, Frequency,and Timeby John Becker

Before that, though, weshall discuss a little more fullynot just the above two pro-grams, but also the precedingone, Parallel Port Data Display/Set. In doing so we shall alsointroduce you to the first of sev-eral concepts in Digital Logic,that of the AND function.

From the main menu, callup the Parallel Port Data Dis-play/Set program to your

What we are doing during this Teach-In2000 series (of at least 10 parts) is to lead youthrough the fascinating maze of whatelectronics is all about! We are assuming thatyou know nothing about the subject, and aretaking individual components and concepts insimple steps and showing you, with lots ofexamples, what you can achieve, and without ittaxing your brain too much!

In the first four parts we discussed (andgave you practical experience of) several typesof commonly used electronic components.Last month we also showed you how tointerface your experimental circuits to a PC-compatible computer, allowing pulsewaveforms to be displayed on the screen. Wenow discuss other waveforms and how toobserve them on your PC, adding just one

screen. Connect the computer’sparallel port to your breadboard,without the oscillator connectedto any of the five input points(IN0 to IN4).

INPUT REGISTERNow look at the Direct Input

Byte box on the screen (Photo4.8 last month). What youshould see is the Original Byte

Photo 5.1. Typical pulse waveforms input to thecomputer via the simple interface board.

Page 48: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 209

value shown as 10000xxx bi-nary (where x can be either 1 or0). This indicates that the com-puter’s input port register (aspecial form of digital storagedevice) believes that its eightbits are at the logic statesshown.

Your breadboard interfacecircuit only uses five bits, butwhich five of the eight bits ap-parently available? Probablyfrom your experiments you al-ready know the answer, the left-hand five, bit 7 to bit 3 are thoseused in connection with bread-board inputs IN4 to IN0.

As far as the computer isconcerned, bits 2 to 0 are not todo with data input (what theirlogic values are depends onyour computer system – the au-thor’s various computers returndifferent values).

What might also be puz-zling you (although you’ve pos-sible just shrugged your shoul-ders over it and thought that’sthe way it is), is that bit 7 is al-ways set at the opposite logic towhat you expect through con-necting signals to IN4 on theboard. Well, you’re right, that isthe way it is, bit 7 is inverted bythe computer.

Underneath the upperboxes is the correction formulaused to change the value di-rectly received by the port regis-ter (box 1) to that in box 2, Cor-rected Input Byte. The meaningwill become clear after BinaryLogic has been discussed inPart 6. Basically, all that is be-ing done is to re-invert bit 7 andshift all the bits along to theright by three places. This al-

lows the correct logic on all fivebreadboard inputs to be seen assuch in box 2, as the New Byte.

This type of manipulationcan be extremely useful whenusing the computer as an itemof test gear to monitor a digitalcircuit.

FREQUENCY COUNTERIt is also possible to read

the status of each register bit byANDing it with particular binaryvalues (a Binary Logic subjectcoming in Part 6), and this iswhat is done in the Computer asthe Frequency Counter pro-gram. Call it up from the menu,and couple your oscillator IC1apin 2) to IN0 as you have donebefore. It is best if diodes D2and D3 are omitted and a 1kresister used in position D3(also as you’ve done before).

You will have discoveredthat the program only respondsto frequency input signals fromone interface input path at atime, and that for this path to beseen as active by the program,the Active Bit in the screen boxhas to be appropriately set fromthe keyboard (key <B>). Eachactive bit has an associatedAND value stated – each valueis one of the powers of decimal2:

When ANDing one binarynumber with another, individualbits in the answer will only be atlogic 1 if the same bit in bothstarting values is also at logic 1.If either or both bits are at logic0, so the same bit in the answerwill also be at logic 0. For ex-ample, to test for bit 4 beinghigh in a register that probablyhas other bits set as well (bits 3and 6 in this example):

Register value = 01011000(decimal 88)AND value = 00010000(decimal 16)

ANDed answer = 00010000(decimal 16)therefore bit 4 is high. Con-versely:

Register value = 01001000(decimal 72)AND value = 00010000(decimal 16)ANDed answer = 00000000(decimal 0)therefore bit 4 is low.

Thus all that is needed to iso-late the status of a bit is to AND itwith the required value. If the bitis low an answer of zero will re-sult; if it’s high an answer greaterthan zero will result. So you sim-ply check whether or not the an-swer is zero and act accordingly.The AND command/facility is apowerful tool in computing andelectronics.

Note that in the computerprogram that actually controlswhat you are now seeing onscreen, binary values cannot berecognized as such, consequentlythe decimal equivalent is thatused in the Frequency Counterprogram.

This program has been writ-ten to isolate the bit as selectedin the screen box and to detecteach time it changes state duringa period of one second, dividingthe answer by two to find out howmany times the bit has been highin that period. This result is dis-played on screen as the(approximate) frequency at whichyour oscillator is running.

The internationally agreedunit of frequency is the Hertz, ab-breviated to Hz, as shown on thescreen. (Strictly speaking, Hertzin this context should be writtenwith a lower-case initial – hertz.)In the present example we have afrequency of 1Hz (one cycle persecond. Back in history, fre-quency was actually defined incycles per second – CPS or C/S).

TEACH-IN 2000Bit Power Decimal Binary

76543

27

26

25

24

23

1286432168

1000000001000000001000000001000000001000

Page 49: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 210

PULSE DISPLAYIn the Pulse Input Wave-

form Display program (call it upon screen), AND is again usedto isolate the selected bit. In thiscase, though, the result causesthe drawing of a horizontal lineto represent the bit’s status,high or low. The “vertical” line issimply drawn by the program atthe detected transition betweenlogic levels.

Having completed onecrossing of the screen, thewaveform re-commences on thenext allocated path, erasing anyprevious waveform. The rate oftransition is selectable via theDisplay Step option (note thatthis does not actually changethe rate at which the registerinput is examined – sampled – itjust changes the distance theline travels for each sample). Itis not possible to assess fre-quency from this display (a trueoscilloscope would allow this tobe done, however).

The facilities offered by thisdisplay and the previous pulsecounting program can be ofgreat use when testing other cir-cuits in the future.

HARMONICSWe would now like to illus-

trate a problem that can occurwhen monitoring a waveform,and one which can also affectthe correct response when digi-tal electronic circuits are used inreal-life situations – that of rela-tive rates of response betweenone circuit and another. The ef-fectiveness of the illustration onscreen, though, rests on howfast your computer is running. Ifit runs too slowly, it may be diffi-cult for the required effect to beproduced. Nonetheless, let’s tryit.

First, set your oscillator to aslow speed so that the individ-ual pulses (as square waves –equal length highs and lows) areclearly seen and with wide spac-ing. It is probably best to selecta Display Step value of 10 (usethe <+> key).

Slowly increase the oscilla-tor’s rate and watch the pulsesclose up to each other (you mayneed to change capacitor C1 toa smaller value). Eventually, thepulses will be so close togetherthat you can probably not distin-

guish between them.Continue to increase the

frequency – what you shouldsee next (your computer’s sam-pling speed permitting) is thatas you increase the frequency,the waveform spaces start towiden, probably with unevenspacing (see Photo 5.2). Why?

The answer is not that youroscillator has decided to run er-ratically or more slowly all of asudden. What is happening isthat the computer now does nothave time to respond to eachpulse. So what you are seeingon screen is a sub-harmonic ofthe actual frequency being mon-itored. The unevenness of thespacing is due to the computer’ssampling rate and the speed ofthe oscillator not being synchro-nized.

If you try this with the Fre-quency Counter program, youwill see the apparent frequency

TEACH-IN 2000

Photo 5.2. Example of “under-sampled” pulsewaveforms into the computer via the simple

interface board.

TRIANGLE(A)

(B)

(C)

(D)

(E)

(F)

(G)

(H)

POSITIVE-GOINGRAMP

NEGATIVE-GOINGRAMP

SINEWAVE

SQUARE WAVE

REGULARPULSE

IRREGULARPULSE

t

t

t

t

t

t

t

t

t

t

COMPLEX

Fig.5.1. Examples of wave-form types. Frequency mea-surements can be assessedfor periods arrowed for (A) to(F), but cannot be meaning-fully measured for irregular

Page 50: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 211

TEACH-IN 2000

Press the up-arrow key sothat the orange background ison the square wave.

Note the point at which anyone of the pulses first becomeshigh and the point at which itends being low (and the nextpulse commences). You will seethat the square wave has awhite box around it to indicatethis period. In Fig.5.1 it is repre-sented by the “t” arrows.

This period is known as acycle. On screen you will seethat it takes just one second.When a waveform consists ofmany equal length cycles its fre-quency is defined as the num-ber of cycles that occur in onesecond, which, as we said a fewparagraphs back, is expressedin Hertz.

In the right-hand box youwill see that the time (t) for onepulse and its consequent fre-quency (f) is stated:

t = 1 secs, f = 1Hz

Press key <X> to changethe screen’s scale to 1 second.Each vertically dotted interval is

rate change downwards as thetransition to sub-harmonic sam-pling occurs.

It is even possible that asthe oscillator’s frequency is in-creased still further, samplingmay occur on every third pulse,or every fourth pulse, and so on,almost indefinitely. It is unlikely,though, that our demonstrationprogram will actually allow youto go beyond one-in-three.

This situation is one thatyou have to consider very care-fully when using a frequencycounter or oscilloscope (whetheras true items of test equipment,or as computer-based samplingprograms). It is also somethingto be considered when you startdesigning digital logic circuits –can all the digital integrated cir-cuits keep pace with the rate at which others expect them to? Highly unpredictable re-sults can occur if they can’t!

Not only does the problemreveal itself in digital electron-ics, but you can also experienceallied situations when dealingwith analog signals – a signal atone frequency adversely (or de-sirably in some cases) affectinga signal at another.

In a future part we shallshow you how two analog sig-nals respond to each other.

WAVEFORM TYPESDISPLAY

Put your breadboard as-sembly to one side for the mo-ment (you’ll need it again for theExperimental article, though).Let’s show you examples ofsome different waveform types.We shall also explain how youcan do some simple calcula-tions in respect of frequencyand time. From the main menuselect Frequency and Time(well, what else?!).

Examples of seven differenttypes of waveform will be seenon screen (see Photo 5.3 andFig.5.1) as follows:

o) Triangleo) +VE Ramp (positive-going

ramp – upwards)o) –VE Ramp (negative-going

ramp – downwards)o) Sineo) Squareo) R-Pulse (regular pulse)o) Complex

In fact an eighth waveformis available via the screen –press the down arrow key threetimes. Where R-Pulse was willnow become I-Pulse (IrregularPulse) and the pulses will beseen to be very irregular.

SCALING AND CAL-CULATIONS

The screen display isscaled, at present to represent aperiod of 10 seconds from thestart of any waveform to its end.Vertical dotted lines indicate the1-second interval points.

Fig.5.3. Relationships between upper and lower sections for auniformly alternating waveform.

Page 51: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 212

TEACH-IN 2000now 01 seconds. The frequencyrepresented is therefore 10 cyclesper second – 10Hz. The right-hand box confirms this.

You/we have been able to dothe conversion from time to fre-quency in our heads, almost in-stinctively. As shown in the box,though, there is a formula for it:

f = 1/t

Conversely, if you want tofind out the cycle period (time) ofa waveform whose frequency youknow, the formula becomes:

t = 1/f

Press <F> and this formulawill be shown, together with thecalculated answer.

Press any of the <+ – * />keys to expand or contract thewaveform, and variously swapbetween the two formulae using<F>. The units in which f and tare expressed are changeable byusing <U>.

These formulae can be ap-plied to any regular waveform,including the first six on screen(and in Fig.5.1). With irregularwaveforms, such as those for I-Pulse and Complex, periodic timeand frequency for the waveformas whole cannot be ascertained.

All that can be assessed fromthe irregular pulse, for example,is the period of any individualpulse. In terms of overall fre-quency of the waveform, this an-swer is meaningless.

It is possible, of course, touse a frequency counter with thisirregular pulse chain and deter-mine the number of pulses thatoccur in any 1 second, but theanswer for each 1-second sam-pling period is likely to be differ-ent.

With the complex waveform,there are in fact a great many dif-ferent frequencies involved in itsmake up, but they are all likely to

be at different amplitudes. Toseparate each frequency and itsamplitude out from the mainwaveform requires very com-plex equipment (such as a fre-quency analyzer – expensive!).

WELL-DEFINEDIt should also be obvious

that even with a well-definedwaveform, you need to be ableto time the complete period of acycle. It does not matter,though, at which point you actu-ally start the timing.

With the square wave youcan start timing as the pulserises (at its leading edge) andend at the start of the leadingedge of the second pulse. Alter-natively, you can start as thepulse falls (at its trailing edge)and end as the next pulse’strailing edge begins to fall. Thewhite outline box on the wave-form illustrates this point whenyou set it to lower frequencies(also see Fig.5.1).

When looking at a wave-form on a screen (whether it is acomputer screen as in this sim-ulation, or an oscilloscopescreen), the commencement ofa cycle does not necessarily oc-cur where you first see thewaveform appear; the cyclemay have started long beforethe screen responded to it. Al-ways take a measurement whenit is obvious where the exactstart of the cycle occurs. Oursimulation program, you will no-tice, takes this into account.

Examine the position of thewhite box for all the waveformsthat can display it and observeat which points of a cycle mea-surements may be taken.

It is worth noting that mostoscilloscopes have a facility forplacing a horizontal line acrossthe screen. This can be movedup or down and placed so that it

crosses any point on the wave-forms. Timing measurementscan then be taken between anytwo or more points where thehorizontal and waveform linescross.

SELF-TESTFor a bit of timely entertain-

ment, we’ve added a Self-Testoption to test your use of timeand frequency calculations –press <S> to enter or exit it.

CYCLE POWERIn Part 3 we explained that

the amount of current con-sumed by a circuit can be de-fined according to the voltageapplied across it and the resis-tance through which it flows, I =V/R. When the voltage is at anice steady DC level and theresistance is constant, the cur-rent drawn is the same at all in-stants of measurement.

If we want to calculate cur-rent (or any of the factors de-fined in Ohm’s Law and itsderivatives – Part 3) in relationto a changing voltage (e.g.waveform) rather than steadyconditions, the situation be-comes more complex.

For any particular instant,we can of course say that condi-tions are constant at that in-stant, and calculate accordingly.However, we often need toknow the current drawn over aperiod of time, rather than in-stantaneously.

With a square wave or reg-ular pulse waveform, averagecurrent can be calculated ac-cording to the period for whichthe pulse is high (full currentflow) relative to the period forwhich it is low (minimum currentflow).

When the pulse is changingbetween 0V and a known volt-

Page 52: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 213

amount of time, no matter howsmall, see Part 6 next month.)

The maximum peak current isa predictable or measurablevalue (that when the voltage is atits maximum), so too is the mini-mum current (that when the volt-age is at 0V, i.e. a current of zeroamps).

Consequently, when a trian-gular waveform is alternating be-tween 0V and a given maximumvoltage, the average currentdrawn during one cycle is halfthat of the peak current.

Do you remember fromschool days how you found thearea of a triangle having sides ofdifferent lengths? (See Fig.5.2.)The principle for finding average

current per unit of time in re-spect of a triangular waveformis the same: multiply the height(voltage or current) by thelength (time) and divide by two,e.g.:

Iav = Imax x Tcycle/2, or:Iav = (Imax/2) per cycle time

Suppose a peak current of100mA is drawn when power issupplied by a triangular wave-form alternating between 0Vand +5V and the cycle period is1 second. The minimum currentdrawn is zero. Therefore the av-erage current drawn is simply100mA/2 = 50mA per second.

If the waveform is alternat-ing between two other levels, asimilar principle applies, but re-quires just a bit of extra calcula-tion. Suppose, for example, thatthe waveform causes the cur-rent to alternate between100mA maximum and 20mAminimum:

First take the difference be-tween the two extremes: 100mA– 20mA = 80mA. The averageof the current difference for thiswaveform is 80mA/2 = 40mA.But there is the “standing” cur-rent of 20mA, which has to beadded to the average differ-ence. Thus the overall averagecurrent drawn = 40mA + 20mA= 60mA.

What happens, though, ifthe waveform is evenly alternat-ing between –6V and +6V, forexample? Instinct might justsuggest that if 100mA is drawnat +6V, then –100mA is drawnat –6V, thus the average currentdrawn is zero. But, you mightwonder, doesn’t that mean thebattery would never run down?Sadly, not so…

It’s certainly true to say thatthe average current or voltagevalue of a waveform which al-ternates symmetrically above

TEACH-IN 2000age value, it’s just a matter ofratios of the on to off (high tolow) periods of the pulse.

For example, if a 0V to +5Vpulse is high for 05 secondsand low for 05 seconds (i.e. asquare wave), we can say thatthe average current drawn inone second is half that whichwould be drawn if the maximumcurrent flowed for 10 seconds.

If the on-off periods are notequal, the formula used is just:

Average Current = On Period/Cycle Period x Maximum Cur-rent.

For the above example, andassuming a continuous maxi-mum current of 2 amps, this re-lationship becomes:

Iaverage = Ton/Tcycle x Imax = 05 sec/1 sec x 2 amps = 1 amp persecond.

TRIANGULATIONFor waveforms such as tri-

angle and ramp, the calcula-tions are just as simple, irre-spective of their relative riseand fall times.

By definition, the voltage oftriangle waveforms rises at oneconstant rate, and falls at an-other constant rate. This is trueirrespective of the relative ratesof rise and fall for the wave-form.

In the case of a uniformly-shaped triangle (isosceles –having two equal sides), riseand fall periods are equal inlength. Note that a ramp wave-form is a special case of trian-gle, in which the vertical edgeoccurs instantaneously, makingthe ramp duration the same asthe cycle period. (In fact an in-stantaneous change in levelnever occurs in electronics –every change takes some

(A)

(B)

(C)

AREA OF RECTANGLE ABCD = AB x BC OR DC x ADAREA OF TRIANGLE ABC = AREA OF TRIANGLE ADC= (AB x BC)/2 OR (AD x DC)/2

AREA OF TRIANGLE AEC = ((AB x BC)/2) + ((BE x BC)/2)OR (AE x BC)/2

AVERAGE VOLTAGE FOR PERIOD T = V /2SIMILARLY AVERAGE CURRENT FOR PERIOD T = I /2

PKPK

VPK

A

A

B

B

C

C

D

E

VE

0V

T

Photo 5.2. Example of“under-sampled” pulse wave-forms into the computer viathe simple interface board.

V (1) = V (2)AVERAGE FOR PERIOD T = V (1)/2

PK PKPK

V (1)PK

V (2)PK

0V

VE

VET

Fig.5.3. Relationships be-tween upper and lower sec-tions for a uniformly alternat-

Page 53: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 214

and below a zero value will bezero if measured over a longenough period, although thisdoes not mean that the powerconsumed is zero.

When it comes to express-ing an average in relation to atriangular waveform uniformlyalternating above and below azero point, it is usually taken asthe average over just half of acycle, not over the full cycle.The half cycle can be either onthe negative or positive side ofthe zero midway level. The ef-fective answer is same. (SeeFig.5.3.)

However, what we can saywith respect to both sides of thewaveform is that it has a peak-to-peak value twice that of itspeak value. The peak value inthe previous example is 100mA,therefore its peak-to-peak valueis 200mA.

WAVING PROOFIf your computer has Quick-

BASIC or QBasic installed, youcan prove for yourself that for atriangle wave the average volt-age or current for one side of itsramp is half the peak value, us-ing the following BASIC routine:

ramplength = 10: ’ (seconds)totalvolts = 0FOR volts = 0 TO ramplengthSTEP 1totalvolts = totalvolts + voltsNEXT voltsaveragevolts = totalvolts / ram-plengthPRINT averagevolts

You will get an answer of5V.

Now do the same for a halfa sine wave (having an angularchange of 0 to 180) andwhose peak voltage is 1V. Re-member that the sine of 0 is 0and that the sine of 90 is 1.

CONST pi = 3.141592653589# /180volts = 1totalvolts = 0FOR angle = 0 TO 180totalvolts = totalvolts +(SIN(angle * pi)* volts)NEXT angleaveragevolts = totalvolts / 180PRINT averagevolts

The answer now will be06366036V (approximately),say 0636V.

SINE WAVESSince sine waves are obvi-

ously subject to a different setof rules to triangle waves, let’sexamine them a bit moreclosely. From the main menuselect Sine Wave Value Rela-tionships. Photo 5.4 shows whatyou should see displayed.

The relationships we nowdiscuss are specifically thosewith regard to pure sine waves.They do not apply to any othertype of waveform. Furthermore,if you see any waveform rela-tionships referred to anywhereand the shape of the waveformis not actually stated, then therelationships are assumed torefer to sinusoidal conditions.

Looking at your screen dis-play (and Fig.5.4), you will seethe representation of a puresine wave swinging symmetri-cally above and below a zerolevel and plotted horizontallywith respect to time. Four verti-cal arrows indicate four majorrelationships exhibited by a si-nusoidal voltage waveform:

o) Vpk peak voltageo) Vav average voltageo) Vpk-pk peak to peak

voltageo) Vrms r.m.s. voltage

Vpk – the peak voltage is that

relating to just one halfof the cycle. Since a sinewave is symmetricalabove and below 0V,Vpk is the same what-ever half (positive ornegative) of the wave-form is measured.

Vav – as said in the previoussection, a sine wave’saverage voltage is thattaken over one completehalf-cycle. We showedthat it has a value 0636times that of the peakvoltage.

Vpk-pk – the peak-to-peak volt-age is obviously twicethat of the peak voltage(Vpk).

Vrms – well, first we had betterexplain the concept ofRMS:

RMS VALUESYou have discovered in ear-

lier parts that when a currentflows through a resistance,power is dissipated. We went onsay that heat is generated bythat dissipation. For a fixed re-sistance, and steady (DC) volt-age or current, the heat gener-ated is calculable – often ex-pressed in watts (see Part 1). Inthe Ohm’s Law section (Part 3)you saw that power can be cal-culated in several ways, such asP = I2 x R, P = V2/R, and P = I xV.

An RMS (root of the meansquare) value states the effec-tive value of alternating current

TEACH-IN 2000

0V

VE

VE

PK x 0 636PK x 0 707

VPK PKVPKVAV VRMS

TIME

Fig.5.4. Definition of the fourvalue relationships for a pure

sine wave.

Page 54: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 215

or voltage in terms of the heatthat will be generated through aresistance. By definition, thevalue is that which will producethe same amount of heat in theresistance as would a directvoltage or current of thesame magnitude.

Any waveform shape canbe related to an RMS value, butthe value is really only mean-ingful when referred to a knownshape. For a sinusoidal wave-form the RMS value is 1414times the peak value.

SINE WAVE RELA-TIONSHIP

The four sine wave units ofmeasurement listed in the previ-ous section have their relation-ships tabulated at the bottom ofthe main screen box displayed.

The screen display relation-ships are interactive (althoughthe waveform itself is not). Eachformula can be selected usingthe four keyboard arrows. Vari-ous values can also be setthrough the smaller left-handbox. Thus you can have thecomputer calculate relationshipanswers in respect of values ofyour choosing.

On entry to the screen youwill see a highlight on Pk x0636, allowing you to find theaverage value (AV = ) when thepeak value is known. Referringto the values box, Pk is shownas 1V. At the top of the mainbox is shown the answer to thecalculation, in this case thesame answer that we illustratedearlier with the BASIC sinewave calculation example.

We suggest you experimentwith the different formulae andvalues of your choice (the op-tions vary depending on the for-mula). Try to memorize some ofthe formula (two useful ones are

TEACH-IN 2000

AV = Pk x 0636 and Pk = RMS x 1414). The scaling of the values ischangeable using <X>.

You will find this facility to be of enormous value when you de-sign your own circuits in the future (or wish to analyze those of otherdesigners).

SELF-TESTFinally for this month’s Tutorial – through the Self-Test option the

computer randomly selects sine wave related questions. You are ex-pected to use your calculator, and then compare your answer to thecomputer’s, which will be displayed when you press <A>. You cancheat a bit if you want by changing the values offered by the com-puter!

And thinking of changing values, do please read and digest our“measured observations” discussion in Panel 5.1 following the Exper-imental section.

EXPERIMENTALIn this month’s Experimental section we show you how to add an-

other circuit to the interface board. This allows you to actually viewon screen the various waveforms you’ve been generating with thevariable mark-space oscillator of Fig.4.3 last month,

These include triangle, rising ramp, falling ramp, square wave,and regular pulse. Sine waves, irregular pulses and complex wave-forms we shall illustrate via your breadboard later in theTeach-In series.

NEXT MONTHIn Part 6 next month, we return to Binary Logic (briefly discussed

when the Parallel Port Data Display/Set program was described).The discussion will include Digital Logic Gates – OR, NOR, XOR,XNOR, AND, NAND. As usual, the screen displays will be interactive.

TEACH-IN 2000EXPERIMENTAL 5

ANALOG-TO-DIGITAL CONVERTER

We are now going to describe a very simple circuit that you canassemble on your breadboard, and which will allow you to use yourcomputer to view various analog waveforms, such as the triangleand ramps discussed in this month’s Tutorial. It is capable of display-ing other waveforms as well.

However, we won’t try to deceive you – the circuit is highly use-ful, but it’s also very limited!

Commercial equipment such as oscilloscopes, or commercial

Page 55: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 216

software for computer-basedvirtual ’scopes will do far morethan our simple demo software.The author’s Virtual Scope pro-ject of EPE Jan-Feb ’98 is alsoan extremely sophisticated itemof computer-based test gear,but it has to be said that theconstruction of its complexprinted circuit boards is notsuited to novices.

The intention of the Teach-In analog interface is basicallyto let you view the variouswaveforms that you create onyour breadboard. However, itcan be used not only with thedemo circuits we describethroughout this Teach-In series,but it will be of use with some ofyour own future designs.

Should we have space laterin the series, we’ll describe thesort of facilities you should ex-pect from a fully-fledged oscillo-scope (and which need not bevery expensive).

ANALOG INTERFACEA very simple analog-to-

digital converter (ADC) inte-grated circuit (IC) is the only ac-tive component in this part ofyour interface assembly. Thecircuit diagram for its connec-tions is shown in Fig.5.5.

We shall discuss the natureof the ADC (IC2) later on in thisarticle. In the meantime, wewant you to assemble the circuiton the breadboard and have alook at some waveforms onyour screen.

The breadboard layout forthe ADC (and the computer in-terface from last month) isshown in Fig.5.6. Assemble thecomponents into the bread-board, following the latter’snumbered holes.

The oscillator should besame as that referred to at thestart of this month’s Tutorial (i.e.

TEACH-IN 2000

Photo 5.6 Typical analogue waveform as demonstratedusing the complete interface circuit

PINBLOCK

TB1

ANALOGUE TO DIGITAL CONVERTER

REF

REFVIN

GND

1

2

3

4

6V

SIGNALINPUT

(BATTERY VE)0V

IC2TLC549

VE

CLK

D OUT

CS5

6

7

8

12

2

1

14

1

COMPUTERCONNECTOR

16

OUT 0

IN 1

OUT 1

SELECT

D0

D1

SK1

GND GND

13

2

Fig.5.5 Circuit diagram for the serial analog-to-digital con-verter interface.

Photo 5.5. Detail of the interface board with the ADC included.

Page 56: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 217

TEACH-IN 2000converts the voltages to equiva-lent binary numbers. You saw inPart 4 the representation of anumber in both binary and deci-mal (Parallel Port Data Display/Set).

The ADC is capable of“reading” the voltage level atmany thousand times per sec-ond and is controlled by logiclevel signals from the computer(or other device in other appli-cations). The ADC used in thisTeach-In demo is a serial ADC,which means that its output datais read one bit at a time.

Parallel ADCs also exist, inwhich the 8-bit data is read as asingle 8-bit byte. Parallel ADCsare much faster to read thanserial types, but require morecomputer control and data linesthan we have (readily) availablefor your Teach-In breadboard.

To start each voltage levelsampling and digital conversion,the computer sets the ADC’s CSinput (chip select) high via out-put data line D1. This actioncauses the ADC to “read” thevoltage present on its signal in-put (Vin) at that moment.

The ADC has an internalhigh-speed oscillator that thencontrols the data conversionprocess. (Incidentally, chip is aterm frequently encountered inelectronics and is colloquiallyused to mean any integratedcircuit device.)

The result of the conversionis a binary number between00000000 and 11111111(decimal 0 to 255). A conver-sion value of zero results froman input voltage of zero. Themaximum conversion value of255 occurs (in this breadboardassembly) when the input is atthe same voltage level as theADC’s power supply. This con-version range is determined bythe voltage levels to which theADC’s +REF and –REF pins are

with diodes D2 and D3 in-cluded). Use a 100uF capacitorfor C1 and adjust preset VR1 toa midway position.

Connect the resistor/capaci-tor junction on the oscillator(IC1a pin 1) to the ADC at itsinput pin 2 (Signal Input asshown in the breadboard lay-out). Also connect the ADC’sdata output pin 6 (D OUT asshown in Fig.5.5) to IN1 on thecomputer interface part of theboard. Crocodile-clipped linkswill do in both cases.

Power up the board and runthe Analog Input Waveform Dis-play. On entry to the display, ayellow line should be seentraversing the screen from leftto right, its vertical positionmoving up and down. AdjustVR1 (or change the value ofC1) until the moving line beginsto show several cycles of atriangular-like waveform, as yousaw demonstrated in the simu-lation program Frequency andTime, see Photo 5.6.

Should the yellow line justbe sitting towards the bottom ofthe screen, check that the Portregister selected is still the cor-rect one (as discussed in Part4). Also double-check that yourADC’s breadboard assemblycorresponds to the connectionsshown in Fig.5.6, and that theoscillator is still correctly assem-bled.

Towards the top right of thescreen is shown the DisplayRate, 10 at the moment. Usingthe <+> and <–> keys, this canbe set to any value between 1and 10 and controls the rate atwhich the waveform linecrosses the screen. The slowerthe rate, so more waveform cy-cles are shown.

Note that changing this ratealso changes the rate at whichdata is acquired (sampled) fromthe ADC. We shall discuss ana-

log sampling in a moment.Also at the top right of the

screen is the single word DI-RECT. This means that data isbeing sampled in real-time(here and now).

By pressing <C> the wordCAPTURE appears instead. Inthis mode, the computer sam-ples the data as fast as it canand temporarily stores it inmemory. Once a full set of sam-ples (640) has been received,the computer then plots them asa screened waveform.

This technique allowshigher speed waveforms to besampled than does the Directmethod. The drawback is thatthere is a pause between eachfull screen change of data(computer speed dependent).

Experiment with differentoscillator frequency rates andwaveforms, using preset poten-tiometer VR1, and different val-ues for capacitor C1. Also findout how Direct/Capture and Dis-play Rate settings have theirbenefits. Note that each timethe Display Rate is changed,the waveform line restarts fromthe left of the screen.

Also see whether you canreplicate some of the strangerwaveforms you have seenthrough the ADC-Demo pro-gram. (It has to be said thatthose of you with higher-speedcomputers will fair more easilysince the waveforms will betraced faster on the screen.)

Just for interest, try con-necting the oscillator’s digitaloutput (F OUT, IC1a pin 2) tothe ADC instead of the analogwaveform.

SERIAL ADC DEVICEAs the Analog-to-Digital

Converter’s name states, it al-lows an analog signal (e.g. volt-age waveform) to be input, and

Page 57: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 218

TEACH-IN 2000connected (6V and 0V in thiscase).

In other applications, thepins may be connected to otherreference voltages to provide adifferent conversion range. Thereference voltages must lie at orbetween the power supply volt-ages. (Note that the maximumvoltage at which this ADC canbe powered safely is +65V.)

READING BITSOnce conversion is com-

plete, the binary data can beread bit-by-bit by the computer.It is read in order of bit 7 to bit 0of the binary conversion value.(In theory, about 40,000 conver-sion and data-read cycles persecond can take place – but notwith this Teach-In demo!)

To read each bit, the com-puter takes the ADC’s CLK(clock) pin high via output lineD0 (OUT0). The data is thenread from the ADC’s Dout pinvia the breadboard’s IN1 path –computer parallel port registerbit 4.

The data on register bit 4will either be at logic 1 or logic0. As discussed when we de-scribed the data input process inPart 4, the value of the bit isisolated from the other registerbits (using an AND command)and set into the rightmost (bit 0)position of the 8-bit binary valuebeing assembled by the com-puter. Between each bit, thevalue is multiplied by two toshift all the bits left by oneplace.

The computer then sets theADC’s CLK line low, causing itto set the next bit of its binaryconversion onto the output pin.Taking the CLK line high againallows the computer to now readthis bit, and so on for all eightbits.

At this point, the computer

Photo 5.7. Analog-digital-analog demonstration screen. Youcan observe each bit being “assembled” to a binary number,

and change the sampling step rate.does whatever it has been toldto do with the data, in our caseit either stores it or draws ascreen line in relation to it. Afterwhich the next sample can betaken.

As an example of the com-puter’s data acquisition routine,take the conversion value ofbinary 10010111 (decimal 151).The computer first sets its datastorage value to 0 (00000000).The reading routine results inthe following binary values ofthe chip and the assembleddata storage:

The computer’s assembledvalue at step 8 is the same asthat of the original ADC conver-sion value.

012345678

000000000000000100000010000001000000100100010010001001010100101110010111

Step ADCValue

AssembledValue

100101110010111001011100101110000111000011100000110000001000000000000000

ADC DEMORun the Analog-Digital-

Analog Demo program from themain menu to see the animatedprinciple of how the ADC con-version is output from yourbreadboard to the computer(see Photo 5.7).

The left-hand box (Input)shows a single sine wave, cy-cling between 0V and +5V. It isshown feeding into the serialAnalog-to-Digital converter,where the present voltage levelis given, together with the ADCconversion value in both deci-mal and binary. For the sake ofthis demo, the ADC is assumedto be referenced so as to gener-ate an output of 0 for 0V and255 for +5V.

The ADC is shown con-nected to the computer. At pre-sent, the immediate ADC binaryvalue is repeated as the com-puter’s received value. Thecomputer then feeds this valueinto a Digital-to-Analog Con-verter (DAC). DAC devices willbe discussed another time – thisone converts the 8-bit binaryinto an equivalent output volt-

Page 58: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 219

age, in this example having thesame scale as the ADC.

Also at present, the DACshows the same values as theADC, and the resulting wave-form is displayed in the right-hand box (Output).

To see how the computerreads in the ADC’s binary con-version value bit, press <B>.

Note how the left-hand ADCbit (bit 7) drops down andmoves right to insert itself intobit 0 of the computer’s storagevalue (which starts off at zerofor each cycle of eight bits).

Note also how the ADC andstorage values shift left by onebinary place during the copyingprocess, with the previous bit 7being “lost”. A zero value entersthe ADC value at bit 0 at eachshift left.

When all eight bits havebeen input to the computer, thefinal byte value is copied to theDAC, and the process startsagain by the ADC taking an-other sample, with the Inputwaveform having shifted slightlyto the right.

Please be aware that theprocess illustrated is not in-

tended to represent the behav-ior of any particular serial ADCdevice, it is a very generalizedinterpretation.

To terminate the bit-shiftingprocess, press <B> again.

SAMPLING RATESWhile discussing pulse fre-

quency counting in Part 4, wereferred to the problems of sam-pling data at rates slower thanideal. We can now illustrate oneway in which the problem mani-fests itself.

With binary step samplingoff, first note the shape of thetwo sine waves (WaveformRate 1, Sample 1, as stated inthe bottom text line).

Although you will notice thatthe waveforms have slightlyrough edges, they are as closeto sine waves as we can getwith the program that createsthe display you are watching.Just for background interest –the waveforms are plotted as180 steps (pixels) across thescreen, and 140 steps verticallybetween top and bottom wave-form extremes.

For every step made by the

TEACH-IN 2000

input waveform, the outputwaveform makes the samestep, i.e. the sampling rate isjust right in order to replicate theoriginal.

However, the output wave-form will become an imperfectcopy of the input if its samplingrate is reduced – press the <*>key once, to set a sampling rateto half that of what it was(Sample 2). Now observe theextra jaggedness of the outputshape.

Press <*> a few more timesand observe the increasing dis-tortion. What is happening isthat the output waveform is be-ing “traced” horizontally acrossthe screen at a given rate. Themovement represents the Timeaxis we discussed in theResistor-Capacitor ChargingGraph of Part 2, and in thewaveform period timings discus-sion in this month’s Tutorial.

The sampling rate, though,is not fast enough to keep pacewith the trace, which continuesto show the vertical value lastsampled until the next one istaken. The steps become evenmore pronounced the more youpress <*>, and the less recog-nizable the output waveformbecomes.

Photo 5.8. Another example of the ADA demo screen, thistime showing (right) the result of using fewer sampling

Photos 5.9 and 5.10. Exam-ples of the screen demo setfor different waveform and

sample rates.

Page 59: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 220

TEACH-IN 2000pling, in this case in the com-puter simulation program, wherethe sine wave is calculated ac-cording to an angle count beingincremented – small incrementsfor slow waveforms, greater forhigher rates. Nonetheless, het-erodyning is a very real effect;undesirable in some cases(audio sampling for example),but highly beneficial in others(e.g. radio reception). The wordsuperhet is derived from theterm, although the full term inthe radio reception context isactually supersonic heterodyne– a superhet receiver mixes theincoming radio frequency with alocal oscillator frequency, toproduce a specific (fixed) inter-mediate frequency (IF) from thewhich the desired signal can bemore easily amplified and ex-tracted.

DIVERSION ENDAfter that diversion, and

coming back to the ADC sub-ject, you should now have agreater understanding of what itcan achieve and what its fail-ings can be. In addition to thesubjects listed at the end of theTutorial, next month we shallexamine Sampling in greaterdetail. Before then, see whatyou can discover for yourselfabout the subject with the aid ofyour digital and analog wave-form sampling displays.

Till next month, the authorwaves goodbye and exitsscreen-right!

CORRECTIONPart 4, Feb. ‘00, Fig.4.6.

SK1 pin 23 should read pin 32.SK1 pin 16 should read pin 23.The PCB is correct.

RATEABLE LESSONThe lesson we hope you will

take in from this is that whensampling an electronic signal,whether it’s digital or analog, thesampling rate should be care-fully chosen to obtain the opti-mum results. Too slow a rate isobviously undesirable. A furtherexample of sampling is dis-cussed next month when we il-lustrate Logic Gates (programDigital Sampling and LogicDemo is the one we shall dis-cuss in this context – see themain menu).

Play around with other inputWaveform Rates (<*> and </>)and Sample values (<+> or <–>) and see what you observe.You’ll come across some quiteremarkable output waveforms.

In some cases, especially athigher input waveform rates(25, 26, 44 and 59 for example

– with Sample = 1), you will no-tice that another waveform ap-pears to be superimposed onthe top and bottom of the over-all input screen display. Thisillustrates another by-product ofhow two frequencies can reactwith (modulate) each other.

The result is two new fre-quencies, one that is the sum ofthe originals and one that is thedifference between them. Theeffect is known as heterodyning(from the Greek heteros, mean-ing “other”, and dynamis, mean-ing “strength”).

Suppose, for example thetwo base frequencies are 2kHzand 3kHz, the sum of the fre-quencies is 5kHz, and the differ-ence is 1kHz. These two newfrequencies replace the originalbase frequencies. It should bepointed out that the reason forthe Input display also showingheterodyning is because it too isactually created through sam-

PANEL 5.1 – MEASURED OBSERVATIONSYou might think, perhaps, that in order to know the true state of

affairs regarding component values, timings, voltages and currentsetc., all you need to do is take some measurements. True, measure-ments of anything that happens in electronics can be taken, thoughfor some of them extremely sophisticated equipment is needed.

But, and this is a big “But”, no measurement can be taken instan-taneously, it’s spread over a “window in time”. Consequently, themeasurement does not show the actual state of the condition beingmeasured at a specific point in time, it simply shows an averaging-out of what might be numerous values occurring within the period ofmeasurement.

Furthermore, the value reading shown on the measuring instru-ment only reveals the value to within so many decimal places, orwithin an estimated fractional distance from a marker on a scale.Fortunately, in many electronic circumstances, only a close approxi-mation to the actual value is needed, although there are instanceswhen greater precision would be desirable.

There is a further important factor which affects the accuracy ofmeasuring some aspects of electronic circuits – the measuring instru-ment itself can affect the characteristics of the circuit point beingmeasured; significantly so in some instances, and sometimes it isnecessary to take ingenious steps to try to circumvent the problem,but even then a degree of interference will still exist. Electronics isriddled with practical examples of the Principle of Uncertainty!

Page 60: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 221

Radio Bygones MessageBoard

Welcome to our monthlycolumn related to Internet is-sues. On the web site for theprint edition of EPE atwww.epemag.wimborne.co.uk you will find indexes listing theprojects contained in issues dat-ing back to 1996, and also fur-ther details, including color pho-tos, of the constructional pro-jects which have appeared inEPE within the last 18 monthsor so. Some readers will alsoknow from the EPE Chat Zonethat a full redesign is now beingconsidered, as the site hasevolved over the past four yearsand is getting ready for a totalrebuild. A shopping cart systemis under trial, as well. We wel-come your suggestions andfeedback by email regarding ourInternet presence to [email protected]

We have also just opened amessage board system for Ra-dio Bygones readers – check inat (deep breath)www.epemag.wimborne.co.uk/radiobygones/wwwboard toleave messages or to follow upregarding antique radio sets orjust share your nostalgic memo-ries. Advertisements from theantique radio sector are alsowelcomed – and they’re free!

Still on the subject of RadioBygones, we can announce thatwe have now obtained the do-main ofwww.radiobygones.co.uk anda web site related to our sistermagazine will be open in thenear future. You will be able tosubscribe online using a secure

server and generally see whatthe magazine is about. Ameri-can and Canadian readers arewelcome to have a look atwww.radiobygones.com andan on-line version will hopefullybe produced in the very nearfuture.

Search and you willfind... an advert

If you type in the URLwww.altavista.digital.com youwill of course be redirected tothe popular search engine ofAltaVista, now atwww.altavista.com. Apart froma web site refresh, the develop-ment of this interesting and im-portant search engine haslargely gone unnoticed by manyUK users. For the benefit ofnewcomers, AltaVista was origi-nally created by the computermanufacturer Digital EquipmentCorp. (DEC) as a showcase fortheir Unix and NT mainframesand servers. Digital Equipmentsaw their powerful search en-gine as a good advert, todemonstrate the power of theirAlpha processors and servers tosearch their enormous databaseof the world wide web, and tosally forth with the closestmatches to a search enquiry.Indeed AltaVista has alwaysbeen a personal favourite, partlybecause it offers Boolean com-mand search options that comeas second nature to many elec-tronics enthusiasts (especially ifyou followed our series Teach-In 98: An Introduction to DigitalElectronics).

AltaVista’s powerful “spider”(a network search and retrievalprogram) would traverse the

web in search of links, whichwould then be cataloged andadded to the enormous Al-taVista database back home.You could also add your ownURL manually just to be sure,and indeed the task of register-ing one’s own URL into all therelevant search engines – thereare some 1,500 or more of them– is now an important elementwhen creating new web sites.(Apparently only I see the jokein AltaVista’s “Add URL” confir-mation message stating that“this URL was retrieved in 4.997seconds and will be added in aday or two.”)

In January 1998, Compaq(www.compaq.com) acquiredDEC along with its Alpha micro-processor technology and theAltaVista engine, and nearly twoyears later in November 1999Compaq announced a new line-up of “supercomputer” Alpha-based servers and workstationsfor 3D, CAD and Internet serverapplications. Compaq hadn’tbeen idle with AltaVista though,and the trusty old search enginewas destined for greater things.Very early last year Compaqannounced the development ofAltaVista as a separate com-pany – and at about the sametime it announced that it hadpurchasedwww.shopping.com, a verypopular online retailer in the US.

Then in the middle of lastyear Compaq announced that ithad sold a majority stakeholdingin AltaVista to the Internet busi-ness development and manage-ment group CMGI(www.cmgi.com), formerlyCollege Marketing Group Infor-mation Services. CMGI will de-

By Alan Winstanley

SURFING THE INTERNET

Page 61: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 222

velop AltaVista further into whatthey hope will become theworld’s largest portal.

Coupled with the fact thatCompaq Internet-ready desktopPCs were to include a ready-made link to AltaVista, it be-came clear how Compaq wasstarting to embrace the com-mercial forces of the Internetand steer business the way ofAltaVista. Compaq said thatthey would meld their consumerPresario Internet PCs withCMGI’s Internet services, byproviding keyboard and webbrowser access to AltaVista andother CMGI web offerings.

An updated AltaVista website was mooted in June ’99.The old logo and layout wouldbe replaced by a fresh newnumber in cheerful yellow alongwith all the usual portal offeringsof news, travel, shopping, jobsand so on. The shopping.comsite would also be restructuredand enhanced.

AltaVista has alreadygrown into a key portal site,which was rated at the ninthlargest domain on the entire In-ternet in early 1999, and conve-niently accessible from Compaqdesktop PCs. A quick look atthe Compaq Presario webpages (www.compaq.com/mypresario/internetservices/)on “How to Search” takes youdirectly (surprise) to My Al-taVista, where users are encour-aged to configure a start-up

page.

Disappearing URLsOne potential problem

seems to be surfacing with Al-taVista: users are complainingthat their own web site seems tohave disappeared from its list-ings, and this can be attributedto the rebuild at the end of lastyear. Webmasters should do aquick search for themselves(literally) on AltaVista and re-submit their URL. This option isburied in the Advanced Searchpage (Add/Remove a URL).Some users have quoted a pe-riod of up to six weeks beforetheir URL appears again, whichobviously means that they willlose traffic or business opportu-nities during that time.

For those of you wishing toensure that your web pages re-ceive a higher scoring in searchengine listings, you should havea look atwww.searchenginewatch.com.This provides details on most ofthe commonest engines andother tips.

It is interesting that thereseems to be no objection toCompaq’s eagerness to providea direct link to AltaVista, whichby Compaq’s own admission isalso intended, in turn, to routeconsumer Internet traffic to e-commerce sites (to the tune ofseveral million hits over Christ-mas 1998 alone). Yet many PCusers rebelled when Windows

95 included a direct and un-wanted desktop link to MSN, itsfledgling mail service and Inter-net Content Provider. This wasimmediately branded a primeexample of Microsoft’s own(failed) attempts at Internetempire-building.

Users and manufacturerscomplained even more whenMicrosoft’s Internet Explorerbrowser was being foisted onthem, to the alleged detrimentof Netscape, yet they seemhappy for consumers to besteered from their home desk-tops towards a portal site which,with a bit of luck, will ultimatelyentice them into breaking outtheir credit cards in a “seamlessinformation and shopping expe-rience” as Compaq calls it.

Nevertheless, AltaVista re-mains a firm favourite as asearch engine, although on myown recently redesigned website (http://home-pages.tcp.co.uk/~alanwin)there is a Google search engineinstalled on my “Links” page.Google is tremendously fast andslick, with none of the portalpadding of AltaVista.

You can contact me, as al-ways, by email [email protected]

Net Work

Page 62: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 223

A few months ago nowreaders Mohab Refaat andTony Soueid inquired aboutthe use of one of the mostfundamental buildingblocks of electronics,the operational amplifieror opamp. Mohab askedabout choosing opampsand we explained all themajor opampcharacteristics in the Dec ’99and Jan ’00 issues.

We now go on to addressTony’s main point: “I don’t knowwhat is inside that ‘black box’…it’s based on a differential pair oftransistors, but it’s far frombeing that simple. Can youplease supply me with someinformation?”

This is a big topic, one thatcan and does fill wholetextbooks, but we will try to givea brief overview of someimportant points.

IDENTICAL TWINSTony is right to say that

opamps are based on the“differential pair”, which we’lllook at in detail in a moment,but first look at Fig.1 whichshows a general block diagramof an opamp.

The circuitry of anoperational amplifier oftencomprises: a differential inputstage, with voltage gainfollowed by one or more further,single-ended voltage gain

stages, often with frequencycompensation, and finally anoutput buffer providing powergain to drive external loads,

but with no voltage gain. All ofthese stages are direct-coupled, which means theyare connected withoutcoupling capacitors. Directcoupling means that opampsare able to amplify DC andvery low frequency signals.

The circuit diagram for thebasic differential pair is shownin Fig.2a. Notice the symmetry

of this circuit – it is the key to itsoperation. The symmetry is soimportant that in order for thiscircuit to work well the twotransistors must have exactlythe same characteristics, i.e.they must be matched.

These characteristics mustremain matched all the time –something that, given the hightemperature sensitivity of

semiconductordevices, can onlyreally be achievedif the twotransistors arephysically closetogether on thesame piece of

silicon. Also, integrated circuitdesigners use special layouttechniques to make sure thattransistors that should bematched do indeed have thesame characteristics, despitetemperature variations and anyimperfections in thesemiconductor manufacturingprocess.

This would seem to makelife difficult for the hobbyist or

student who is interested inexperimenting with thesecircuits using individualcomponents, however it ispossible to purchase matched

Our surgery writers continue their exploration ofoperational amplifiers by delving into the innards oftypical devices to explain basic opamp principles ofoperation.

by ALAN WINSTANLEY and IAN BELL

DIFFERENTIALAMPLIFIER

+ OUTPUTBUFFER(POWER AMP.)

VOLTAGEGAIN

OUT

Fig.1. Typical opamp block diagram.

IE

bc

e

bc

e

RC RC

+VCC

–VEE

VO1

Vi1

VO2

Vi2

TR1 TR2

Fig.2a. Basic differential pair.

LM394TOP VIEW

1

2

3

4

8

7

6

5N.C. N.C.

Fig.2b. Pinout details ofthe LM394 supermatchpair (National Semiconduc-

Page 63: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 224

transistors (such as the NationalSemiconductor LM394“Supermatch pair” in Fig.2b)and some transistor arrays alsocontain differential pairs (e.g.the CA3086 “npn array”) for justthis kind of role.

SINGLE-MINDEDThe basic differential pair

(Fig.2a) has two inputs Vi1 andVi2 and two outputs VO1 and VO2.Each transistor has a collectorresistor RC as a load. Smalldifferences in the input voltagescause relatively large changesin the output voltages, also in adifferential manner (i.e. as oneoutput voltage increases, theother will decrease by the sameamount). We can, however,choose to use only one output(referred to as taking a “single-ended output”).

Key points to understandingthe circuit’s operation are firstlythat a transistor’s collector andemitter current are verysensitive to changes in its basevoltage, and secondly that theemitters are connected to aconstant current source. Thefollowing discussion assumesthat both transistors areswitched on – that is, their base-emitter voltage is greater thanabout 06V.

The constant current sourcemeans that the sum of the twoemitter currents must always beequal to IE. If the two basevoltages are equal, and thetransistors are identical, then itfollows that IE will split equallybetween the two transistors,they will draw the same basecurrent, and their collectorcurrents will be equal. As thetwo collector resistors are equal,the voltages dropped acrossthem will also be equal(assuming there is no output

subsequentstages, so having a differentialpair as the first stage is a goodway of reducing drift.

If we change the (still equal)input voltages by a largeenough amount then the circuitwill cease to function as justdescribed. For example, if wetake the input voltages down tonear VEE then the current sourcemay no longer function properly.This would determine theopamp’s common mode inputrange. Any lack of matchingbetween the transistors wouldprobably result in some shift inoutput voltage as the inputsvaried together, which wouldmanifest itself as a non-idealcommon-mode rejection ratio(CMRR) for the opamp.

INVERTED VIEWThe high sensitivity of the

transistor’s collector and emittercurrents to base voltage comesin to play when we make thevoltages at the two inputsslightly different. This breaksthe symmetry and causes alarger proportion of IE to flow inone transistor than the other.

For example, if we increaseVi1 slightly and decrease Vi2 bythe same amount, then more ofIE will flow in transistor TR1 thanin TR2. This will cause TR1’scollector to fall lower thanTR2’s, so output VO1 will belower than VO2. Thus, if we takea single-ended output from thecollector of TR2, Vi1 will act asthe non-inverting input (+) andVi2 will act as the inverting (–)input. This denotes what effecta signal on either input has onthe polarity of the output:increase the non-inverting inputand the output effectivelyincreases too. Increasing theinverting input at Vi2 will causethe output VO2 to fall (invert).

current).If the two input voltages

change together (this is knownas a common-mode inputsignal) then the symmetry willnot be disturbed and IE will stillsplit equally between the twotransistors. You may think thatchanging the input voltage mustchange the collector and emittercurrents, but it does not have to,because the emitter voltage isfree to change whereas IE isfixed by virtue of the constantcurrent source.

The ability of the matched-transistor circuitry to rejectsignals which are the same onboth inputs (common mode) isnot only important because itgives us the function of adifferential amplifier, but alsobecause it makes the design ofhigh-performance, high-gain DCamplifiers possible. Forexample, if the temperature of asingle transistor amplifierchanges then the bias currentschange too, and so therefore dothe circuit voltages.

In capacitively coupled (i.e.AC) circuits this does not matterbecause the temperaturechanges are slow and are belowthe cut-off frequency due to thecoupling capacitor. However, ifthere is no capacitive coupling(as in an opamp), any changesin voltages due to temperature(or other forms of “drift”) areeffectively indistinguishablefrom the required low frequencysignals and will be amplified bysubsequent stages.

However, if the temperatureof a properly matcheddifferential pair changes, bothtransistors are affected equallyand there is no change in theoutput (the drift is a commonmode signal). The worst placeto get drift is in the first stage asthe error is amplifier by all

Circuit Surgery

Page 64: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 225

Note that differences over afew tens of millivolts (mV) resultin most of IE flowing in one orother of the two transistors.Over a large input differencerange the response of the circuitis exponential (see Fig.3), butfor just a few millivoltsdifference between the inputsthe change in the output voltagedifference is near-enoughdirectly proportional to the inputdifference (the central part ofFig.3). So we have the lineardifferential amplifier that werequire for an opamp inputstage.

To turn Fig.2a into apractical circuit we need acurrent source, this can also beachieved using a couple ofmatched transistors such as theSupermatch pair, although thereare also more sophisticatedcurrent sources employing moretransistors. For a more detaileddiscussion of current sourcesplease refer to Circuit SurgeryMay and June 1999 in which wediscussed these types of circuitin depth.

MIRROR CURRENTA basic differential pair with

current mirror biasing is shownin Fig.4, which will hopefully befamiliar to regular readers. Theemitter current can be set using:

IE = (VCC – VEE – VBE(TR4)) / R3,

where VBE will be typically06V to 07V. To choose the RC

collector resistors (R1 and R2)for maximum swing, set thequiescent (“idle”) output voltageto half the positive supply. Thusthe quiescent voltage across thecollector resistors is VCC / 2.

Since we set IE above andthe collector current isapproximately IE / 2, then RC foreach transistor in the pair canbe calculated using:

RC = (VCC / 2) / (IE / 2)= VCC / IE.

So if the supplies are 9Vand we chose a bias current ofabout IE = 1mA then we get R3= 18K and R1 = R2 = 9K.

For any given transistor IE /2 should be chosen to give

optimal performance (transistorgain etc. varies with biascurrent). The supply currentrequired may also be aconsideration when choosing IE.Although a device such as theLM394 Supermatch pair has amaximum collector currentrating of 20mA, Nationalguarantees most parametersover a range of 1uA to 1mA.

OPAMP SELECTORTable 1 shows a

comparison between a numberof popular opamps. It is by nomeans comprehensive, asthousands of opamps areavailable, but it will at leastenable you to compare thespecifications of many well-established types. You can usethe information we haveprovided in previous issues todecipher the meanings of thedata: expressions such as“Open Loop Gain” and “SlewRate” should now be readilyunderstood (we hope).

The manufacturers’ datamust be consulted for more

Circuit Surgery

1.0

0.5

–100 –75 –50 –25 0 25 50 75 100

V – V /mVi1 i2

PROPORTION OF IN EACH TRANSISTOR

IE

TR2 TR1

Fig.3. Typical characteristics of a basicdifferential pair.

IE

bc

e

bc

e

bc

e

R1 R2 R3

+VCC

–VEE

OUTPUT VO1

INPUT Vi1

OUTPUT VO2

INPUT Vi2

IREF

TR1

TR4

TR2

TR3b

c

e

Fig.4. Basic differential pairs – simple currentmirror biasing.

Page 65: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 226

Circuit Surgerydesign information as needed,as our figures may often onlyapply under certain conditions(supply voltage, temperatureetc.). The World Wide Weboffers for the first time thepossibility of readers fetchingdata directly from themanufacturer. It’s usually inAdobe Acrobat PDF format,which needs the free Acrobatreader from www.adobe.com

Next month we will look athow gain can be improved byusing transistors instead ofresistors as loads, and considerthe problem of getting all thebias voltages right when youcannot isolate stages usingcoupling capacitors. IMB.

HOT REGULATORI built a 1A power supply

with a 317-type variableregulator. The data says that itis a 2A regulator but when Idraw 1A, the regulator gets veryhot and the voltage slowlydrops. Why?

So asked a reader in theEPE Chat Zone on our web site(www.epemag.wimborne.co.uk) recently.

Regulators are usuallyprotected against excesscurrent and thermal overload. Itsounds as though you haven’theatsinked the device properly(if at all). It’s imperative that theregulator is allowed to dissipateany power efficiently, to preventthe chip from overheating.

Fortunately, the LM317 –like many other three terminalregulators – will suffer noimmediate damage frominadequate heatsinking,because it will simply current-limit and gradually shut itselfdown. As you saw, the outputvoltage slowly falls during thisshut-down process. However,any repeated cycling like this

can stress a device over time,ultimately leading to some lastingdamage. Simply bolt it to agenerously-sized heatsink and itwill perform fine. Proper thermalresistance calculations are thebest way of determining what sizeheatsink to use. ARW.

CONVENTIONALCURRENT

Do you know why the plate ofa valve (vacuum tube) is called ananode whilst the plate on asemiconductor diode is called acathode? Most confusing. E.J.Bibby.

When I first started readingup on electronics in the early1970’s, my very first text bookstarted with valves (but hey, I’mnot that old!). Their operation wasdescribed in terms of realelectron flow, i.e. what actuallyhappened in terms of the physicsof the electron. The simplestvacuum tube is the diode,consisting of a cathode (which isa piece of metal warmed up by aheating element) together with ananode “plate”.

Electrons boil off the hotcathode and, being negativelycharged, are attracted towardsthe anode, which when positivelybiased will “accept” thesenegative electrons. The current ofelectrons which flows through thevalve in this way is called theanode current.

By placing an electrodebetween the cathode and anodeand applying a grid bias voltageto it, the anode current can becontrolled – thus a triode valve iscreated which can be used as anamplifier. This, together with myscant knowledge of NuffieldPhysics (as my schoolteacher ofthe time would testify), meant thatI started out in electronicsknowing that electric currentflowed towards the most positive

electrode. It all made sense.The trouble is, in modern

semiconductor electronics wetalk in terms of “conventionalcurrent flow”. We all do thiswithout thinking, but it’sextremely bizarre to anyonecoming into electronics fromother sciences (notably physicsand chemistry). Under thisconvention, electric current isdeemed to flow from positive tonegative, although in real life itflows in the other direction.

More than one Physicsteacher has torn a strip off mefor apparently not knowingwhich way current flows in acircuit: my apologies to Physicsteachers everywhere butunfortunately the convention isnow so well entrenched aroundthe world that it will neverchange. (Can you imagine thechaos if it did? Which wayround would you connect yourmultimeter?)

In a semiconductor diode,conventional current flows in thedirection of the arrowheadsymbol – from anode tocathode. In a silicon diode, theanode (a) must be 07V morepositive than the cathode (k) fora “forward current” to flow fromanode to cathode. However, theanode (electron) current in avacuum tube flows fromcathode to anode.

I’m afraid that we havehistory to blame for thisconundrum, but in practiceeverything works fine. After all,we know what we mean, don’twe? ARW.

Page 66: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 227

Circuit Surgery

CA3

420

CA3

140

CA3

130

NE5

534

EL20

01

EL20

44

LMC

6081

LMC

6001

-AI

N

LF44

1

LF41

1

LM30

8

LM10

741

AD74

4JN

AD71

1JN

OPA

544T

OPA

177G

P

OPA

27G

P

OP0

7C

LT10

13AC

TLC

27M

7

TLC

27M

2C

TL08

1

TL07

1

22V

36V

16V

+/-2

2V

+/-1

8V

+/-1

8V

15V

-0.3

to+1

6V

+/-1

8V

+/-1

8V

+/-1

8V

45V

+/-1

8V

+/-1

8V

+/-1

8V

70V

+/-2

2V

+/-2

2V

+/-2

2V

+/-2

2V

18V

18V

+/-1

8V

+/-1

8V

15.0

8.0

8.0

0.5--

+/-1

0V

Vs+/-V

s

+/-3

0V

+/-3

0V--

+/-4

0

+/-3

0V

VsVs--

+/-3

0V

+/- 0

.7

+/-3

0V

+/-3

0

+Vdd

+Vdd

+/-3

0V

+/-3

0V

+V +

8 to

-V -0

.5

+V +

8 to

-V -0

.5

+V +

8 to

-V -0

.5

+Vs

+/-1

5V

Vs----

+/-1

5V

+/-1

5V

+/-1

5V--

+/-1

5V

+/-1

8V

+/-1

8V

V+ +

0.7

to V

- -0.

7

+/-V

s

+Vcc

+/-2

2V

Vcc-

-5to

Vcc

+

-0.3

to+V

dd

-0.3

to+V

dd

+/-1

5V

+/-1

5V

9.0----

1150--------670

670

500--500

500

500----500

500--725

725

680

680

150u

A

1.6m

A

300u

A

4.0m

A

1.3m

A

5.2m

A

450u

A

750u

A

150u

A

1.8m

A

150u

A

270u

A

1.7m

A

3.5m

A

2.5m

A

12m

A

1.3m

A

3.3m

A

--

0.7m

A

285u

A

285u

A

1.4m

A

1.4m

A

--13V

<15V

<+/-1

6V

+/-1

1V

+/-1

3.6V

14.5

V

14.6

V

+/-1

3V

+/-1

3.5V

+/-1

4V--

+/-1

4V------

+/-1

4V

+/-1

3.8V

+/-1

3V

+/-1

4V----

+/-1

3.5V

+/-1

3.5V

2.6m

A

+40m

A

20m

A

38m

A

+/-1

00m

A

75m

A

--

+/-3

0mA

--------

25m

A

25m

A

25m

A

4.0A------

28m

A

--------

100

100

100

100

998

1.5k

V/V

1400

1400

100

200

300

400

200

400

400--

1200

0

1500

400

2500

275

275

200

200

0.05

pA

2pA

5pA

400n

A

1.0u

A

2.8u

A

10fA

25fA

10pA

50pA

10nA

10nA

80nA

30pA

20pA

15pA

0.5n

A

15nA

+/-1

.8nA

-12n

A

0.7p

A

0.7p

A

30pA

65pA

150T1T1.5T

100k

8M15M

>10T

>1T

40M

500k

2M45M

2G33M

400M----

1012

ohm

1012

ohm

1012

ohm

3x10

12oh

m

3x10

12oh

m

1012

ohm

1012

ohm

4.0

6.0

10.0

5.0--101.0

10.0

10.0

7.0

6.0

2.0

155.0

7.0--0.7

0.4

0.5

2.5

2.1

2.1

18.0

18.0

5.0

5.0

8.0

0.5

2.0

0.5

0.35

0.351.0

0.8

10.0

0.3

1.0

0.3

0.3

1.0

0.02

0.02

5

60.0

0.04

0.191.1

3.0

3.0

809090100--90857595100

100

102

908888106

115

122

120

117

949486100

0.5

7.0

<30.

0

13.0

2000

325--0.8

1.0

15----0.5

75.0

20.0

8.0

0.3

1.9

0.3

0.4

0.62

0.62

13.0

13.0

0.5M

Hz

3.7M

Hz

4MH

z

10M

Hz

70M

Hz

60M

Hz

1.3M

Hz

1.3M

Hz

1MH

z

4MH

z

----

1.5M

Hz

13M

Hz

4MH

z

1.4M

Hz

600k

Hz

8MH

z

600H

z

800k

Hz

635k

Hz

650k

Hz

3MH

z

3MH

z

908074--7580948090100

9696969595--115

120

103

120

939386100

Low

vol

tage

, por

tabl

e in

stru

men

ts

MO

SFET

inpu

t, bi

pola

r out

put

MO

SFET

inpu

t, ra

il-to

-rail

outp

ut

Low

noi

se, a

udio

, ins

trum

atio

n

Hig

h sl

ew ra

te, h

igh

spee

d bu

ffer

Low

pow

er, l

ow v

olta

ge

Prec

isio

n, lo

w o

ffset

CM

OS

Ultr

a-lo

w in

put,

inst

rum

enta

tion

Low

pow

er, j

FET

inpu

t

Low

offs

et, j

FET

inpu

t

Low

vol

tage

, bat

tery

ope

ratio

n,pr

ecis

ion

Low

vol

tage

, ref

eren

ce o

utpu

t

Obs

olet

e ge

nera

l-pur

pose

bip

olar

Prec

isio

n, F

ET in

put

Prec

isio

n, h

igh

spee

d, lo

w o

ffset

Hig

h vo

ltage

, hig

h cu

rrent

, TO

220

Prec

isio

n, b

ipol

ar, i

nstru

men

ts

Low

noi

se, l

ow o

ffset

, low

drif

t,pr

ecis

ion

inst

rum

enta

tion

Low

noi

se, b

ipol

ar in

put

Dua

l, si

ngle

rail,

hig

h ga

in

Low

offs

et, l

ow p

ower

Dua

l, lo

w v

olta

ge, p

reci

sion

Low

pow

er, j

FET

inpu

t

Fast

sle

w, j

FET

inpu

t, lo

w n

oise

Supply voltagerejectionratio dB

Bandwidth(GBW)

Slew rateV/uS

CMRR dB

Input offsetvoltage mV

Input offsetvoltage drift

uVoC

Inputresistance

Input biascurrent

Open loopgain V/mV

Output shortcircuit current

Outputvoltage swing

Supplycurrent

Max powerdiss. (mW)

Maximuminput voltage

Differentialinput voltage

Maximum supply voltage

Table 1: Opamp Selector.

Page 67: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 231

Criminals beware. An ad-venturous local police force inthe West of England is pioneer-ing the use of electronic imag-ing to lift faint fingerprints frombanknotes and check. The sys-tem relies on watermarkingtechnology developed for elec-tronic speed trap cameras butspurned by the Home Office.The mark stops lawyers discred-iting fingerprint evidence by ar-guing that digital images can beeasily doctored.

Three years ago EstherNeate, senior fingerprinting de-velopment officer at the Wilt-shire Constabulary, persuadedthe force to go out on a limband replace the ageing filmequipment in her lab with an all-digital system.

“The FBI and a few forcesround the world are mixing filmand digital technology, but weare first to replace film com-pletely,” says Neate.

Chemical IntegrityPrints from a sweaty finger

are 95 percent water and fiveper cent salts, amino acids andfats. Suspect banknotes andchecks are serially treated with14 different chemicals such asninhydrin, and a photographtaken at each stage becauseeach chemical reacts with a dif-ferent sweat component anddestroys the previous reaction.By the end of the treatment, thepaper is stained, toxic, and use-less as evidence. So any case

hangs on the quality and in-tegrity of the photos.

High intensity white light isfocussed on the print area byfiber optics, and the image cap-tured on disc by a high resolu-tion digital camera with 3648 x4623 image sensor; 12-bitmonochrome coding capturessubtle grays in a 13 Megabytefile.

Because the image is indigital code, the lab can useFourier Transform analysis toseparate the regular pattern ofbanknote printing from the irreg-ular fingerprint. Labs have triedto do this with film and color fil-ters, but electronic analysis pro-duces much clearer pictures.

An identifying watermark,with date, time and place, isembedded in the image usingVeriData iDem software fromBritish company Signum Tech-nologies of Witney. The mark isinvisible to the eye but can bedetected by analysis of the im-age file. If even one pixel in theimage is altered, it shows.

Speed TrappingSignum developed VeriData

for electronic speed traps, but inApril ’99 the Home Office ap-proved the use of SVDD (SpeedViolation Detection Deterrent)digital cameras as long as theimages are securely encryptedor carried by the closed datanetworks used on motorways.

SVDD was tested on the M1and M20, in Leicester and Kent

and approved on 1 April 1999for private data networks. Cam-eras use infrared flash to log thetime taken for a car to travel amile. They were catching 4000a day but no summonses wereissued. Now that the camerasare Type Approved the policeand local councils can installthem – but they are expensive.

Says Signum’s MarketingManager Alan Bartlett, “The UKauthorities are working on theprinciple that most motorists willnot go to the expense of legallychallenging a speeding fine. Inthe US people just shoot thespeed cameras to pieces any-way. But 30 year jail sentencescan hang on fingerprint evi-dence which will be challenged.”

The Wiltshire Constabularywill not identify individual casesthat have relied on digitallyrecorded evidence. “But for thelast 18 months all cases this labhas handled have used the pro-cess,” says Esther Neate.

Wiltshire’s camera can workwith a laptop PC running Win-dows NT, to capture fingerprintsor footprints at the crime scene.

Police forces in Singapore,Turkey, Australia, New Zealand,Belgium and the US are nowasking the fingerprinting labora-tory in Devizes to help them setup similar systems.

DIGITAL FINGERPRINTINGDigital cameras can now not only assess vehicle speed limit violations, but alsodetect fingerprints on banknotes - Barry Fox reports.

A ROUNDUP OF THE LATEST EVERYDAY NEWSFROM THE WORLD OF ELECTRONICS

Page 68: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 232

to 2Mbits/s, but will not be readyuntil 2002.

Orange recently launched anew service called High SpeedCircuit Switched Data, whichhikes the speed to 288Kbps.One-2-One will wait a year untildifferent technology, calledGeneral Packet Radio Service,is ready. Both systems are au-thorized by ETSI, the EuropeanTelecommunications StandardsInstitute, but are not fully com-patible.

HSCSD uses less error cor-rection to increase the basicGSM data rate to 144Kbps, andthen gangs channels together togive 288Kbps or higher.

GPRS works on the as-sumption that most users do notneed constant data speed. Apool of capacity serves severalusers at the same time, with bitsallocated as and when they areneeded. One-2-One plans aGPRS service for September2000, with speeds up to56Kbps, rising to 112Kbps by2001.

“HSCSD is a technologycul-de-sac” says Craig Tillotson,One-2-One’s Director of Strat-egy. “GPRS hardware will copewith HSCSD, but HSCSD hard-ware will not handle GPRS. Andif Orange pass on the true costto subscribers, HSCSD accesswill cost at least ten times asmuch as GPRS.”

“Not so”, says Stuart Scott,Orange’s Manager of InternetProducts. “We have not yet set

NEWS......

CORDLESS SOLDERING IRONBS Manufacturing tell us that their latest soldering iron, the P100,

sets a completely new standard by offering precision heating powerin the form of a tiny pen-style tool. The P100 is 19cm long andweighs just 57g, delivering up to 120W output – double that of somecompetitive irons, allowing it to be used for heavy duty electricalwork and silver soldering, in addition to precision electronics andmodel making applications.

The fuel used is liquid butane/propane gas, stored in thetranslucent handle. The tank can be refilled from a standard gascanister (cigarette lighter type). Typically each refill provides around45 minutes of continuous use. Gas is ignited by means of a sparkfrom a flint inside the tool’s cap, with its flow regulated using a slider,allowing fine adjustment down to 20W.

A wide range of attachments for the P100 are offered, toconfigure it for soldering, hot knife cutting, slicing, heating, igniting,shrink wrapping, melting, shaping and other uses. A rich choice oftips for soldering/desoldering is available, from 48mm wedges tochisels and angles as small as 1mm.

The iron costs around 18 UK Pounds and may be purchasedonline (via the web site below), or from distributors.

For more information contact BS Manufacturing Ltd., StrawhallIndustrial Estate, Carlow, Ireland.Tel: +353 (0) 503-41340Fax: +353 (0) 503-40363Email: [email protected]: www.vulkangt.com

CELLPHONEDATA WAR

By Barry FoxRival British cellphone net-

works Orange and One-2-Onehave started a GSM data speed

war that will replicate round theworld. Most countries now useEurope’s digital GSM systembut email and Internet access,at 96Kbps, is painfully slow.

The completely new Univer-sal Mobile TelecommunicationsSystem promises data rates up

Filter Software– Free!

Microchip, those ingeniousPIC manufacturers, have told usthat you can now downloadsome filter design software from

Page 69: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 233

NEWS......their web site, free! FilterLab isa software design tool that sim-plifies the design of active filtersystems using opamps as ana-log filters. It provides fullschematic diagrams of filter cir-cuits with component valuesand display of the frequency re-sponse.

FilterLab supports the de-sign of low-pass filters up to 8thorder, with Chebyshev, Bessel,or Butterworth responses, fromfrequencies of 01Hz to 10MHz.Once the filter response hasbeen identified, FilterLab gener-ates Bode plots and the circuitdiagram. It also generates aSpice model for time domainanalysis, streamlining the de-sign process.

To download Filterlab, ac-cess Microchip’s site at:www.microchip.com

PORTABLE POWER

“Run virtually anything in your car!” exclaims a Press Releasefrom Merlin Equipment. Merlin’s Cherokee unit simply plugs into acar’s cigarette lighter and converts low voltage battery power to stan-dard 230V AC mains power. A normal UK 13A socket on the unit al-lows direct connection to appliances.

The Cherokee 150 is capable of supplying up to 150 watts ofpower continuously. For appliances that require a surge of power(TVs for example), it can provide 300 watts instantaneously. Theconverter is overload, overheat and short-circuit protected. In theevent of the input battery voltage dropping below 108V, the unit willcut out – ensuring that you can re-start your car’s engine!

Merlin have a large range of other products designed for in-car,caravan or boat use.

For more details, contact Merlin Equipment, Dept EPE, Unit 1,Hithercroft Court, Lupton Road, Wallingford, Oxon OX10 9BT, UK.

Tel: +44 (0)1491-824333Fax: +44 (0) 1491-824466Email: [email protected]: www.the-merlin-group.com

Power Linesand Health

The National RadiologicalProtection Board (NRPB) is toinvestigate recent claims that acausal link between power linesand human health can be estab-lished. It states that theseclaims need to be comparedwith the findings of the first pa-per from the UK Childhood Can-cer Study (UKCCS) whichshows no increased risk ofchildhood cancer associatedwith magnetic fields from theelectricity supply. This definitivestudy, looking at actual cases ofchildhood cancer and controls,is the largest of its type in theworld.

For more information, con-tact NRPB, Chilton, Didcot,Oxon OX11 0RQ, UK.Tel: +44 (0) 1235-822744Fax: +44 (0) 1235-822746Web: www.nrpb.org.uk

Electronic PurseOne of the many documents that have come to us in connection

with the Smart Card 2000 exhibition and conference (8-10 Feb 2000,Olympia, London), highlights the question “Have Europe’s banks in-vested millions developing a product no-one wants?”. The productreferred to is the “electronic purse”.

Page 70: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 234

NEWS......Electronic purses have

been the cherished goal ofbanks and other global organi-zations for around 10 years. Ap-parently, though, in many mar-kets consumer feedback indi-cates they are not a viableproposition.

The concept of a cash-lesssociety is proving difficult for

the consumer to accept. If thepublic is not ecstatic about theconcept, neither are many ofEurope’s bankers who are fac-ing losses of up to two euros perpurse card per annum. In somecountries the costs of persuad-ing the customer to load anduse the card exceed incomes byseveral times.

So will we be jingling thecoins in our pockets in 10 yearstime? As we go to press, suchmatters are due to be discussedby delegates at the conference.

Page 71: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 228

Robert Penfold looks at the Techniques of Actually Doing it!

In a previous PracticallySpeaking article we consideredthe subject of capacitors, andthis month we move on to thatother humble component – theresistor.

At a guess, in most projectsabout half the components areresistors, so beginners have toget to grips with resistors rightfrom the start.

The basic unit of resistanceis the Ohm, but this is a smallunit of measurement. Hence theresistors used in electronic cir-cuits often have values of thou-sands or even millions of ohms.

The usual abbreviation forohm is the Greek letter omega(), but these days an uppercase letter “R” is sometimesused instead. (In EPE and EPEOnline we tend to use the

omega symbol up to 999 ohms).Large values are expressed ineither kilohms (k or just k) ormegohms (M or just M). Akilohm is equal to 1,000 ohms,and a megohm is 1,000,000ohms.

COLOUR BAROne immediate problem

facing the beginner is that mostresistors are not marked withvalues using normal text char-acters. Instead a system of“color coding” is used, and thereare four or five colored bandsmarked around the body ofeach component.

This may seem to be an un-necessarily awkward way ofhandling things, but you have tobear in mind that the averageresistor is an extremely small

component. Youwill often be deal-ing with resistorsthat are no more

than about one millimeter in di-ameter.

Any lettering on a compo-nent this small would have to beminute, and would also be eas-ily obliterated. Color codes arerelatively easy to read, andeven if they become damaged itshould still be possible to readthe values of components cor-rectly.

The normal resistor colorcode has four bands, with threebands grouped together. It isthese three that indicate thevalue of the component whilethe other one shows the toler-ance rating of the component.The tolerance is simply themaximum deviation from themarked value given as a per-centage. Thus, if a 100 ohm re-sistor has a tolerance rating offive percent, its actual valuewould be between 95 and 105ohms.

The group of three bandsindicates the first two digits of

BlackBrownRedOrangeYellowGreenBlueVioletGrayWhiteGoldSilverNone

Band 4Band 3Band 2Band 1Color

0123456789------

0123456789------

x1x10x100

x1000x10000

x100000x1000000

------

x0.1x0.01

--

--1%2%----

0.5%0.25%0.1%

----

5%10%20%

Table 1: Resistor Color Code

1.01.83.35.6

1.12.03.66.2

1.22.23.96.8

1.32.44.37.5

1.52.74.78.2

1.63.05.19.1

Table 2

Fig.2. Two methods of five-bandresistor color coding.

Page 72: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 229

the value and the multiplier.Fig.1 shows the function of eachband. Table 1 shows the mean-ing of each color when it ap-pears in each band.

As an example, supposethat a resistor has red–violet–orange–gold as its color code.The first two bands indicate thefirst two digits of the value, andin this case red and violet re-spectively indicate that theseare two and seven. The thirdband is orange, which meansthat the first two digits must bemultiplied by one thousand inorder to give the value in ohms.

This gives 27 x 1000 and ananswer of 27,000 ohms (27 kilo-hms (27k)). The color of thefourth band is gold, and the re-sistor therefore has a tolerancerating of five percent.

PREFERREDVALUES

Resistors are normallyavailable in what is called the“E24” series of values. The ba-sic E24 series of values is listedin Table 2, but values ten timeshigher, a hundred times higher,etc. are also available, up to anormal maximum of 10megohms (10M). Values onetenth and one hundredth of thebasic values are also available,but are relatively difficult to ob-tain.

This range of values mightlook rather random at firstglance, but each value isroughly ten percent higher thanthe previous value in the series.Together with the inclusion ofthe same values in variousdecades, this means that one ofthese “preferred” values will al-ways be close to the requiredvalue for a resistor. In fact theideal value calculated by a cir-cuit designer should never be

more than about five percentaway from a preferred value.

Most resistors are availablein the full E24 series, but someare only available in the E12series, which is every othervalue in the E24 series (10, 12,15, etc.). Most electronic pro-jects only use resistors havingvalues from the E12 series.

BUNCH OF FIVESRather unhelpfully, many of

the resistors now sold to ama-teur users have five bandcodes. These operate in themanner shown in Fig.2. The firstof these is quite easy to use be-cause the first four bands givethe value and tolerance rating inthe normal way. The additionalfifth band shows the tempera-ture coefficient of the compo-nent, which is not somethingthat is normally of any rele-vance. If the fifth band is ig-nored, the other four give thevalue and tolerance rating in theusual fashion.

The second form of fiveband coding is probably themore common one, and isslightly more difficult to dealwith. Again, it is not that far re-moved from the four-bandmethod.

The first two bands indicatethe first two digits of the value,and the last two bands providethe multiplier and the tolerancerating. The difference is that anadditional middle band is usedto indicate the third digit of thevalue.

This method of coding canhandle non-standard valuessuch as 267k, but as these arenot used in amateur electronicsthis is irrelevant to the electron-ics enthusiast. The normal four-band method of coding is allthat is needed.

Nevertheless, this form offive band coding does seem tobe used on the resistors sold toamateur users. When applied tonormal E24 values the thirddigit is always zero, and thethird colored band is thereforeblack.

To compensate for this ex-tra zero the multiplier value isreduced by a factor of ten. Tak-ing our earlier 27k example, thiswould become red–violet–black–red–gold. This gives 270x 100 = 27,000 ohms.

COMPOSITIONIn component catalogs you

will find resistors described as“carbon film” and “metal film” or“metal oxide”. The simplest re-sistors are the carbon composi-tion type, which are basicallyjust pieces of carbon with anelectrode attached to each end.

These have now been re-placed by carbon film resistors,which consist of a former madefrom an insulating material hav-ing an electrode at each end. Afilm of carbon is deposited onthe former, and the resistancevalue obtained depends on thethickness and the exact compo-sition of the film. Carbon filmresistors are adequate for mostapplications, and are the typenormally specified in compo-nents lists.

Metal film resistors are theusual choice for more demand-ing applications. They are simi-lar in construction to carbon filmresistors, but the film is basedon a metal oxide instead of car-bon. Resistors of this type nor-mally have close tolerances oftwo percent or better, and gen-erate less electrical noise thanany form of carbon resistor.Their values are also affectedless by temperature changesand aging.

Practically Speaking

Page 73: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 230

Metal oxide resistors areneeded for some demandingapplications, such as in criticalstages of test equipment and inlow noise audio preamplifiers.They can be used in place ofcarbon resistors for general use,but it makes sense to usecheaper carbon resistors in anyapplication where they will suf-fice.

HIGH POWERSome resistors do actually

have the values written on thebody using ordinary text charac-ters, but in recent years this issomething I have only encoun-tered on higher power resistors.Most of the resistors used inelectronic circuits have to dissi-pate very low power levels, andsmall resistors having ratings ofabout 025 watts are perfectlyadequate.

Some circuits have the oddresistor or two that has to han-dle higher power ratings. Com-ponent lists normally indicate asuitable power rating for all theresistors anyway, but a suitablerating should certainly be givenfor any high power types.

It is very unusual for resis-tors having power ratings ofmore than about one watt (1W)to have the value marked usingcolored bands. The larger physi-cal size of these resistorsmakes it possible to mark thevalue using text characters ofreasonable size.

The value is invariably

marked on the resistor in thesame form that it appears on acircuit diagram. In other words,the letter used to indicate theunit of measurement is alsoused to denote the position ofthe decimal point. A value of27k would be marked as “2k7”and a value of 047 ohms wouldbe marked as “047’’ (or“OR47”).

There will usually be othermarks as well, some of whichmight simply be the makersname, a batch number or some-thing of this type. Of more use,there will probably be a wattagerating and a letter to indicate thetolerance rating of the compo-nent. Table 3 shows the corre-sponding tolerance rating foreach of the code letters used.

High power resistors havevarious compositions, but thewirewound variety is by far themost common. This consists ofa coil of resistance wire woundaround what is usually a ce-ramic former.

One slight problem withwirewound resistors is that thecoil of wire also acts as an in-ductor, although most compo-nents of this type are con-structed in a fashion that mini-mizes this problem. Even so,wirewound resistors are lessthan ideal for some applica-tions, and if a different type isindicated in the components listit is advisable to use the speci-fied type.

Very high power resistorshave metal fins to help conductheat from the component intothe surrounding air (Fig.3).Many of these resistors alsohave to be mounted on a sub-stantial piece of metal, whichacts as a heatsink and providesfurther cooling. With resistorssuch as this, the article shouldgive guidance on using the re-

sistors, and this must be fol-lowed “to the letter”.

POTENTIOMETERSThe terms “potentiometer”

and “variable resistor” tend tocause a certain amount of con-fusion. A potentiometer (“pot”)has three terminals, and be-tween two of these there is afixed resistance. There is a vari-able resistance between theseterminals and the third one.

A potentiometer consists ofa track of carbon with a terminalat each end of the track. Thethird terminal connects to awiper that can be moved alongthe track by means of a spindle.

There are also preset poten-

Practically Speaking

Letter Tolerance

FGJKM

1%2%5%

10%20%

Table 3

Fig.3. High power wirewoundresistor in an aluminum heat

dissipater.

Table 4

Letter PotentiometerType

ABC

LinearLogarithmic

Anti-logarithmic

tiometers that have no spindle,but can be adjusted using ascrewdriver. With an open con-struction preset potentiometerthe track, wiper, and terminalsare all clearly visible (seeFig.4). The greater the amountof track between the wiper andone of the fixed terminals, thegreater the resistance betweenthem as well.

The normal way of using apotentiometer is with an input

Page 74: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 231

voltage across the track, and avariable output voltage is thenavailable from the wiper(moving contact) and one of thetrack terminals. Strictly speak-ing, the components you buyare always potentiometers hav-ing three terminals, but in someapplications it is a variable re-sistance that is required. It isthen only necessary to use thewiper terminal and one of thetrack connections.

Potentiometers are avail-able in three types, which arethe linear (lin), logarithmic (log)and anti-logarithmic varieties. Alinear potentiometer gives ap-proximately equal resistancebetween the wiper and the twotrack terminals when it is at acentral setting, as one wouldexpect.

A logarithmic potentiometerproduces vastly different resis-tances under the same condi-

tions. So does an anti-logarithmic potentiometer, butwith the high and low values theother way around.

When used as a volumecontrol a linear potentiometergives an odd control character-istic, with the volume seemingto jump to a high level when it isadvanced slightly from zero.Further advancement thenseems to have little effect. This

is due to the way we perceivesound rather than a problemwith the potentiometer.

When used as a volumecontrol, a logarithmic poten-tiometer gives a much bettercontrol characteristic. Logarith-mic potentiometers are used forlittle other than volume controls.Anti-logarithmic controls are dif-ficult to obtain and are onlyneeded for a few specialist ap-plications. If you use a poten-tiometer of the wrong type thecircuit will still work, but the con-trol will be awkward to use.

AS EASY AS ABCThe values of potentiome-

ters are marked using text char-acters, together with the type“log”, “lin” or “anti”). These daysmany potentiometers aremarked with a code letter to in-

Practically Speaking

Fig.4. “Open Track” presetpotentiometer.

Page 75: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 235

WIN A DIGITALMULTIMETER

The DMT-1010 is a 3 1/2 digitpocket-sized LCD multi-meterwhich measures a.c. and d.c.voltage, d.c. current, andresistance. It can also testdiodes and bipolar transistors.Every month we will give aDMT-1010 Digital Multimeterto the author of the bestReadout letter.

* LETTER OF THEMONTH *

A-LIVE-A-LIVE-OH!Dear EPE,

A friend recently drew myattention to the current series youare running on Oscillators (sinceJuly '99). Having obtained theSeptember issue, I sent for theprevious issues. What interestingreading they make!

I have been pleasantlysurprised by the exchange ofinformation with readers inReadout, and the informativelevel of Circuit Surgery.

Arthur Lawrancevia the Net

It is an interesting fact that,despite attempts atstandardization, English continuesto evolve and, irrespective of“official” definitions, the perceived

meaning of many wordschanges amongst the generalpopulation. There are manycases, too, where words haveacquired different meaningsdepending on the context inwhich they are used.

It’s worth remembering (oris it?!) what Alice’s Wonderlandfriend Humpty-Dumpty said (in arather scornful tone), “When Iuse a word it means just what Ichoose it to mean – neithermore nor less”!

TEACH-INS PLUS EPEONLINEDear EPE,

Thank you for not only thenew Teach-In 2000 series, butfor the Teach-In 1998 series aswell. I credit knowledge gainedfrom that for helping to secure anew job. Many companies arenow giving a written skills testfor technical positions and Iwould not have been able topass the electronic and digitalportions without your magazine.(My experience is in hydraulicand pneumatic systems.) Theseries was so well written, Ilearned enough basicelectronics as well as digital tobe hired. I have sincecompleted a well-knowncorrespondence course in basicelectronics for which myemployer will reimburse me. Ifound your Teach-In series to bebetter written and moreunderstandable than theirs. Ialso wish they had been able toprovide the interactive softwareI downloaded for the Teach-In

2000 series. It is always usefulto reinforce what you have readwith practice. I have subscribedto the Online version of yourmagazine and am lookingforward to every issue. I have afew suggestions which I wouldlike to see if possible.

I enjoyed the PDF filesbeing separate files so that Icould save the Teach-In 2000from the Nov ’99 issue to afloppy disk to view it at work onbreaks and between servicecalls. (Remember the“paperless office” hype?). I amnot able to do that with the Dec’99 issue. The only way to carrythe information with me now isto print those pages out as thewhole file is over 3MB. I hopeyou have plans to make thecomplete series and theprevious Teach-In seriesavailable for purchase via theInternet as well. This would bemost helpful to readers likemyself in Macon, USA, whoseonly source for EPE is onebookstore which stocks fourcopies. I missed some of thePIC Tutorial because it was soldout.

Thanks for a greatpublication.

Alan CraigMacon, Georgia, USA

Alan E-mailed hiscomments to our On-Line EditorAlan Winstanley, who E-mailedback:

We’re really pleased to hearthat Teach-In 98 was of benefitto you, your compliments are

John Becker addresses some of the general points readers have raised. Haveyou anything interesting to say? Email us at [email protected]!

Page 76: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 236

much appreciated. Writing thatseries was hard work! We triedto mix together the essentialtheory along with some practicalwork. It was also difficult to co-ordinate the material originatingfrom four writers, to a very tightmonthly deadline. The advent ofdigital cameras helped a lot.

The development andproduction time for Teach-In 98was shorter than that of Teach-In 2000, which has been inpreparation for at least a year.There has therefore been muchmore time available to developthe Teach-In 2000 programs (Ithasn’t felt like it! JB), and itsauthor John Becker is veryskilled at producing QBasicelectronics demo or test andmeasurement software.

It is possible to buyphotostats of any out-of-printEPE Back Issue articles directfrom the UK. These can beordered via our secure server,accessible from the EPE website atwww.epemag.wimborne.co.uk

Alan W also forwarded AlanC’s queries on EPE Online to itsEditors Max and Alvin inAlabama, USA, from whencethe electronic version is servedout. Max responded:

Thank you for your kindcomments – it’s always great toreceive positive feedback. Sorryto hear that you would prefer toreceive the Online magazine asmultiple small PDFs. In fact, themain reason we decided tomove to a single large PDF isthat a lot of readers requested itthat way (to make it easier toprint out the entire issue in onego). However, you will be happyto know that once the Teach-In

2000 series is finished, we areplanning on offering the wholeseries on a single CD (actually amini-CD that would fit into yourwallet, so that you can easilyread the articles whilst on theroad).

Furthermore, we’re alsoplanning on offering the entireset of EPE 1999 issues onthese mini-CDs for ease ofreference. Watch our web pageat www.epemag.com for moredetails in the near future.

PERSEVERENCEDear EPE,

I have had the PIC Electricproject (Feb-Mar ’96) hangingaround for some time, andmuch to my irritation I havebeen unable to resolve aproblem with it: the LED displaycontinually shows flashingFFFF. The middle FF are fairlystable, but the outer two FFsegments are dimmer and flashin a more pronounced fashion.

The circuitry has beenconstructed on PCBs purchasedfrom you, using recommendedcomponents obtained throughRS. I have checked connectionsand component layout and canfind no problem with these. Ihave tried down-loading theprogram for the PIC a numberof times, from a ‘486 66MHzPC. Using both the on-boardcomponents, Simple PICProgrammer and also thePICtutor board, I always endwith the same results.Adjustment via the calibrationbuttons appears to do little. The+15V, –15V, +5V and TP7check out OK. The A-Dreference voltage has beenadjusted as advised. Pleasecould you offer somesuggestions?

Steve Goochvia the Net

I wondered if Steve had apower supply regulationproblem, the rectified output ofREC1 not providing sufficientvoltage when the display hasmany digits active. This couldaffect synchronization andindeed the correct operation ofthe PIC. Making this suggestionto Steve, he later replied:

Thanks for your suggestion.The problem was with the PICprogramming. Why, remains amystery, data transmissionspeed? A preprogrammed chipfrom Magenta cured all,however. Thanks for theexcellent magazine – and theback-up support.

PIC16F877 PROBLEMSOLVED

Here’s another tale with ahappy ending. First the problem:

Dear EPE,Many thanks for the

PIC16F87x Mini Tutorial (Oct’99). It was just what the doctorordered, the inclusion of theBasic program was amasterstroke, my attempts tocalculate baud rates hadproduced some improbableresults, most of which would nothave fitted into an 8-bit register.

However, I am experiencingdifficulties re-programming aPIC16F877. I’ve built a boardalong the lines of your DataLogger (Aug-Sept ’99), minusprovision for EEPROMs, andconnected it to my EPE PICTutorial (Mar-May ’98) boardand all went well. I ran the inputport test program of Toolkit Mk2(May-Jun ’99), all voltages

Readout

Page 77: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 237

present and correct, plugged inmy ’877 and compiled andprogrammed TKTEST4 into thePIC. It ran and the LEDs flashed.

I then compiled (with noerrors) my own program (wellactually most of it was yours fromMini Tut) intended to initialize theUSART with a baud rate of31.250kHz and loop 10101010 togive a nice square wave out ofthe port. I re-configured the PICand then programmed it with myown program. Nothing appearedto be working, so I assumed thatthere was a problem with myprogram and re-loadedTKTEST4. Nothing happened, thePIC appeared dead. It seemedimpossible to program it now. Incase the PIC had developed afault I plugged in another.TKTEST4 went straight in andran. I then attempted with my ownprogram again and I have exactlythe same problem i.e. I cannot re-load TKTEST4 successfully.

I have thoroughly checkedmy board, PIC Tutorial board,etc. and can see no dry joints. Ihave checked the clock with anoscilloscope and the 4MHz clockis running, I have re-checked allvoltages with the input port testprogram of Toolkit Mk2 again andall voltages are present andcorrect, the 12V programmingvoltage switches between 12Vand 5V as it should.

Derek Johnsonvia the Net

That, then, is the outline ofDerek’s PIC problem, and he hadobviously taken the correct stepsin trying to determine the cause ofthe problem. The only thing thatoccurred to me was that it mightbe a PIC configuration problem –the settings having becomecorrupted in some way. Isuggested such to Derek andrecommended that he

reconfigured as I described inMini Tut.

Then comes the followingreply back from Derek a coupleof weeks later:

Have cured my problem! –by accidentally re-compilingTKTEST1 and loading it. It ranstraight away. The problem withmy program was due to havingalready defined PAGE1 andPAGE0 in the header. I then re-equated them to suit theSETBAUD routine in your MiniTut. I assumed that it would beOK to use either routine, toselect pages. Apparently not.After removing the equates forRP0 and RP1 from the header,the program ran.

Many thanks for yourconcern.

An interesting situation andsolution – from which all us PICprogrammers should learn alesson!

TASM, MPASM MEANSSPASMDear EPE,

Recently I got hold of theSimple PIC Programmer asfeatured in EPE Feb ’96. Oncebuilt it has all worked fine andhas spurred me on to delvedeeper into PIC programming,However, I would appreciate it ifyou could just clear up a coupleof things that are driving mebonkers.

Firstly, the kit came withTASM. I assume that TASM is aforerunner of MPASM which Isee and hear about wherever Igo, and a specially written(guessing again) program calledSEND.EXE. The prog iscompiled with TASM anddownloaded to the chip via the

parallel port, all well and good.Next I decided to get

“EASYPic’n” to start learning.This is where it’s all got a bitcloudy. EASYpic’n writes outthe code ready to be compiledby MPASM. Undeterred by this Itried to use TASM instead (it’sall I have!). Of course doing thisthrows up lots of errors and ittakes a while to sort them out.At first this wasn’t too bad, butas the progs move on its allgetting a bit too much.

Now, I did downloadMPASM from Microchip’swebsite and thought that wouldbe it. (Ha, as if!) Of courseMPASM converts my .ASM filesto .HEX files. But when it comesto downloading to the chip,SEND.EXE needs to see .OBJfiles. (Dare I ask what thedifference is?) which is fine withTASM but no good with the hexfiles of MPASM. So what do Ido with these hex files?

Next I downloaded MPLABfrom Microchip. This is fine andI could probably get used tothat. The thing is I’m not sure ifthat has something built in thatwill do something with the hexfiles and then download them.Maybe its Picstart Plus.

Any reference toprogramming the chip seems torefer to serial connection, andguess what – my TASM thingyplugs into the parallel port. Ismy kit a bit of a dinosaur? Howdo I get my MPASM generatedhex files to the chip? Do I nowneed a serial programmerinstead? (I bet this is where freedownloads end.)

Is there another EPE projectthat gets around theseproblems.

Mick Tinkervia the Net

Readout

Page 78: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 238

Such confusion Mick! First letme say that you seem not to havebeen a regular reader of EPE,otherwise your knowledge of PICprogramming requirements andtechniques would have increasedthrough reading the severalarticles that we have published onthe subject since the Simple PICProgrammer.

In particular you should readthe PIC Tutorial series of Mar-May ’98 (which discusses PICprogramming at some length),PIC Toolkit Mk1 of July 98 (whichdiscusses not only programmingbut also the differences betweenMPASM and TASM), PIC ToolkitMk2 of May-June ’99 (which is amuch enhanced version of theMk1 and has many of thefeatures you obviously have needfor, including the ability totranslate between MPASM andTASM – it also allows the newerPIC16F87x series to beprogrammed, as well as the ’84series).

We strongly recommend thatyou, and other readers in a similarposition, should read thesearticles, which I am sure will clearup a fair number of yourproblems. I would comment,though, that as you have MPLAByou should make an in-depthattempt to get to know it, and toalso obtain the other hardwareassociated with it. As good asToolkit Mk2 is, it does not coverthe full range of PICs that aremanufactured, whereasMicrochip’s hardware/softwaresuites are designed to do so(after all, Microchip are themanufacturers of the PICs and soprovide a full backup for their usein industry). Rather than discuss itall further here, do read theabove-mentioned articles,available as back issues (orphotocopies in some cases) fromthe EPE Editorial office.

FLAWED PIRACY-PROOFING?Dear EPE,

I found the Pirate-ProofCDs (News, Dec ’99) interestingbut flawed. Have the people atC-Dilla forgotten that acomputer comes with an AudioLine-in and some moreexpensive sound cards havedigital inputs, and certain CDPlayers have digital outputs? Soif a CD player disregarded thefalse error correction codewould the false code be sentthrough the digital outputs?(Hmm, I wonder).

But that aside, pirates wouldjust sample from a CD player’saudio outputs to a PC’s audioinputs, and using a good PCsampler, save on to a harddrive track by track. After doingso they could (without the falsecode) be put on a CDR disk andthen copied as many times asthey liked. All in the time ittakes to play a regular CD, so itseems the pirates will still beone step ahead, and that it justmerely slows them down.

I think true anti-piracy willcome when CD media is old hat(I predict in about 10-15 years),and solid state memory sticks orcards are the norm. Usingencryption and digital ID tags,the consumer when buyingmusic from a store would havehis ID put onto the card, this IDwould come from themanufacturer of the card playerand would be unique, thereforenot allowing it to be played onany other player even if copied.

Darren Portsmouthvia the Net

An interesting point, Darren,and one I am not qualified tocomment on. Any readers care

to comment further?

PIC vs AVR ETCDear EPE

PICs are definitely excellentmicrocontrollers, but it does notmean they are the onlymicrocontrollers. There areother good microcontrollers likeAtmel AVR or Scenix SX. Byusing only PICs you are limitingyour magazine’s resources.Some good projects with othermicrocontrollers will definitelyopen your magazine to a muchwider audience.

I am not saying to throwaway the PIC, it should beincluded, as it is very good forfirst time programmers, and alot of your loyals also use PICs,but loyals like myself feel thatwe should not be confined to asingle subject but rather exploreall the possibilities.

Let me tell you whathappened to me, I am a studentand my professor gave anassignment, to design a datalogger but to design it from anyother microcontroller exceptPICs. None of my colleaguesalong with me were able to dothat. We had to hear a longlecture on how we have gottenused to spoon-feeding, and hadconfined all our attention on asingle topic. After graduatingand getting a job we might beasked by our superiors to designa project from Atmel AVR, thenwhat will we do?

Ziyad Saeedvia the Net

Editor Mike Kenward replieddirectly to Ziyad:

I can understand that as astudent you will need to learnabout other microcontrollers, butyou should realize that for thetype of projects we publish the

Readout

Page 79: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 239

PIC is usually the best andeasiest solution.

We have published projectsfor the Atmel AVRmicrocontrollers, but fewreaders were interested. Whilstwe do publish a range ofeducational items we cannotundertake to teach you about allthe subjects you will undertake– sometimes you will need tofind resources elsewhere.

To which I will add my owncomment that I was personallyvery disappointed that the AVRsdid not receive the readerresponse I had hoped for. I hadfelt that we should activelydemonstrate thatmicrocontrollers other than PICswere in commercial use and Iwas quite prepared to learnabout them for myself and onbehalf of you all! But, as so fewreaders have expressed aninterest in AVRs, I too shall stickwith PICs, which I must add, arenot only “good for first timeprogrammers”, but are widelyused by professional designersin industry.

VOLTAGE MONITORDear EPE,

I am writing in regard to theVoltage Monitor Starter Projectin the Feb ’00 issue. Since I ama beginner and am following theTeach-In 2000 series, I thoughtthat this would be an excellentproject to build and use toensure that the voltage level ofthe battery I am using whendoing the practical experimentsdoes not fall below a criticallevel.

You give very clear andeasy-to-follow instructions fordetermining threshold voltagesof the detectors when using thedevice to monitor batteries of

voltages different to 12V. Butwhat are these thresholdvoltages for a 6V battery? Iwould assume the upperthreshold level to be 6V, but Ihave no idea what the lowerone should be. I would be mostgrateful if you could recommendto me suitable thresholdvoltages, bearing in mind thatthe project is to be used inconjunction with the powersupply for your Teach-In series.

I would like to say that I findthe Teach-In series excellent. Itexplains concepts in a clear,thorough and practical way, andI have really enjoyed learningthrough it.

John ThorntonSunderland

The Teach-In circuits shouldfunction even with voltage levelswell below 5V, even as low as4V. When new, your 6V batterywill probably deliver about 65V.I would probably regard 55V asbeing the level at which I wouldreplace the battery, and so setone threshold for a little abovethat, and another for about 6Vas advance warning that “fuel” isbeginning to get a bit low. But inmany ways, it’s a somewhatarbitrary matter since theamount of current beingconsumed will determine whatmay be regarded as areasonable life expectancy forthe power remaining in thebattery. It’s like with car driving:my fuel light comes on when thetank is down to a quarter full. Itis typically a 500 mile tank andso I know that I probably stillhave well over a hundred milesbefore having to walk! Ahundred miles on the motorwayis less than two hours of fuelremaining. Driving locally to theshops and back, the same fuelprobably represents several

days. f you really feel in dangerof “running out”, keep a back-upfuel supply available, in yourcase keep another batteryhandy. I compliment you,though, on your initiative in thismatter. Building the VoltageMonitor will not only prove to beuseful constructionalexperience, but using it will alsohelp reinforce your concept ofelectronic power consumption.FTP PLUS TI2KDear EPE,

In Readout it seems somefolks have a problemdownloading from the FTP site,or they are getting corruptedcode. I always use WS_FTP,which is a free shareware FTPprogram. It’s very easy to usefor both down and up loading!

I have downloaded theTeach-In 2000 software andhave to say I like it, it will provevery useful. The pots screen isuseful and the cap-resistor timeconstants, can’t wait to see howyou convert the printer port to afrequency counter! What Iwould like to see added is a 555timer time-freq calculator andbasic opamp configuration withgain calc, etc.

Mel Saundersvia the Net

Hopefully, you should knowby now details were given inFeb ’00 issue, easy isn’t it?!Sorry to disappoint, though, I’mnot covering 555s in TI2K. Theaim of the series is to achieve abroader sweep without gettinginto specific named devices.Besides which, there’s beenenough published on 555s to fillthe British Library twice over(much of it originating in EPE) –I’ve no wish to add to the glut!

Readout

Page 80: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 240

Some ComponentSuppliers for EPE OnlineConstructional ArticlesAntex

Web: www.antex.co.ukBull Electrical (UK)

Tel: +44 (0) 1273-203500Email: [email protected]: www.bullnet.co.uk

CPC Preston (UK)Tel: +44 (0) 1772-654455

EPE Online Store and LibraryWeb: www.epemag.com

Electromail (UK)Tel: +44 (0) 1536-204555

ESR (UK)Tel: +44 (0) 191-2514363Fax: +44 (0) 191-2522296Email: [email protected]: www.esr.co.uk

Farnell (UK)Tel: +44 (0) 113-263-6311Web: www.farnell.com

Gothic Crellon (UK)Tel: +44 (0) 1743-788878

Greenweld (UK)Fax: +44 (0) 1992-613020Email: [email protected]:www.greenweld.co.uk

Maplin (UK)Web: www.maplin.co.uk

Magenta Electronics (UK)Tel: +44 (0) 1283-565435Email:[email protected]:www.magenta2000.co.uk

MicrochipWeb: www.microchip.com

Rapid Electronics (UK)Tel: +44 (0) 1206-751166

RF Solutions (UK)Tel: +44 (0) 1273-488880Web: www.rfsolution.co.uk

RS (Radio Spares) (UK)Web: www.rswww.com

Speak & Co. Ltd.Tel: +44 (0) 1873-811281

EPE ICEbreakerApart from the specially

programmed PIC16F877microcontroller chip, most of theother components needed toconstruct the EPE ICEbreakerproject are fairly common items.The “firmware” program in thechip is loaded and copy-protected (in the upper half ofthe 8K program memory) and isnot available in any other way –you must purchase thepreprogrammed PIC chip tobuild this project.

We have reached a specialagreement whereby we are ableto offer a ready-programmed,20MHz version, PIC16F877chip together with a floppy diskcontaining the ICEbreakersoftware and the printed circuitboard (code 7000257) -- see theEPE Online Store atwww.epemag.com

Also, the ICEbreakersoftware, including the simpletest program and demoprograms, is available for freedownload from the EPE OnlineLibrary at www.epemag.com

A special package has beenput together by MagentaElectronics, which contains thefollowing: preprogrammed16F877 (20MHz version),printed circuit board, solderlessbreadboard, LCD display

module, floppy disk, BT47 relay,9-way PC serial lead (25-wayextra), and all othercomponents. They have evenincluded a low-voltage steppermotor and UK mains adapter,“plug” type, power supply.

All this for just 34.99 UKPounds plus 3 UK Pounds postand packing. For full detailscontact Magenta Electronics

2000.co.uk or E-mail:[email protected].

Finally, we understand thatsome overseas readers(particularly in USA) may havedifficulty in obtaining the ZTXtransistor. The designer informsus that most general purposenpn types rated at 1A 60Vshould work (though not tried) inthis set-up.

High PerformanceRegenerative Receiver

Some of the componentsneeded for the HighPerformance RegenerativeReceiver may be hard to trackdown. We have not included theJackson type tuning capacitorsin our pricing for this project, asit will depend on the conditionand “newness” of thesevariables. We suggest you shoparound for these items as theycould add as much as 30 UKpounds, or nearly double theprice, of this Receiver. Try BullElectrical or J&N Factors (Tel:+44 (0) 1444-881965), who maybe able to offer a good price, ifthey still stock them. You canalso try Mainline Surplus Sales(Tel: +44 (0) 870-241-0810).

We found that some of thetype numbers quoted for theTOKO tuning range coils did nottally with our information and

with DAVID BARRINGTON

Page 81: Volume 2 Issue 3 March 2000 - pudn.comread.pudn.com/downloads164/doc/project/746980/Automation/... · 2006-11-14 · By the time the unit was finished it weighed about 10kg and measured

Copyright © 2000 Wimborne Publishing Ltd andMaxfield & Montrose Interactive Inc

EPE Online, March 2000 - www.epemag.com - 241

could have caused realproblems. However, thanks tothe designer’s, Raymond Haig,efforts in double-checking withthe TOKO suppliers, we nowhave the correct type numbers.

The TOKO coil numbersand ranges used in theReceiver have been set out in atable (next month) and werepurchased from Bonex Ltd (Tel:+44 (0) 1753-549502). Typenumbers and order codes are asfollows: CAN1A350EK, 380-350; RWO6A7752EK, 357-752;RWR331208NO, 351-208;154FN8A6438EK, 356-438;KANK3426R, 363-426;KANK3337R, 363-337;MKXNAK3428R, 363-767.

The rest of the componentsfor this project should be widelystocked. The three Receiverprinted circuit boards areavailable as a set and areobtainable from the EPE OnlineStore at www.epemag.com

We could not close withoutsaying that the author hasproduced a really “professional”Regenerative Receiver – almosta piece of nostalgic art!

Parking Warning SystemA few dedicated parts are

called up for the ParkingWarning System and may notbe obtainable from your usuallocal component stockist. ThePIC260435 infrared sensor/amplifier/demodulator camefrom Farnell, code 139-877.(This device has nothing to dowith PIC microcontrollers.)

Turning to the HT12B orHT12A encoder and the HT12Ddecoder ICs, these causedconsiderable sourcing problemslast time they were used in apublished design. At that time,they appeared in a well-knowncompany’s catalog, but, in fact,

they had discontinued stockingthem. To solve this problemFML Electronics (Tel: +44 (0)1677-425840) purchased somespecially and, at the time ofgoing to press, we understandthey still have stocks.

The rest of the components,including the ceramic resonator,should be readily availableitems. Just one point, specifythe L suffix when ordering theBC184L general-purposetransistor, because other typeshave differing pinouts to thisone.

The single-sided printedcircuit board is available fromthe EPE Online Store (code7000258) at www.epemag.com

Automatic Train SignalAll parts, including the

LF351N IC, for the AutomaticTrain Signal, this month’s“starter project”, should bestocked by our regularcomponents advertisers. Thechoice of LEDs, 3mm or 5mm,will depend on gauge and sizeof your model railway layout.The LED current is not veryhigh, so “high brightness” typesare preferable.

Teach-In 2000No additional components

are called for in this month'sinstallment of the Teach-In 2000series. For details of specialpacks readers should contact:

ESR ElectronicComponents – Hardware/Toolsand Components Pack.

Magenta Electronics –Multimeter and components, Kit879.

FML Electronics (Tel +44(0) 1677-425840) – Basiccomponent sets.

N. R. Bardwell (Tel +44 (0)114 255-2886) – DigitalMultimeter special offer.

PLEASE TAKE NOTE:Scratch Blanker Jan '00

We have been informedthat the MN3004 delay-line andthe MN3101 clock generator ICscalled for in the Scratch Blankerare no longer produced orstocked by Maplin. However weunderstand that Sky Electronics(Tel +44 (0) 20-8450-0995)have some.

Shop Talk


Recommended