94
8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992 http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 1/94

Circuit.cellar.024.Dec.1991 Jan.1992

Embed Size (px)

Citation preview

Page 1: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 1/94

Page 2: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 2/94

Our Upcoming Year

EDITOR’SINK 

Ken Davidson 

N ow that I’ve scared off all our potential authorsEnglish: The Forgotten Language?” in issue 23),  I wantshare with you our editorial calendar for the upcomingar.

Issue 25   (February/March 1992)Theme: Building AutomationSpecial Section: Embedded Signal ConditioningArticle Deadline: October 18,1991

Issue 26   (April/May 1992)Theme: Distributed ControlSpecial Section: Embedded ProgrammingArticle Deadline: December 27,199l

Issue 27   (June/July 1992)Theme: Real-Time ProgrammingSpecial Section: Embedded Sensors and StorageArticle Deadline: February 28,1992

Issue 28   (August/September 1992)Theme: Signal ProcessingSpecial Section: Embedded InterfacingArticle Deadline: April 24,1992

Issue 29   (October/November 1992)Theme: Measurement and ControlSpecial Section: Embedded Graphics and Video

Article Deadline: June 26,1992

Issue 30   (December ‘92/January ‘93)Theme: Debugging, Simulators, and EmulatorsSpecial Section: Embedded Control and ConversionArticle Deadline: August 28,1992

If you have an article idea related to one of the themested above, let us know about it. We’ll work with you to

evelop your idea into a bang-up article. Even if youave an idea that doesn’t fit one of the themes, we stillant to talk to you. We run articles unrelated to the

eme in each issue of the magazine and are constantlyorking on new volumes of The Circuit Cellar Project Fileooks. As long as you know your stuff, we’ll work with

you to produce a literary wonder. Obviously, the dead-line for issue 25  is past, and we are hard at work puttingthat issue together as you read this.

THE ISSUE AT HAND

One of the most popular articles we’ve ever run wason generating holograms using a computer, some basicphotography, and a laser (“Computer-Generated Holo-grams,” CIRCUIT CELLAR INK, issue 14).  The beauty of theconcept was the simplicity of the code used to generatedthe images. Dale Nassar is at it again, producing morethree-dimensional images using a computer, but this timewith the same red/blue glasses with which you used towatch 3-D movies. As before, the code is very short, andthe results are spectacular.

We also have another article from a popular author,Chris Ciarcia (Steve’s brother, if you hadn’t figured it outby now). This time, he’s talking about designing opticalsystems (specifically, a lens) by computer. Most of ourreaders know all about circuit design by computer, butoptical design is probably new to many.

Don’t miss this issue’s special section, where wepresent a nifty little controller that has everything youneed for most control applications right on the board.The IBM PC keyboard interface and video output espe-cially caught our eye.

THE NEXT ISSUE

The theme of the next issue of C IRCUIT CELLAR INK isalways a popular one: Building Automation. The CircuitCellar engineering staff is hard at work designing theHome Control System II (HCS II)  and will starting pre-senting the system’s building blocks. We’re also planningsome changes and improvements to the look of the maga-zine I think you’ll like.

Decem ber ‘9 l / January  ‘92    1

Page 3: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 3/94

Page 4: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 4/94

Page 5: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 5/94

READER’SINK 

Letters to the EditorI

J

FINAL WORD ON STANDARD DEVIATION

Since the exchange letters between Charles Boegliand me (“Reader’s INK,” issues 21  and 22  of CIRCUIT

CELLAR INK) regarding his article, “Adjusting StandardDeviation to Sample Size” (“Practical Algorithms,” issue  20), I’ve done a bit of research to resolve the question ofthe c, adjustment divisor. (Yes, Norman, there is a c, )

Briefly, if the sample drawn from the population isunbiased, then the sample standard deviation,

is the best estimate of s, the standard deviation of thepopulation. A sample whose elements are drawn at ran-

dom from the population is unbiased. An example wouldbe a designed experiment wherein the experimental runswere done in random order.

On the other hand, in running a control chart on anongoing process, s is usually estimated from a series ofsuccessive runs, rather than randomly. This sample isbiased, since no data on future runs are used. In thissituation the best estimate is s/c,, where c,  corrects thebias. This is a larger estimate than for the random situa-tion, and reflects the added uncertainty of the outcome offuture runs. If the sample standard deviation is estimatedby dividing the sum of squares by n (a time-honored

practice, but a bad one in my opinion), then the correc-tion divisor is c,. The estimated value of s is the same byeither method of calculation. The values of c, and c, arefunctions of the sample size, n.  The exact expressionsinvolve gamma functions (not commonly available onyour handy pocket calculator), but can be approximatedclosely by a square root fit, as Mr. Boegli has neatlyshown.

The bottom line is that the proper estimate to usedepends on the sampling protocol. This point was notbrought out in Mr. Boegli’s article. I think it is importantto do so.

Norman F. StanleyRockland, ME

WHAT ABOUT THE SCHEMATIC READER?

I felt compelled to write after reading Bruce Webb‘sarticle “OrCAD   Schematic Design Tools”   (CIRCLJ~~  CEL-LAR INK, issue 23).   As a technician who has to useOrCAD-generated  drawings, I’d like to pass on a fewrecommendations and observations to those folks whodo the circuit layouts.

1) Signal names. Names cut down on repair time.Names need to be consistent, no name changes should bemade on a signal path unless that signal is modifiedthrough a component.

My personal experience with poor naming techniqueis with a drawing of a CPU board that has several linesthat go through up to six name changes without goingthrough another part, then to top it off, the lines are notconnected to anything.

2) Power and grounds. Granted, any engineer or tech-nician should know where the power and ground pinsare at on most 7400 TTL  and CMOS chips. How aboutECL? Or a proprietary chip? Or surface-mount PLCC? Ora PAL, Xilinx, or other related programmable chip?

The drawings that I’ve seen rarely show power andground connections on the chip. Sometimes there is achart that lists those points; that helps. Otherwise youneed a stack of data books to hunt down some of themore elusive connections.

3)  Block diagrams. Sometimes it’s faster to lay out theschematic as a block diagram, just to show how the major

parts of a system are tied together. This is especiallyuseful when the system you’re working on is severalpages deep. Showing that U78  on page 2 is connected toU4 on page 32 via a line called ACKOl   as a one-pageblock does simplify matters and speeds up diagnostics.

In using OrCAD-generated  schematics, I have had toresort to redrawing the schematics of several boards toblock diagrams, just to make the various boards easier tovisualize. After making the block diagrams, my time spentin searching through all the various schematics has beencut down by about 75%.

4)  Programmable gate arrays. Yes I know, you don’t

want your competition to know your circuits work byusing a PAL or similar device. What about your servicepersonnel? If your field service rates are $150 an hour and

Page 6: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 6/94

Page 7: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 7/94

Page 8: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 8/94

/Vf3VPRODUCTNEWS/VH/VPRODUCTNEWSco nduc ted b y Harv Weiner 

TOUCH-CONTROLLEDMEMORY CHIP

Dallas Semiconductor introduces DS199x  TouchMemory, a nonvolatile

memory chip in a durable,steelMicroCan. TouchMemory is a data carrier readand programmed by momen-tary contact with a computer.Available with adhesive

 backing, the Touch Memoryfirmly attaches data tovirtually any object for instant availability.

Touch Memory sharessome of the applications of a

 bar code, but it can be

changed on demand. Thechip can hold up-to-date,relevant information becauseit can be reprogrammedwhile attached. Available indensities of up to 4K bits, itrecords over 100 times thedata of a bar code andtransfers error-free data at arate of 16K  bits per second.

Touch Memory commu-nicates through a one-wiresignaling scheme. Special

circuitry on the chip multi- plexes address, data, and

control wires onto a single

 bond pad. This bond pad isextended to the can‘s lid, andthe rim and bottom becomeground.

When contacted, theTouch Memory emits a wake-up signal, followed by itsfamily code, a CRC code, anda unique 4%bit  serial number.The serial numbers arewritten using a laser, and areregistered and unalterable.The CRC code validates the

serial number and qualifiesthe electrical connection.

The chip includes an

internal scratchpad that prevents inadvertent writingover existing data or to thewrong location. Data is firstwritten to the scratchpad andthen verified before it istransferred to memory. Oncethe transfer is initiated, acopy of the scratchpad isfaithfully reproduced inmemory, even if the contact is

 broken.Secure versions of Touch

Memory require 64-bit passwords to be entered

 before data is transferred. Inthis way, mere possession of the chip is not sufficient tolearn its contents.

Touch Memory canmonitor product processing

during manufacture, accesscontrol, asset management,and product informationstorage. Quickly retrofit anyPC to read Touch Memoryusing the DS9097 COM portadapter. A model DS9092

Touch Probe is also available.Prices for Touch Memory

range from $1.58 to $3.71 inlOOO-piece   prices, dependingon storage capacity. TheDS9092K  Touch Starter Kit,

which provides hardwareand software for quick evaluation of the TouchMemory family using a

 personal computer serial port, is available for $75.

Dallas Semiconductor

4401 South Beltwood  Pkwy.Dallas, TX 75244-3219(214) 450-0448Reader Service 1500

PC CONTROL INTERFACE KITS

Home Control Concepts has simplified using a PC for home control applications with the introduction of two newdevices. The Powerline Interface Kit allows PC control of lights, appliances, and other devices in the home by using X-10modules (or compatible modules by Stanley, Heath, Tandy,etc.). The interface kit requires a PC with a serial or parallel

 port. Hardware and software installation takes about fiveminutes, and a software utility program verifies proper installation.

The Powerline Interface Kit aids in the development of custom “smart home” systems. Develop a system that uses thetwo-way interface to monitor the status of the home’s lightsand appliances, and make intelligent decisions based on their on/off status. Develop a home control system that uses IF-

THEN logic. A Two-Way Powerline Interface Module (modelTW523 by X-10 [USA] Inc.) is included with the kit thattrasmits to and receives from the powerline. Programmingconsists of sending and receiving simple serial “packets” of information. In addition to the TW523, the interface kitincludes cable, adapter, software (including a library of Cutilities), documentation, and technical data. The kit sells for $79.

10   C lRC UlT CELLAR NK

The PC-to-Infrared Interface Kit allows PC control of infrared devices in the home. The interface kit requires a PCwith a serial port and a remote control (One-For-All or l-Control). A software utility program called SendIR  allows oneto “push buttons” on the remote control from the computer’sDOS environment. For example, a simple command from DOS

can mute a stereo system or change a television channel.The interface kit aids in the development of custom

systems. Write software either around the SendIR  utility program or from scratch with the sample C code provided.The PC-to-Infrared Interface Kit includes cable, hardwareinterface, software, documentation, and technical data, and itsells for $79.

Home Control Concepts

9353C Activity Rd.

San Diego, CA 92126

(619) 693-8887Reader Service W501

Page 9: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 9/94

SP SOFTWARE FORM PC

Durham Technicalages has released PC Dataster 3.0, a Digital Signal

ocessing (DSP)  softwareckage for the IBM PC andmpatibles. It offers a rangeDSP and data displayctions, an interactive helpility, and a pull-downnu interface. The basic PCta Master distributionms a complete system for P, but data analysisctions written by the endr are easily integrated intopackage using virtually

y language compiler or embler compatible with-DOS 3.0 or higher.The PC Data Master shell

vides both pull-downnus and traditional DOS

mmand windows for user eraction by either mousekeyboard. Create multiplephics windows for dataplay, and control them byuse, shell commands, or 

namically from application

tines. The interactive helpity is driven by a chain of p files, which can bepanded to describe user-tten modules using anyt editor.

Efficient binary dataes are used to link cessing modules imple-nted as independentcutable (EXE) files.

 data files of any sizeng these pipes. If insuffi-

nt RAM is available, thell automatically creates

mporary spill files to buffer excess data. Add process-modules using any

guage that supports thendard DOS file I/Otem.

PC Data Master also haset of DSP utility modules.ese modules includedamental operations suchforward and inverse FFT

tines, convolution,relation, window genera-n, FIR and IIR filter design

and implementation,derivative and integral testdata generation, and fifteenreal and complex data filemath functions. Implementmany multistage transforma-

tions, such as the Cepstrumand the Hilbert Transform,without creating newsoftware by combining these

 basic operations with datafile math routines in data

 pipes.The PC Data Master 

distribution includes amodule for displaying wave-form data. Use the plotsystem’s autoconfigurationcapabilities for quick display

of individual or multiple datafiles. For more exactingapplications, the plotsystem’s interactive mode

 provides full or partialcontrol over the design of data displays.

An add-on package isavailable to support two-dimensional signal process-ing. Called the “2D-Up-grade,“ this package extendsthe test data generation, data

file math, FIT,  convolution,and other modules in the

 basic package to handle two-dimensional data files.Graphics capabilities are alsoextended to include “water-fall” plots, “wire-mesh,” 3-Dsurface plots, and contour  plots.

PC Data Master sells for $185, including both the BasicDistribution and the Applica-tion Development Toolkit.

An Academic Site License isavailable to universities for an additional $95. A Demon-stration disk is available for $10, and the 2-D Upgradecosts an additional $85.

Durham Technical ImagesP.O. Box 72

Durham, NH 03824-0072(603) 868-5774

Reader Service W502

DOWNLOADABLE EPROM EMULATORDPROM 2, a new version of a downloadable EPROM

emulator, was introduced by Applied Data Systems. This unithandles larger EPROM sizes, has internal battery power for downloads, and has easier configuration.

DPROM 2 uses a microprocessor and RAM to simulatethe operation of an EPROM in a target system. The unit uses acable terminated in a DIP connector to connect to the target.An RS-232 connection transfers ROM code from a standardserial port. Because this emulator stores the ROM code inRAM, it allows changes to the code and overwrites of previousversions by downloading the revised file rather than burning

EPROMS to test code revisions.A single DRPOM 2 can emulate any 2732-27010 EPROM

in an 8-bit system. Additional units may be daisy chained tofill multiple EPROM spaces, to provide emulation in systemswith 16 or 32-bit buses, or to emulate a 27020 EPROM.

DPROM 2 has a NiCd battery to supply power duringdownloads, so connecting the unit to the target system duringfile transfer is unnecessary. The internal battery also backs upthe memory contents. DPROM 2 operating parameters, such as

 baud rate and EPROM type, are easily set by means of a rotaryswitch and a push button.

This emulator can receive file transfers at 9600,19.2k,

38.4k, and 57.6k  baud rates. It accepts files in Intel hex,

Motorola S, and binary formats.DPROM 2 is offered in four separate models. DP-64 with

64K of internal memory, which emulates EPROMs up to27512. DP 128 with 128K of memory emulates smaller EPROMs as well as the 27010 and, when used in pairs, the27020. Both models provide access time of 150 ns at theEPROM socket. The DP64FM and DP-128FM  models have thesame capabilities, but offer access times of 100 ns at theEPROM socket.

The cost of DPROM 2 ranges between $125 and $250, witha thirtyday money-back guarantee.

Applied Data Systems, Inc.409A East Preston St. l Baltimore, MD 21202

(301) 576-0335 l Fax: (301) 576-0338

Reader Service W503

Decem ber ‘9 I/ January ‘92    11

Page 10: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 10/94

/VHA/PRODUCTNEWSM3A/PRODUCTNEWS

diskless operationfrom Micro Computer Specialists Inc. It is a fullyequipped 8OC286  16-MHz,zero wait state, PC/AT-compatible computer on astandard size XT-type, plug-in board, specifically de-signed for backplane applica-

tions. IND-286 features ROM-DOS, a ROM-based, MS-DOS3.3 compatible operatingsystem that requires lessmemory and provides faster operation than MS-DOS.

The board also includes a4M-byte  PROMDISK  disk emulator with battery back-

up and a watchdog timer.PROMDISK  eliminates theneed for a floppy-disk drive

 by allowing the user to bootthe system and have theapplication software reside inflash EPROM or battery-

 backed SRAM. An on-board

 programmer for flashEPROMs simplifies fieldupgrades of applicationssoftware. This ability iscrucial in embedded systemswhere the environments aretoo severe for mechanicaldisk drives. The watchdogtimer facilitates using

embedded applications for controlling critical processeswhere extended computer downtime cannot occur.

Additional featuresinclude up to 4 megabytes of DRAM, two RS-232 serial ports, a parallel printer port,

a PC/AT-compatiblekeyboard port, a dual speedfloppy-disk port, an IDEhard-disk port, a clock/calendar, and a socket for anoptional 8OC287   coprocessor.An embedded BIOS setuputility is included for systemconfiguration and setting the

clock calendar. An on-boardI/O expansion connector interfaces with optional videodaughterboards for applica-tions requiring video. The power requirements for IND-

286 are under 4 watts.The price of the IND-286

computer is $795.

Micro Computer

Specialists, Inc.

25986 Fortune WayVista, CA 92083(619) 598-2177

Fax: (619) 598-2450

Reader Service W504

High Performance

Multimegabyte Disk EmulatorsNEW MODELS / LOWER PRICESl Floppy Drive and multimegabyte

emulators for ISA bus computers

l 180K to 14 MB capacities

l EPROM, Flash or SRAM technologies

l  Autobooting, Single or Dual diskemulation under PC or MS DOS

l List prices from $195

CURTIS, INC.

2837 No. Fairview Ave. l St. Paul, MN 551136121631-9512   FAX 6121631-9508PC DOS IS a trademark of IBM; MS DOS IS  a trademark of M~croscoft

Reader Service 145Reader Service X131

12   ClRCfJlT CELLAR INK 

Page 11: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 11/94

Page 12: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 12/94

Page 13: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 13/94

/VBM’RODUCTNEWSCONCEALED THEFT~O l ORlNG

Thiefbug,  presented byCEPCO, protects KS,monitors, printers, TVs,VCRs, and other electricalitems from theft or unautho-rized removal. The device isinstalled in a standardelectrical outlet box andfunctions as an ordinaryoutlet. When an item isdisconnected, either byunplugging or cutting the power cord, the device

transmits a coded alarmsignal through the existingAC-power wiring to amonitoring unit at another location.

The monitoring unitsrequire no wiring and plugdirectly into the lI5-VAC power outlet, monitoring asmany Thiefbugs as needed.The monitoring units range

from a single, plug-in buzzer or relay module to wall-mounted monitoring panelsthat identify up to 512locations from the codedsignal and provide audible,visual, and electrical (relay)outputs.

A complete system for  protecting one PC(Thiefbug and buzzer or relaymodule) is priced at $83.

CEPCO21515 Parthenia  St.Canoga Park, CA 91304

(818) 998-7315Reader Serivce 1507

Up  to 32K  EPROM, 6K  RAM  - 4.5 x 6.5”

I I/O   lines and decoded DIP  switch - Seri *, ?f/

C Sys  in EPROM, WI  source code - RAM, I/O   ol   d

Cross assembler included - rMos

h notes

Take it easy on your cargo with a custom Cabbage Casebuilt to the exact dimensions of your   equipment.

Take it easy on your backwith our extension handleand tilt wheels options.Take it easy on your wallet. Let Cabbage Casesshow you how easy it is tosave money on quality, custom-built road cases that makeshipping and traveling with your valuable cargo safer andeasier. Prices quoted over the phone.Call 800-888-2495  today.

1166-C  Steelwood Rd.Columbus, OH 43212

899/88&2499614/48&2495FAX/4862788

December ‘9 l / J unua ry  ‘92

Page 14: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 14/94

FEATUREARTICLES

qpcrge  6

I

Three-DimensionalGraphics by Computer

PC-Based Optical

System Design

A Video EditingControl System-Part 2

High-Resolution Timing0naPC

Three-DimensionalGraphics by Computer

Computer-Generated Anaglyphs

Light: the miraculous carrierthat transports colorful boundless in-formation into our minds as we probethe world around us through a mostremarkable pair of biological opto-isolators. With this built-in real worldinterface, the most glamorous elementof the PC is its ever-improving videodisplay.

In this article, I will describe away to graphically simulate the depthof our real world on your PC’s two-dimensional screen, using the colorand resolution features of your videosystem. Because I am mocking partof the human visual process, I willlook at it briefly. Most quantities thatpertain to the human eye are approxi-mations determined by formulas,definitions, and references. Althoughmost calculations do not involve ex-act numbers, the results agree closelyenough to be consistent with the prin-ciples applied in this article. Also, I’lldescribe what could become the ba-sis of some very peculiar graphicsapplications, the number of whichseems almost limitless.

You are able to see depth because

each eye “sees” your world from aslightly different viewpoint and cal-culates the distances of objects usingmental triangulation, a process morecommonly known as depth percep-tion. While these actions could besimulated with a computer in severalways, I will use a fun method: the old“red and blue 3-D glasses” or anag-lyphic   technique prevalent (albeitrarely) in specially filmed movies.Successfully incorporating this pro-

cess to the PC requires the definitionand plotting of two distinct, math-ematically superimposed, color-

coded perspective views of a scene.The colored eyeglasses separate thesuperimposed images and direct aparticular image to the correct eye.This method seems realistic becauseit influences the brain to encode (inplotting), and subsequently decode(in viewing), the image in a mannerthat causes the eyes to refocus whenshifting from a nearer to a farther partof the image, or vice versa. Comparethis focusing sensation when youview the anaglyphs with that of stan-dard “flat 3-D” computer images.

I chose the anaglyphic methodbecause it produces beautiful imagesof strikingly realistic depth, and allyou need are a couple pieces of inex-pensive, colored plastic and yourVGA. You can even program the col-ors to your taste or to whatever filterconstructs you have lying around.Don’t be discouraged by the qualityof the 3-D movies you’ve seen. Thecomputer-generated anaglyphs lookmuch better. In fact, when you viewthe anaglyph, the depth is realisticenough that the image looks unre-lated to the screen.

Fortunately, we’re in the era ofthe low-cost high-powered VGA-based color video standards. When Istarted work on this project a fewmonths ago, a standard VGA withsixteen colors at 640 x 480 pixel (pel)resolution had the highest quality percost ratio for applications needinghigh-quality color graphics. Now themodes supporting any 256 of 256Kcolors at 1024 x 768 pel resolution arethe best-and for the same or lower

cost than the previous VGA standard.These high-color, high-resolutionvideo modes open up a whole new

16 C IRCUIT CELLAR INK 

Page 15: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 15/94

rFEATUREARTICLE

Dale Nassar

world of image synthesis possibili-ies. At this rate of improvement, Ian’t help but wonder what the next

video breakthrough will bring.

COLOR AND RESOLUTION:

WHAT’S IDEAL?

Now 1024 x 768 at 256 colorsounds great, and if you’re familiar

with the photographic quality obtain-able with this super VGA graphics,you may wonder if improving themage quality further would result inignificant improvement.

Consider aspects like pel density,which takes into account display sizeas well as pel resolution, when deter-mining how much computer resolu-ion the eye can resolve. For example,f you take a 10” x 7.5”,   1024 x 768

graphic image and blow it up to theize of a giant TV screen, the image

acquires a very grainy appearance.Although the resolution remains un-hanged, the pel density lowers andhe (local) image goes from high qual-ty to poor quality. This change in

appearance is important because ofhe great size differential between the

PC screen and the minuscule retinalarea of the human eye perceiving thesignificant visual information.

Let me compare the high-resolu-ion graphics screen and the human

eye, in terms of those resolution andolor characteristics generated by the

PC and generated by the eye. Veryvery) loosely speaking, you “see” or

perceive an image that is focused ontohe retina by the lens of the eye. This

optical information is “picked up” athe retinal surface by millions of re-ceptor cells, which are connected by

nerve fibers to the brain through theoptic nerve. A portion of this imageis focused onto the fovea, a tiny activecentral area of the retina. The infor-mation striking the fovea is respon-sible for sharp image perception, suchas in reading and in concentrating onfine detail. The larger area outsidethe fovea is also light sensitive, butits role is mostly limited to periph-eral vision.

packed cone cells. Around the edgeof the fovea, the cones become lesspacked and the rods more plentiful.This distribution explains why pe-ripheral vision is better at night. Infact, directly viewing an object in lowlight is difficult because you focus onit with your fovea, which is relativelyinsensitive in low light. Strange asthis fact may seem, focusing slightlyaway from an object brings the image

Retina \

Optid  Nerve Figure 1 -The fovea area i s ap prox imate l y the re t ina l area i ll uminated by a lo ”  funnel of 

l ight d i rec t ly en ter ing, an d c rossing a t the c enter of . the ey e.

The key to this dual vision sys-tem is the two types of receptor cellslining the retina: canes and (smaller)rods,named according to their respec-tive shape. Cones are primarily sen-sitive to bright light and are respon-sible for distinguishing colors. Rodscannot distinguish colors, but aremore sensitive to light intensities, andare primarily active for night or low-light vision, This distribution of abili-ties is why colors are difficult to see

in low light levels.The fovea consists of a somewhatcircular arrangement of tightly

information onto the rod cells for abetter look under low-light condi-tions.

Obviously, the area of interestconcerning my applications the mostis the fovea. Therefore, I will concen-trate on this small retinal region. Letme start by calculating its surface area,which is often defined in terms offunnel-shaped fields of vision enter-ing the eye. As Figure 1 shows incross section, the central field of vi-

sion is defined as the funnel-shapedvolume of space bounded by a 10”arc emanating from the center (focal

Decem ber ‘9 I/ January ‘92    17

Page 16: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 16/94

oint) of the sphere (eye) through thens. Given the radius of the eye as

2.5 mm, I calculate the illuminatedvea area to be approximately 3.7

 In terms of resolution quantity,ink of the fovea as a tiny PC screen

nly 1.9 mm2. The fovea surface areaas been approximated as slightlyrger than a pinhead.

Now that you know the approxi-ate retinal “screen size,” let me de-ribe resolution. The biological ana-gue of the pel is a retinal cone cell.

he cone size (diameter) is also cal-ulated as an arc similar to the foveaea calculation, but with a much

maller angle: l/2  minute (0.00833”).he cone has a diameter of approxi-ately 0.0032 mm and an area ofout 0.00001 mn?.  Therefore, the cor-sponding pel density is approxi-ately 300 pels/mm. For a 10”  x 7.5”,

024 x 768 resolution VGA monitor,e pel density is about 4 pels/mm,

ot even close to that of the eye.akes the eye look good doesn’t it?

ut now let me calculate the actualumber of pels involved in each de-ce: for the fovea I get 600 x 600 =0,000 pels.  For the VGA screen 1024

768 = 786,432 pels, more than twicemany as the eye. Now are you rela-

vely impressed by the VGA? Don’tt the illusion fool you; examine alle angles and you will find the eyeins hands down!

You can easily determine if aaphical image could be made of agher quality (or not) given viewernditions. For example, suppose youant to view a 1024-pel,   IO-inch VGAne at full eye resolution (300 pels/m). Give the problem a little

ought: the individual pels becomeore evident if you are closer to the

gure J-Init ia lly t he u n r o t a t e d x-a xis is 

rpe nd ic ular to the sc ree n. The o rigin (0) 

e c t io n  a lw a ys rem a ins (pivots) at the 

nter of the screen. The a rotation (rota-n a bo ut the z-axis) mo ves from the ini t ia l 

o si t io n  tow a rd the init ia l + yposition.  The  (ro ta t ion ab out the y-axis) mo ves 

m the ini t ia l +z po si t ion to wa rd the init ia l 

p osit ion . Neg a t ive rota t ion s a re sim p ly 

vened .

y =9 /’z = sin x

x

Figure 2-Typical p rojec t ion s for ca usa l view ing of three -dime nsion a l sur fa c es.

screen and are obvious if you viewthem through a magnifier. Therefore,you must do the opposite: decreasethe image size (without removing anypels)  or move the image farther awayto eliminate redundancy in theviewed image with respect to the reso-lution elements of the eye. Refer tothe simple geometry depicted in Fig-ure 1 and you’ll see the line shouldbe placed at a viewing distance ofabout 367 feet! This distance is theminimum the IO-inch line can be po-sitioned from the eye while remain-ing in the 10” fovea arc. You are in nodanger of exceeding your eye resolu-tion while viewing even the most im-pressive super VGA graphics images.

While describing the resolutionelement of the eye as the size of threecones instead of one may be advanta-geous due to the three color types

(red, green, and blue), given its highresolution, even this 300% resolution

c

0

+z

1a rotation

-+2ro a i

reduction is insignificant. Conversely,the pel density may actually be some-what larger because the cones arecompressed to about rod diameter inthe fovea.

ENCODING DEPTH ON THE SCREEN

Although the common PC hascome a long way in display technol-ogy, it still lacks the characteristicmost responsible for making the ac-tual visual world around us realis-tic-depth.

To realistically simulate three-di-mensional images using a less-than-ideal two-dimensional PC monitor,you must employ graphical projec-tion techniques that take into accountthe nature of the image, the circum-stances under which the viewer willobserve the simulation, and the sens-

ing characteristics of the viewing ap-paratus itself. In this case, as in mostcases, the viewing apparatus will bea set of human eyes. The projectiontechnique is anaglyphic as describedearlier.

I chose rotated three-dimensionalmathematical surfaces as the subjectsof my original computer-generatedanaglyphs. Many people would claimthese are the most difficult to ma-nipulate, but I feel the results are

worth all the work.The first step is to choose a suit-able coordinate system. I chose a stan-

Dec em be r ‘9 l/ Janua ry ‘92    19

Page 17: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 17/94

Page 18: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 18/94

Page 19: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 19/94

Page 20: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 20/94

my angle input I would know whereeverything should be and avoid anyconfusion. Run the program in List-ng 1 with various A and B inputs (in

degrees) until you fully understandthe rotations. Be sure to do some nega-tive rotations. For these trial runs, useE = 0 and a large value for the view-ng distance, D  = 99999 for example.

A large viewing distance simulates aparallel projection, which is more de-sirable in the nonanaglyphic case. Set-ting E to zero simply places the view-point on the initial x-axis line givinga straight-ahead view. Note all unitsare in pels. An example of a pel den-sity calculation may be helpful: for a640 x 480,lO” x 7.5” VGA screen youhave 64 (640/10  or 480/7.5)   pels/inch.A horizontal or a vertical scale factormay be used to equalize these tworatios if they are unequal on yourscreen. As I will explain later, usingunits of pixels in the drawings greatlysimplifies some sticky points encoun-tered in hidden-line removal proce-dures.

I am now in a good position to

illustrate the difference between par-allel and perspective projections us-ing Listing 1. Parallel projection canbe simulated by assigning a largeviewing distance CD),  which givesuniform image projections over theentire screen. For a smaller value ofD you get a close-up view magnify-ing the nearer parts of the surface.This value can give a distorted ap-pearance if the image is viewed withthe naked eye. Try various viewingdistances using a pel density of 64per inch. Thus, for a viewing distanceof 24 inches use a value of E = 1536.Notice what happens as D gets verynear or even falls inside the axesspace. You can even use negative Dvalues that try to view the image frombehind. Eye separation is typically 2.5inches, so the standard value of E is80 (1.25 inches). A nonzero  value usedfor E moves the viewpoint off of thex-axis (it never moves out of the xy-plane). After this movement, the pro-ected image corresponds to the view-point at E. Try various values of E, inconjunction with D if desired, untilyou fully understand its significance(don’t forget the negative values).

Photo 1 --The resul t ing p l a y  whe n the p rog ram in List ing 2 is run wi th  the pa ram eters in 

Figure 5.

Note also when E is nonzero  the pro- jected z-axis now becomes tilted,which is impossible through simpleor-/3 rotations. These features indicatethe power of this little program. Us-ing two values of E (f80)   providesthe two viewpoints of each eye in ana-glyphic images; therefore, two sepa-rate (color-coded) images of the ana-glyph are drawn.

A more mathematical way of get-ting parallel projections is with lim-its. Simply take the limit of the per-spective projections as D approaches

infinity and out pops the exact paral-lel projection formulas ideal forundistorted viewing of nonanagly-phic  images.

PLOTllNG   THREE-DIMENSIONALMATHEMATICAL SURFACES

To illustrate this process and acouple of tricks involved, 1’11   makean interesting figure: the famous wa-ter-splash surface. Because I can’t justguess at the equations that becomegreat surfaces, I’11   begin by defining a

Lightning-Fast Fibating PointAcceleratorsmpower   your 80x86 applications with   GOFAST IEEE accelerators are opti-

GGFASTaccelerators.  Fast, reentrant, mized for 8051, 8096, 8086, 80386, i960,

andROMable,  GOFASTaccelerators   boost 6801, 6809, 68HCl1,  68xxx,  8085, 280,

 performance and make sure you can em-   R3000  and more. bed your application. Call for your free GOFAST  information

Link and go with  C: Microsoft@, Bar diskette today: 503-64-8446;  FAX 503-

land@, Intel4  MetaWare@,  and WATCOM? 644-2413; 800-356-7097.

Dynamically replace 80x87 coprocesors

142 15 NW Science Park Drive

Portland, OR 97229

U S SCIFTWiAREc

Decem ber ‘9 I / January ‘92  23

Page 21: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 21/94

Page 22: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 22/94

ppearing repositioned for each eye,he images change colors.

Notice the drawings have manypoints where the blue intersects theed pels; these points should be trans-

mitted to both eyes. Therefore, youmust not overwrite the red pel  with a

lue one plotted later because critical

ight-eye information would be de-eted. Simply plot a red and blue po-ition with magenta (color red + blue).

This way the pel information passeshrough both color filters and reachesoth the left and right retinas.

While very few people haverouble seeing the three-dimensionalffect, keep in mind a large part ofhe illusion depends upon your atti-ude. Although your brain knowshere is no actual three-dimensionalurface present, the anaglyphic cod-ng usually overcomes this knowl-dge. You should see a magenta sur-ace straddling the screen with no ap-

parent relation to the glass surfacewhen the two images are properlymerged. Notice you focus and refocusyour eyes when glancing at parts ofhe surface with different depths.

REMOVING HIDDEN SURFACEPOINTS

Notice in the anaglyph that thehidden lines, the ones that in the realworld would be blocked from yourview by the surface area between youreyes and the point in question, are allplotted. Unfortunately, the equationof the surface knows of nothing buthe set of all points making up theurface. Creating an algorithm to per-orm this task is left to you, some-hing that perhaps has the reputation

of being “a royal pain,” especiallywhen mathematical surfaces are in-volved. I investigated several knownmethods and none of them appealedo me, so I set out to try it myselfwith a mental note to prepare “to

bail out and settle for what’s avail-able”). Although the analysis and so-ution of this problem consumed byar the greatest effort in this entire

project, I got lucky and found a hid-

den line removal method that worksor a mathematical surface of any ro-ation, executes fast, requires no buff-

PAMDIGMThe odel  for Programming Pruducf ity

3301 Country Club Road, Suite 2214 l Endwell,  NY 13760 l (607) 746-5966 l

-..,

December ‘9 l/J anuary ‘92   25

Page 23: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 23/94

Page 24: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 24/94

Page 25: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 25/94

Page 26: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 26/94

FEATUREARTICLE

PC-Based Optical

Chris ur u System Design

My normal 8-to-5   job re-quires that i work in an environmentwhere there are over 7000 scientistsand engineers, of which more than3000 have Ph.D.s;   and we all rubshoulders and work together in asmall town on the side of a moun-

tain. In such a ‘brilliant” atmosphereone would expect to find a world ofcreativity, imagination, and construc-tive innovation. But in reality one of-ten finds politics, professional suspi-cion, and an enormous amount of in-ertia. I suspect the first two are just

Using Yo ur PC to De sig n a Le ns 

manifestations of man’s basic nature,but the presence of a great deal ofresistance to progressive changemakes me wonder why most of usspent ten years in graduate school“learning to think.”

Of course it’s not as bad as I im-ply. There are lots of scientists andengineers doing outstanding work intheir fields. But from my experiencewithin the field of computational sci-ence and engineering, most of the pro-fessionals I know wouldn’t even con-sider starting a project without hun-

Figure 1 --Interaction ofalightraywith a ree f ra c t ing lens .  PointsA andBdef ine  the loc a t ions 

of the assoc ia ted a ng les, heigh ts, and foc al po ints of the system .

30   C lRC Uii -  CELLAR INK 

dreds of thousands of dollars and un-limited access to some super main-frame computer. And if one is crazyenough to suggest that the PC on theirdesk (which is primarily used as a

terminal and word processing sys-tem) might provide them with a pow-erful tool to complete a large portionof their task, you can expect to be-come very unpopular in the groupoffice, especially while they’re tryingto justify their latest big budget.

There just seems to be this everpresent inertia against reapplying old(tried and true, so there must be something better) techniques, using newinstrumentation and using one’s own

mind to create “simple” straightfor-ward models of complex systems.Perhaps this is because the latter re-quires a level of understanding andeffort on the part of the individualnot all that common today?

So with these thoughts in mind Itake pen (keyboard) in hand and tryto explain how you can use your desk-top PC to model a real-world system,without needing to call on the re-sources of a mainframe. Much of the

thought and inspiration that enabledthe last generation of scientists andengineers to creatively “model” aproblem on the restaurant napkin canbe usefully employed by experiment-ers today. They can use the new slide-rule-the PC-to enable a whole newdimension of 2-D visualization andcalculation.

DESIGNING A LENS

One of the primary componentsof most optical systems is the lens.Most of the time we employ off-the-

Page 27: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 27/94

shelf optics to save on design andfabrication costs, but occasionally oneneeds to develop customized opticsto get around some sort of design pe-culiarity or mechanical obstruction.In this case, laying out a simple geo-metrical design of the required lensbecomes very useful. We need tochoose basic parameters and specifyrequirements. Once this is accom-plished, we can always go to the localoptical fabrication shop to have ourbasic design optimized and built forus.

Doing this first “envelope-effects”calculation on our PC enables us tointegrate our total design while wedefine operating limits. In spite ofwhat you’ve heard, you don’t needto use a mainframe to develop simplelens designs. Your PC is quite capableof doing matrix algebra, so it can beeasily used for configuring, ray trac-ing, and estimating basic optical ab-errations.

To start such a lens design, wemust first examine the experimentalenvironment and then determine thenature of the image light source, itsoptical frequency signature, the im-aging plane, and the mechanical limi-tations inherent within the system.From this information we can makequick estimates of the necessary en-trance and exit aperture sizes, opticalpath distances, the required focallengths, the optical magnification (orreduction ratio), the F/number, theamount of allowed aberrations (in-put vs. output resolution), and so on.Once we have decided the basics, weneed to create a simple model on thePC and trace light rays through the

system to determine its overall abili-ties. This model should allow us toselect specific light rays, add or re-move elements, and change the ele-ment spacings or glass types (whichaffects index of refraction), so that wecan modify and optimize to our par-ticular requirements.

To do all of the above, we don’tneed to be optical engineers. We onlyneed to understand a few optical ba-sics, a little matrix algebra, and how

to program our PC. Following such amatrix algebra procedure, we can cre-ate a simple program that will trace

I

n = 1.5   I n =1.5

fI

  0.6

n= 1.0 n= 1.0

 Air Gap

I Element 1 Element 2

Figure 2-A two-e leme nt sym m etr ic al lens system c al led the Ram sde n eyep i ece .

the progress of a ray as it passesthrough one refracting surface afteranother in order to determine theheight and direction it takes as it ex-its the last surface.

The implementation of such a de-sign approach is based on the cre-ation of two types of matrix opera-tors, which represent the interactionof the light ray with the various inter-faces within a lens. These are calledthe refraction (R) and translation (T)matrices. From these we can create asimple set of equations that are easilyprogrammable, even for very com-plex compound lens systems.

USING MATRIX ALGEBRA INLENS DESIGN

To understand how to implementthe technique I just described, con-

sider the lens shown in Figure 1. Herewe wish to follow a ray passingthrough the lens at points  A and B.

 Just prior to entering the lens, the rayhas an initial slope angle of g (as sub-tended with the optic axis). After re-fraction and while it is within theglass, it has a slope angle of y ’ withthe ray intersecting the two surfacesat heights h, and h,, respectively.

If we now define the angle f asthe angle between our incident ray

and the normal to the radius of cur-vature (R)  of the lens at point  A, thenthe angle $ can be defined as

sin+ =

or in a first-order approximation

Now, according to Snell’s Lawand geometrical construction (see Fig-ure la),

n, sin a = n, sin b

a = y +

P=y’+ f

then Snell’s Law can be rewritten inthe form

If we now solve the above equa-

tion for n,y ‘, then

my ’  =n,y   +nlhl   mhl 

and since (nz  - n,l/R is the refractivepower P,

qY’=  n,Y- ph, (1)

and using the identity

h, = h,   (2)

Decem ber ‘9 l/ Janua ry ‘92  3 1

Page 28: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 28/94

we can construct the refraction ma- from A. Realizing that y ’ is the sametrix by writing Equations 1 and 2 in at A and B, then we can again writematrix form: an identity equation like that in Equa-

tion 2 where,

now, writing these two equations in

where, as a 2 x 2 matrix, it can be a simple matrix form,written as   -CR

0  1

All ray interactions with the sur-face of a lens element can now becharacterized using this refractionmatrix. But we must now considerthe motion of the ray as it passesthrough the glass (or an air gap) go-

ing from point  A to B. If d is the hori-zontal distance between A and B 

then,

h,  -  h, = d tan y ’

and for paraxial  rays (a ray tracebased on the paraxial   approximationin which all angles are assumed equalto their sines and tangents) this equa-tion becomes,

h,=h,+dy’ (3)

which becomes our translation ma-trix T:

1  0  = T

d/m 1

If we now follow our selected raythrough the lens in a step-by-stepfashion, we can create a compositematrix that incorporates the total ac-tion of the lens. For this example, thesystem matrix is a combination of thetwo refraction matrices resulting fromray interaction with the front and rearsurfaces of the lens and the one trans-lation matrix as it passed through.This is defined as the matrix product

of each operation matrix ordered fromright to left,

At A , the ray emerges in a direc- S=R,TR, (5)tion n,y  ’  with height h,  above theoptic axis; while at B the angle of inci- If there is more than one lens,dence is equal to the emergent angle then these matrices are cascaded to-

Figure3-Definition  of thep rinc ipa lp lane s H and the  foc a lp lanes Flofa n  o p t ic a l sy st em .

3 2    C lRC UlT CELLAR INK 

Page 29: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 29/94

Page 30: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 30/94

Page 31: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 31/94

Page 32: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 32/94

Input lens data filename: lens.dat

Input incident ray height and slope angle.

h1,garrn-a: 0.3,22.7

System Matrix (Gaussian constants)

b -a--------------------------------

2.600000E-01 -1.400000

6.6599993-01   2.600000E-01--__----__----------------------

-d C

System Geometry

r= 5.2857153-01

s= -5.2857143-01

p= -1.8571433-01

9= 1.8571433-01fl= -7.1428573-01

f2= 7.142857E-01

ray incident angle = 22.700000ray exit angle = 5.481999

ray incident height =   3_000000E-01ray exit height = 15.196200

Figure 5--The output generated by MATRIX when the da ta  is Figure 4 is presented to the program.

Multihsk ”  ExecutivesAccelerateReal-TimeDesign

Itn a hurry to develop real-time applica- MultiTask executives support today’sions? MultiTask executives give you a most popular microprocessors:

full set of standard system services for most 68OxO,68HC  11,280/2180/64180,805  1,embedded processors.

Source code keeps you in control. And   80x86/V-Series,8096/80196  &i960.

our ProtoTask TM  ex&ive   lets you develop Call for a free EasyTask TM   informationcode on the PC. No matter which target you diskette: (800)356-7097or(503)641-8446.choose or when you choose it.

14215 NW Science Park DrivePortland, OR 97229

Reader Setie  t2C

A sample of an input file(LENS.DAT)  usedby  MATRIX fortheRamsden   eyepiece example describedabove is shown in Figure 4. WhenMATRIX reads the data file, it deter-mines the number of elements withinthe system and then computes thesystem matrix S. It then computes

some of the system geometrical pa-rameters as well as the exit heightand slope angle of an input ray. Fig-ure 5 is an example of a MATRIX runfor the Ramsden   eyepiece example.

ONWARD AND UPWARD

Similar techniques can be used tosimulate other portions of a morecomplex optical system. Taken incombination, the performance of the

entire system can be simulated be-fore any part of it is ever fabricatedwithout resorting to complicatedMonte Carlo calculations on main-frame computers. Don’t underesti-mate the power of your PC. It may beslower than a Cray, but it has moreflexibility (and a lower price tag). Iknow: I work on Crays 20 to 30 hoursa week. Besides, I like playing withmy PC.

REFERENCES

1. W. Brouwer. ‘Matrix Meth-

ods in Optical Instrument

Design,” W.A. Benjamin,

Inc., New York, 1964.

2. D.P. Feder, “Automatic Op-tical Design,” Applied Op-

tics 2 (1963). pp. 1209-26.3. W.J . Smith, ‘Modern Opti-

cal Engineering,” McGfaw-

Hill, Inc. 1966, p. 30

Chris Ciarcia  has a Ph.D. in experimental physics and is currently working as a staff 

 physicist at a national lab. He has extensiveexperience in computer modeling of experi-mental systems, image processing, and artifi-cial intellignece.   Chris is also a principal inTardis Systems.

IRS

404 Very Useful405 Moderately Useful406 Not Useful

36   ClRCUlT CELLAR INK

Page 33: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 33/94

Page 34: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 34/94

fashion as MS-DOS. These aspects,combined with similar processor ar-chitecture, make any translating fairlyeasy.

Before we dig into the software,let’s examine what it does. I’ll dividethe editing process into three basicareas and describe how each is ac-

complished. These areas are: editingand VCR control, recording and han-dling of editing information, and log-ging work tapes.

BASIC EDITING FUNCTIONS

Basic editing and status informa-tion is displayed across the bottomtwo lines of the screen, which leavesplenty of room on the rest of thescreen for other uses. The editing por-

tion of the screen display is shown inFigure 1. The layout is in a left-to-right, top-to-bottom configuration.Apply the same layout to the physi-cal location of the editing machinesand monitors as well; a good logicallayout is the best way to avoid confu-sion.

Figure 2 lists the keys I’ve as-signed for different control opera-tions. Basic machine control functions,such as play, rewind, and fast for-

ward, use the numerical keypad. The“stop” function is assigned to the <5>key, roughly approximating the rela-tive location of the <stop> key onthe VCRs I use. The <2>  key is usedto put the VCR into the play mode,which seemed logical because it isdirectly below the <stop>key. Fastforward is to the right of play, andrewind is to the left. Pause and sloware to the right and left of stop. Tap-ping the space bar is a “kill” com-

mand, used to stop both machinesand cancel any commands currentlyin process.

The top row of number keys areassigned to the record functions. The<7>  key is used for record, while the<8> and the <9>  keys are used forcut-in and cut-out, respectively. WhenI replaced my original VCRs, the newones had a reverse feature the oldones lacked. No more pins were lefton the controller, so I reassigned the

pin used for record over to reverse. Ifyou plan on using the record func-

<n

>

P Move script to agree with tapeAP Lock script to tape and follow

f FAF

tT

X

AX

<clear>  i

a<clear> a

“Fl

F2Shift F2AF2

F3Shift F3^F3

Enters word processing mode-BREAK exitsDeletes letter if over time code marker deletes time codeDelete to end of fileProduce edit decision listRead disk fileWrite disk fileQuit

Trim up--Increments destination cut-in timeTrim up-Increments source cut-in time

Trim up-Increments tape time under cursor 

Trim down-Decrements destination cut-in timeTrim down-Decrements source cut-in timeTrim down-Decrements tape time under cursor 

Manual enter-destination cut-inManual enter-source cut-inManual enter-tape time under cursor 

Manual enter-destination cut-outManual enter-source cut-out

Find and stop destinationFind and stop sourceFind string in script

Enter destination tape timeEnter source tape time

Index tape (queries for index start time)Index tape from current tape time

Moves cursor rightMoves to next edit point in scriptMoves cursor left

Moves to last edit point in script

Locks edit points in script to current edit pointsUnlocks edit points in script

 Auto edit-(automatically edits list from cursor to EOF)

Toggles source of edit durationToggles between source E camera, source = tapePreview insert editExecute insert edit

Preview assemble editExecute assemble edit

Review edit

Move to next script marker (next time code in script)

Enter destination tape time into cut-inEnter source tape time into cut-inEnter source tape time into script

Enter destination tape time into cut-outEnter source tape time into cut-outEnter destination tape time into script

Figure P--The  controller supports a large set of ed it ing co ntrol c od es. Note th e  dinerencebe tw een up pe r and low e r ca se in ma ny o f the c om ma nds. A c a ra t p rec ed ing a 

co mm and ind ica tes a co n t ro l cha rac te r. A <c lea r> p rec ed ing a co mm and ind ica tes hold ingdown theclearkey. The  c c / e a r >  keyon  the M od e l lV iso f te n  usedin   a similarfa shion to the <A / t >  key on an IBM PC.

Dece mb er ‘9 l/January ‘92    39

Page 35: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 35/94

Page 36: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 36/94

under the cursor, and it will deletethe old time code and replace it withthe new. This capability allows youto mark a tape location as many timesas you like without entering a stringof time codes.

GETTING THE PICTURE

Once you have entered the sourcetime code, you have all the elementsyou need to make an edit. The sourceand destination beginning time codesare still under the cursor, and the end-ing time code is the next edit locationon the script. When you press <ct rlL>   the source and destination timecodes are loaded into the commandlines at the bottom of the screen. Thenext time code in the script is foundand loaded as the cut-out point. Theselected codes are highlighted in re-verse video and are locked to thecodes in the command line. There-fore, any changes made to the codeon the command line will be repro-duced on the script. You can now per-form any of the edit commands listed.You can make trial edits and pre-views, and automatically recordchanges as you make them. When

you’re done, press <ct  r 1

u>  to un-lock the command line from the script,or press <Ctrl L>   to unlock andlock onto the next pair.

After you have entered enoughedit points, the software relates thecurrent VCR tape time to the editinglocations entered into the script asbest it can. Pressing <P>   scrolls thescript and displays the computer’sguess at the current tape time’s loca-tion in the script. Pressing <Shift

P> locks the screen display to the tape.You can play, rewind, or fast forwarda tape and watch the script scroll inperfect sync. I haven’t found any prac-tical uses for this feature, but it’s funto watch.

TAKE YOUR BEST SHOT

My method for logging worktapes arose while I was assembling“best-takes lists.” What’s a best-takes

list? Well, when you go out on a“shoot” you don’t come back withShot 1  on Tape 1  and Shot 2   on

Tape 2.  Shots are never taken in or-der and are often retaken severaltimes. It is far better to come backwith more footage than you need,than to come up short, especially ifyou’re in Michigan and your shoot’sin Mississippi. I once did a video forthe American Cancer Society that had22 work tapes, each consisting ofabout 40 to 50 shots. I had about athousand shots to keep track of. Largestudios have people who do nothingbut review work tapes. They pick thesegments that are needed, copy themonto a best-takes reel, then pass themalong to another person who does the

editing. Free lancers usually don’thave that luxury. When I assemble abest-takes reel, I log in a tape andthen use that log to find the shots Ineed.

Once again the old ballpoint pencame into play. Logging a work tapeconsisted of viewing a segment, then

 jotting down a time code and a shortnotation of the scene. Because I hadto take my eyes off the screen to write,I had to stop frequently and rewind.The whole process was cumbersomeand time consuming. Well, the oldModel IV came to the rescue again.The solution was to add rudimentary

Decem ber ‘9 l / January  ‘92    41

Page 37: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 37/94

Page 38: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 38/94

6

A PICTURE OF THE SOFTWARE

The software for the Model IV iswritten in machine code and is di-vided into eight modules.

MAIN handles the machine start-up functions. It contains the com-

mand interpreter for functions otherthan word processing. Upon start-up,MAIN issues a series of wake-up com-mands to the modules that readythem for use. It also handles some ofthe time code entry and delay timingfor editing functions.

SUBS contains frequently usedsubroutines, including those used fortransmitting edit information andmachine commands to the modules,and the code for calculating edit du-

rations.DISKIOloads  and saves files fromand to disk. When you’re queried fora file name you can type it in or pressthe right arrow key and let the com-puter leaf through the available filesfor you. DISKIO automatically addsthe file extension “.VT”  to the filename for easy identification.

EDITOR interprets basic machinecommands. It’s the real heart of theediting system and acts as an inter-

face between you and the VCR mod-ules. It interprets and translates yourcommands into something a VCRmodule can understand. ED I TOR de-cides whether you are asking for apreview, an edit, or a review. It canalso instruct the VCR modules to doa tape-to-tape edit or a camera-to-tapeedit. It decides how long an edit willlast and transmits that information tothe VCRs. Finally, EDITOR containsthe code necessary for videotape in-

dexing.INTERRUPT takes care of infor-

mation coming from the VCRs. Theactual interrupt routine is very short,only a few lines long (see Listing 1).INTERRUPT takes data from the se-rial stream emitted by the modulesand inserts it into a ring buffer. Aftersaving the data, it notifies the rest ofthe software that data has arrived inneed of processing. When the com-puter has time, it polls to see if there

is data to be processed. If there is, itpicks the data out of the ring bufferand decides what to do.

INTERRUPT is optimized forspeed. Instead of doing a linear seriesof tests to interpret the data, this mod-ule conducts branch testing. It checksfor the most likely possibility: timecode. If time code is in the process ofbeing received, the module then

stores it in a buffer. If no time code isfound, INTERRUPT looks for com-mands in order of those most likelyto occur. It also is responsible for up-dating the display with the latest in-formation. While this module is rea-sonably fast, it can trip up if informa-tion is received too quickly. If youhave trouble, slowing down the baudrate should help.

WORD handles the bulk of theword-processing functions. It’s de-

signed to handle basic input and noth-ing else. While it can be used for someword processing, it’s really for quicknote taking and other types of minordata entry. WORD follows the conven-tions set up for most other word pro-cessors on the Model IV. The arrowkeys move the cursor right, left, up,and down; shifted arrows move it totop of file, bottom of file, end of line,or beginning of line. When a file isloaded from disk or typed in from

the keyboard, WORD formats it bymarking the end of each line of textwith the removal of a space and theinsertion of 80h. This marker elimi-nates the need for the program to re-format lines as the screen scrolls, free-

ing processor time for more demand-ing functions. The markers are re-moved when the file is saved to disk,so the text remains flat ASCII.

WORD  also recognizes and ma-nipulates embedded time codes, in-serting them with the proper format-

ting. When deleting characters, WORDrecognizes when the cursor is posi-tioned over a valid time code anddeletes the entire time code at once.WORD  also handles time code trim-ming and maintains other screen in-formation.

GLOBAL is a module that requiressome explaining (see Listing 2). It con-tains no assembly language instruc-tions as such, but it does contain in-structions to the assembler for calcu-

lating screen locations. I needed thismodule because I often experimentedwith different display layouts duringthe development of the program. Thisexperimentation was useful, but cum-bersome and time consuming toimplement. I needed to have all thescreen references in one location tobe easily tweaked, but the last thing Iwanted was for the program to wastetime calculating a reference point ev-ery time it had to write to the screen.

My solution was to build instructionsin the assembler to calculate screenlocations and then load them whereneeded at assembly time.

The fastest way to do screen I/Oon the Model IV is to build a work

; SINTER INTERRUPT - PUTS RECEIVED BIT INTO; RING BUFFER AND UPDATES POINTER

INTER LD HL, (RINGIN) ; GET RING IN POINTERINC L   POINT TO NEXTLD   (HL)  ,c : SAVE RECEIVED DATALD   (RINGIN),HL ; SAVERET

; SINTERUP INTERRUPT  ROUTI NE;  DETERMINES MODE OF VCR; AND UPDATES TAPE NOW COUNTER

; FETCH DATA FROM RING COUNTER AND UPDATE DATA; NOTE: NO REGISTERS SAVED USE CAUTION WHEN CALLING

INTERUP   LD DE, (RINGIN)LD HL, (RINGOUT)LD A,LCP ERET 2

  RING IN POINTER; RING OUT POINTER

; RET IF NOTHING RECEIVED

listing 1 -To sav e proc essor time, the interrupt routine is very short a n d s im ply  Inserts receivedinformation into a ring buffer. Later the software polls to see if the “in pointer” is

dif ferent from the “ou tpo i n t e r .   l fthep ointers are di fferent , the inc om ing da taisproc essed 

and d is tr ibu ted .

Decem ber ‘9 l/ January ‘92  4 3 

Page 39: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 39/94

Page 40: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 40/94

Page 41: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 41/94

FEATUREARTICLEBruce Ackerman

High-Resolution Timingon A PC

In his article “A PC Stopwatch, Improved Timing

for Acquisition and Control” (issue 19, page 22),

David Schulze  wrote that often PCs are incapable

of high-resolution timing in a control or instrumen-tation project. Normally, timing is approached us-

ing either software loops or the tick timer, Software

loops need to be calibrated against the tick timer

before they are used, and not only tie up the

processor, but can be grossly inaccurate as well.

 The tick timer’s advantage is its ability to interrupt

your software, but it’s coarse by itself and in needof refining. I will explain these refinements, which

extract a highly accurate timer with resolution

greater than 1 ps from any PC, XT, or AT, with almost

no additional system overhead and no additional

hardware.

THE TICK TIMER

The Intel 8253 (8254 for the AT)programmable interval timer is thesource of the clock ticks. The 8253 hasthree independent channels that per-form various rate divisions or otherfunctions on its 1.19318MHz clock.Channel 0 generates the timer ticks,channel 1 clocks the dynamic RAMrefresh, and channel 2 can be con-nected to the speaker.

Channel 0, utilized in this project,is normally set in the 8253’s “mode3,” which is a frequency divider pro-ducing a symmetrical square wave.

46   C/RX/7  CELLAR NK

The 8253 has a 16-bit  countdown reg-ister that causes the output pin to behigh during the first half of the countand low during the second. The countregister is initialized to 0, which actslike 65536, and is the factor by whichthe 1.19318-MHz   clock is divided. Theinterrupt line is pulled by the 8253output and generates 18.20648-Hzticks.

The hardware interrupt vectorsto the processor’s interrupt 8, where

the BIOS code resides to increment a32-bit number in low memory (at lo-cation 0040:006C)  and to handle disk-drive motor timing or any other

chores a BIOS may have. The BIOScode also chains to a second inter-rupt, INT lCh,   which usually con-tains only an IRET   instruction. This1Ch  vector is the easiest to put your

own interrupt handler on, should youwant to be interrupted every tick.When your program exits (normallyor abnormally), it must restore theoriginal vector, or the system willcrash.

FASTER INTERRUPTS

At this point, you can increasethe 18.2-Hz   tick rate by simply chang-ing the count register from 0 (65536)

to some lower value. For example, acount of 59659 changes the tick timerto 20 Hz, which is handy simply be-cause it’s a whole number. (Of course,if we humans had 18.2 fingers.. .)  Thischange will affect other software onthe system, such as the time of day(your clock will run a little fast) andfloppy disk drive timing (the time themotor is allowed to come to speedand the time it runs after an access),but in my experience the change from18.2 to 20 Hz has never caused a prob-lem. You can correct the time of dayafter you return the tick timer to itsnormal rate at the end of a program:keep track of the number of ticks thatoccurred at the faster rate and decre-ment the BIOS counter appropriately.The set 8253 function shown inListing 1 reprograms the tick rate.

What if you want even faster in-terrupts? Running the BIOS routine

at 16 times the normal tick rate wouldbe a bad practice; if you are writingcode that will be on a variety of ma-chines, you don’t know what other

Page 42: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 42/94

Page 43: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 43/94

Page 44: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 44/94

Page 45: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 45/94

SPECIAL  The K-100SECTION MC68HCll  -basedFrank Swig er 

& Joe G / o v e rSingle-Board ComputerOn-b oa rd keybo a rd a nd v id eo in te rfac es 

c om p le te th is sing le -b o a rd p ow e rho use 

You’ve heard the story  b e fo re ; you ha ve a design f h a f req uire s a c om p u f e r  and som e 

l / O . Do y ou use o ff- the-she lf c om ponents 

fo  m inim ize d esig n t ime  a nd  exp ense,

p o ssib ly c om p rom ising on fea fu fes ,  o f d o 

yo u d esig n som eth ing sp ec ific a lly sui ted

fo  he  tusk? 

We recently had a job to put to- would function more efficiently.gether  a custom communication and When we started looking through ads,control system. Typically, such a sys- we soon realized finding the righttern utilizes a PC and five or six processor was going to be tough. Mostboards. Even with dropping PC boards required a terminal or didn’tprices, we still felt there had to be a have the features we needed. Some-cost-effective alternative to all this times you just have to build your own.hardware. So we decided to look for The search for a suitable micro-an inexpensive microcomputer that processor on which to base our board

brought us to Motorola and theirMC68HCllEVB  evaluation board.What impressed us about theMC68HCll  were its features and the

extensive amount of developmentsoftware available free from Motorola.We chose MC68HCllFl  chip over theMC68HCllAl   b e c a u s e i t i snonmultiplexed, has more internalRAM (lK), has eight additional I/Opins, plus has all the other standardgoodies.

Our single-board solution,dubbed the FS-100, includes theMC68HCl  lF1  processor, one RS-232serial port, 64K of RAM, up to 32K of

EPROM, an interface for a standardIBM PC-type keyboard, a TTL mono-chrome video interface, and a STDbus interface should expansion benecessary in the future. Figure 1shows a block diagram of the board.Figure 2 shows a complete schematicfor the board.

Figure 1 --The  FS- 100 single-boa rd com puter inc ludes a 

Motorola MC68HC  11 F p ro- cessor, RS-232ser ia lport .  64K 

ofRAM .up to32Ko fEPROM .

IBM PC-typ e ke yb oa rd in- 

ter face. TTL  mon o c h r ome 

video interfac e, a nd STD  bus 

in ter face.

Internal Chip Selects

52   ClRCUK  CELLAR INK

Page 46: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 46/94

SINGLE-BOARD SOLUTIONS

Figure 2a-Jhe hea rt of the FS-

1OO i s t heMo t o r obMC68HC l  FI.A M AX232 is used to a llow +5 -

vo l t - on l y ope ra t ion .

MC68HCll  PROCESSOR

The Motorola MC68HCll  micro-processor has proven itself time andtime again in the embedded applica-tion arena as a highly capable player.Figure 3 summarizes the chip’s fea-tures. In their article “Using theMotorola MC68HCll”  in issue 18of CIRCUIT CELLAR INK, Steve Ciarciaand Burt Brown did an excellent jobof describing the processor, so we

won’t rehash it here.Some elaboration of how thechip’s ports are used is needed. In itsexpanded, nonmultiplexed mode, ourMCU can address up to 64K bytes ofaddress space. Port F is for high-or-der address bits output. Port C iswhere the bidirectional data bus ap-pears. Port E can be used for general-purpose static inputs, A/D channelinputs, or both. Ports A, D, and G canbe used for general-purpose I/O, al-

though each has an alternate func-tion. For example, port A bits controltimer functions and port D handles

Figure2b-The IBM PC ke y- bo ard interfac e uses a shir?

register to receive data from 

the k eyboard.

I I

*CSIOt I

Decem ber ‘9 l/January ‘92  53 

Page 47: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 47/94

serial I/O. Also, ports A and E areterminated with resistor packs thatcan be replaced with 0.1” header pinsfor external use.

Total board power consumptionis 300 mA. The IS-100 runs a ~-MHZMC68HCllF1,   however Motorolanow has a ~-MHZ  version available.

MEMORY 

The FS-100’s main RAM ismapped at OOOO- 7FFF  and its ROMat 8~ FFFF.   An additional 32K ofoptionally battery-backed RAM ismapped into the OOOO- 7FFF   rangeand used as a RAM disk. BASICll’sESAVE and ELOAD commands,which are used to save and reloadautostart programs, were modified to

use the RAM disk. Either a 32K x 8-bit RAM or a Dallas DS1230AB   bat-tery-backed RAM can be used.

The MC68HCllFl has four pro-grammable chip selects: two for I/O(CSlOl  for keyboard and CS102  forvideo), one for main RAM (CSGEN),and one for ROM (CSPROG).  The chipselect control register enables thechips so they don’t conflict with eachother or with the processor’s internalmemory. The processor’s PG2 output

is used to select between the mainRAM and the RAM disk.

KEYBOARD AND VIDEO

With cost effectiveness still inmind, we provide interfaces for a

Figure 2c-7he  CRT9  153 Enhanced Jermi-na l l og i c Co nt ro l le rma kesa dd ing a  v ide o 

display to any processor a snap.

WITA  6”s

standard IBM PC-type keyboard anda ‘ITL-type  monochrome monitor.The keyboard generates scan codesthat must be converted by softwareto ASCII codes, as shown in Listing 1.We’ve made no attempt to fully sup-port all the function keys and otherextras supported by the keyboard.Feel free to expand on the software ifsuch features are important to you.

The keyboard sends the scancodes back to the computer synchro-

nously using a data line and a clockline. The data line feeds a shift regis-ter (ICll) clocked by the keyboardvia IC13. When the last bit has beenreceived, IC12 generates an interrupt(*IRQ),  and the software puts theASCII character in a RAM scratch

pad. The interrupt and shift registerare cleared when the data is read fromthe shift register.

We used the CRT9153 EnhancedVideo Terminal Logic Controller fromStandard Microsystems Corp. forvideo output. It is a programmable40-pin chip that combines video tim-ing, video attributes, alphanumericgeneration, and block graphics gen-eration (a block diagram is shown inFigure 4).  This chip (IC6),  coupled

with a 2K x 8- bit static RAM UC7),gave us the features we needed forour control system. Most importantly,we needed reverse video, intensitycontrol, underline, and block-typegraphics with four to six indepen-dently addressable segments per

Figure Sd-Up  to 32K of EPROM 

and 32K of RAM m ay b e used .

An a d d i t iona l 32K of RAM ma y 

b e used a s a RAM d isk.

54 C lRC UlT CELLAR INK 

Page 48: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 48/94

Page 49: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 49/94

Page 50: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 50/94

Page 51: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 51/94

I  .1

Cross-Assemblers fromgo.

Simulators from$lOO.OO

Cross-Disassemblers from$lOO.OO

Developer Packagesfrom $200.QO(a   $50.00 Savings)

Make Programming EasyOur Macro Cross-assemblers are eas to use. With powerfulcondItIonal   assembly and unlimited incluJe files.

Get It Debugged--FASTDon’t wait until the hardware is finished. Debug your software with our Simulators.

Recover Lost Source!Our line of disassemblers can help you re-create the original assemblylanguage source.

Thousands Of Satisfied Customers WorldwidePseudoCorp   has been providing quality solutions for microprocessor problems since  1985.

ProcessorsIntel 8048 RCAMotorola 6800   1802,05 Intel 8051 Intel 8096,196kc

Hitachi 6301Rockwell 65CO2

Motorola 6809Motorola 6801 Motorola 68HCll  FDtEro 6;05Intel 8080 85

Hitachi HD64180  Mot. 68k,&lO

avl;  peh  6502NSC 800

NewZilog 28 Zilog Super 8l   Ail products require an IBM PC or compatible.

For Information Or To Order Call:

PseudoCorr,716 Thimble Shoals Blvd, Sui$  E

Newport News, VA 23606(804)873-1947 FAX:(804)873-2154

character space. We used a 17.1072-MHz crystal for the video, but anycrystal between 16 and 18.7 MHzshould work fine.

The CRT9153 also supports RS-170 composite video output, so ifyou’re looking for a display control-ler for a future product, be sure tokeep this chip in mind.

SOFMARE

Two pieces of software availablefrom Motorola, the Buffalo monitorand BASIC1 1, are all that is necessaryto develop working code for the F’S-

100. Both programs were describedin detail by Steve and Burt in the ar-ticle we mentioned earlier, so, again,we’re not going to repeat the discus-sion here. Since the software fromMotorola uses the MC68HCll’s  se-rial port, we had to modify the soft-ware to utilize the FS-100’s on-boardkeyboard and video. We also modi-fied BASICll’s  ESAVE and ELOADcommands to use the RAM disk, aswe mentioned earlier.

CONCLUSION

The idea of a single-board computeris not new. However, it is hard tofind one that will do all the tasks yourequire. After the best part of twoyears, our efforts resulted in the FS-100, which will serve as the heart ofour communication projects andmany other applications. Its small sizeand unique features make it perfectfor use as a stand-alone data logger,home automation controller, andmany other custom projects.

FormoreinformationabouttheFS-lOO,con-tac tABOLSystemsInc ..  1324ONorthupWay.Suite 21, Bellevue, WA 98005, (206) 747-8400.

Frank Swiger is the manager of the ABOLSystems Inc. Portland, Oregon ofice He isinvolved in the design of hardware and soft-ware for data communication systems and

 point-of-saleequipment.@ Glover  is the VicePresident of ABOL  Systems.

IRS

4 13 Very Useful414 Moderately Useful415 Not Useful

December ‘9 l/January ‘92    59

Page 52: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 52/94

ne method we use at CIRCUIT CELLAR INK to measure our growth and success as a magazine is the

ever-increasing response to our annual design contest. Our third year has not disappointed us. Once again,

we are impressed with the quality and innovation of the designs submitted, which made our job of choos-

ing winners extremely difficult. Please join us in congratulating all your fellow readers who made the Third

Annual Circuit Cellar Design Contest a success, Several of our entrants and winners will be featured in

upcoming issues or Volume II of The C ircuit Cellar Project File. For those of you who believe you can rise to

our challenge, find the on button for your slide-rule and start thinking about next year. But for now, let us

salute the winners.

First Place: $500

An MC68HCll -based Sensor for

by Brian Farmer

Brian’s work in robotics led to

his winning design of an

MC68HCll based  sensor. Hehad programmed a robot to

Insert geranium cuttings into

peat plugs with preformed

holes, Unfortunately, the robot

functioned with strictly vertical

motions and had no regard

for the natural curvature to

the plant cuttings. The result

was a large amount of 

damage. So Brian designed a

sensor that could be used in a

robotic work-cell for measur-

ing the extent of bend in plant

material. The device uses LED

and phototransistor arrays

mounted on opposite sides

 Two-Dimensional Position Measurement of Small Objects

within a square housing.

Brian’s sensor is conditioned and serialized by dedicated circuitry, and it is controlled and monitored by an

MC68HCll microcontroller. The unique functionality of Brian’s entry won our hearts and won him first place.

Page 53: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 53/94

First Place: $500

 The ScopeMotor,  a Voice Operated

 Telescope Positioning System

by Michael Swartzendruber

Amateur astronomers are presented with a

unique working environment: darkness.

Adjustments to a telescope must be

intuitively made by hand. Voice control

would be the most logical answer, and

Michael has constructed one such system

that is extremely economica l. The system

has three major areas: a voice signal input

and analog signal conditioning circuit. a

voice recognition chip (the VCP-200 from

Voice Control Products Inc., and a stepper

motor clock source and high-current

stepper motor drivers. The VCP-200 module allows true speaker-independent operation of most telescope

positioning func tions.

Our new DSP Category apparently took people by surprise. As a result, we had only one entry that truly fit

the category and was good enough to be a winner.

First Place: Analog Devices EZ-LAB Demonstration Board, “Digital SignalProcessing Applications,” “Digital Signal Processing in VLSI,” and $250

ADSP Module

by T. Bertinetti

Originating from France, this professional-quality, credit-card-size module uses the Analog Devices

ADSP2105 along with a combination of on-board peripherals to make a very small but powerful digital

signal processing system. Running at 10 MHz, the &layer surface-mount board includes up to 96K bytes of 

SRAM. up to 64K of EPROM, 2K bytes of EEPROM, a Xilinx programmable gate array, and an RS232 serial

port. While designed for DSP applications, the ADSP Module is also well-suited to general embedded

applications.

n

December ‘9 l /January ‘92  6 1

Page 54: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 54/94

m l ABULTS

Second Place: $250

SmartROM

by Sanjaya Vatuk

SmartROM, an intelligent EPROM emulator

that needs only a standard RS-232 serial

port as a host resource, is an exception-

ally well-crafted device that uses either

an 8OC31 or an 8OC32  microcontroller

with firmware that can convert raw

object files into binary EPROMs from 2732

to 27256. It can mimic the 87C64  EPROM

with its on-board address latches. Sanjaya

has built an emulator that is very fast,

capable of downloading at most stan-

dard data rates up to 57,600 bps (115,200

bps using an 80632) without any hand-

shaking or delays. We were especially

impressed with SmartROM’s  flexibility: a

choice of six different data rates, filedetection when downloading, status

LED and two options for blank state clinched second place for this project. Sanjaya also used ingenuity

and creativity to give SmartROM professional-looking packaging using off-the-shelf materials.

Second Place: $250

An RMS Limiter

by Bob Gardner

Bob developed the RMS Limiter as an

alternative to the expensive electronic

speaker processors available that monitor

signal levels and turn the volume down

before the speakers can be damaged. A

Motorola MC68HC ll is at the heart of this

project, controlling a programmable

attenuator circuit using input from a full-

wave rectifier. Bob provides user feedback

through a front-panel two-digit display.

62   ClRCUll  CELLAR INK 

Page 55: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 55/94

As we said earlier, the quality of our entrants was exceptional. The level of excellence led us to no other

choice but to award three projects third  place.

Third Place: $100 (three awards listed in  no particular order)

 The PC-Controlled XM Table

by Alan Rauscher

Alan used an IBM PC and an 8031 motor controller to achieve the extreme accurac y

and repeatability that he needs when drilling printed circuit boards or panels He also

wrote a TSR in order to use the table to engrave signs, panels, or name tags using a CAD

package, such as AutoCAD or FastCAD.  The Dremel drill motor can be moved In three

directions: X. Y, and Z, with Z as the vertical movement of the drill turret. What intrigued us

about the XM Table was the degree of accuracy obtained using simple materials readily

available. Although the table was constructed of wood, the drill is accurate to five

thousandths of an inch and is suitable for a board or panel of 6 x 6 inches.

 The GPZ8. an Audio Digital Sampling System

by Tom Nickel

 The GPZ8, an audio digital sampling system, is a

audio effects generator created by Tom to be

used with musical instruments, primarily the electric guitar. Tom built the GPZ8

around the Zilog Z80 microprocessor to simplify redesign of functionality. repro-

gramming of internal EPROM, and revising software. The enclosure is a rack-

mountable 19” x 4” x 12" and is powered by 110 VAC. The GPZ8 digitiies a guitar

signal, stores it, and then plays it back in either forward or reverse, adding delays

or changing the speed to produce an assortment of echoes and Sweeping

reverberations. Specific effects can be chosen through two footswitches. Tom also added a ‘fail-safe’ circuit to protect

a musician’s performance should there be a malfunction or power difficulties.

PAWSDWC, A Power Arbitrary Waveform Synthesizer with Digital Waveform Capture

by Mark Wheeler

While the name is quite a mouthful (we defy anybody to pronounce it), we won’t mumble

when trying to describe this projec t. The list of supported func tions would please anyone

trying to work with analog signals: the PAWSDWC will capture and play back a waveform,

plot the waveform on a printer using a standard Centronics parallel port, upload and

download waveforms to and from an RS-232 port, allow hand-sketched waveforms to be

digitized using a hand scanner for synthesis by the system, allow user control of input and

output gains, and supply up to 40 volts peak-to-peak at 3 amps on its output. Mark intends

to continue updating the system with new features in the future.

Third Place: $100

 The Control Power of Embedded Forth

by Thomas R. Barnett

Forth is still the language of choice among die-hard embedded-application

engineers, Thomas based his Forth Design C enter on a version of Zilog’s Z8

processor with a built-in forth interpreter. With the addition of some memory, a

serialbort, and an EPROM programmer, he put together a flexible system for

doing forth program development.

Decem ber ‘9 l/January ‘92  63

Page 56: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 56/94

DEPARTMENTS

Firmware Furnace

I I

krp c r g *  75 

From the Bench

Hpow  83

Silicon Update

Practical Algorithms

wge9

Domestic Automation

ConnecTime

Micro-C, LEDs,and a Rotary Encoder

St u r g e o n ’ s Rule ha s it tha t 90% o f sc ie nc e 

fic tio n is junk . A sim i ila r rule  ap p lies to PC 

so ftwa re , but I ’d sa y that 90% is a lowe r bound O nce in a whi le , thoug h, yo u find a 

p rod uc t tha t ma ke s up for the rest.

As longtime Furnace readers arewell aware, I’ve been examining 8051C programming for quite a while. Al-though I remain entirely under-whelmed by the tonnage of machine

code per C instruction, I concede thatC helps you produce better programsmore quickly. As long as you keepthe overall size of the project withinreason, C is the way to go.

However, the cost of most 8051 Ccompilers and assemblers has been prohibitive for people who simplywant to find out what all the fuss isabout. That situation is now ended;the compiler I used for this projectcosts $50 and the companion assem-

 bler weighs in at $25. And best of all,they are excellent-quality tools thatyou need make no apologies for own-ing.

The project this time is an all-digi-tal combination lock with an RS-232output. The topic is certainly not origi-nal, but it’s a convenient way to illus-trate a C program that handles inter-rupts, updates an LED display, andworks in 128 bytes of Internal RAM.In fact, the lock makes an ideal 8751

 project because it uses only about 2K of code space (even in C!).

AN HONEST LOCK 

A standard combination lock, fa-miliar to you from years of lockingyour bike to utility poles, has a digi-

tal dial. You twist it one way to setthe first number, reverse course for the second number, and then back again to the final count. If you startout in the right direction and get allthree numbers correct, the lock popsopen. Of course, you can also slip ashim down the hasp and flip it openwithout knowing the combination,

 but that’s another story.The digital combination lock 

mimics that user interface, but im-

 proves on the display and overall se-curity. Turning the knob updates onecharacter in the display. Once you’vegot the right value, you pause andthe next character lights up. Adjustall four correctly and the lock popsopen.

The difference is the digital lock can’t be shimmed. The four-character combination is sent over an RS-232link to a remote location where it iscompared (perhaps by the PC con-

trolling the rest of your house?) tothe correct combination. If it matches,

66   ClRCUl?-  CELLAR NK

Page 57: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 57/94

FIRMWAREFURNACE

,Ed Nisle y 

the central computer ac-tivates the electric lock.Indeed, you can vary thecombination by time ofday or use it to trackwhich of several autho-rized people gained ac-cess.

Why not have thecombination(s) stored inthe 8031 so it can acti-vate an output bit thatdrives the lock? Thinkabout it: all a perpetra-tor need do is smash thebox, rip out the guts, findthe wire that obviously

goes to the lock (becauseit has a relay on the CPUend!), and short thewires to the power sup-

PlY.Age and treachery

will always overcomeyouth and innocence.

With that in mind,I’ve packaged the gutsin a simple plastic case

Photo 1 -The c om pu ter, rota ry enc od er, an d display f i t nic ely in a n off- the-shelf plast ic bo x.

that is not suited for high-security

outdoor use. I’ll leave it to you toarmor-plate and weatherproof asneeded for your application. There isone unused I/O bit, so if you reallywant to add an unlock function, haveat it. Just don’t call me afterwards.. . .

quires just two bits: one generates an

interrupt as the knob turns while theother indicates rotation direction.What could be easier?

SENSING ROTATION

into a ‘scope while tweaking an out-

put to perfection, the time-tested userinterface is a knob: clockwise formore, counterclockwise for less, a fasttwist for a bunch, a slow turn for anitsy, and hold still while you think.You don’t have to wonder which but-ton you’re pressing and how long tohold it down before it auto-repeatson you....

A push button is the archetypal While you can read a standarddigital input device because firmware analog potentiometer with an analog-can make two buttons produce “up” to-digital converter, a better solutionand “down“ counting sequences. is an all-digital, panel-mounted ro-However, some situations call for a tary encoder with TTL-compatiblerotary knob. When you’re peering outputs. The processor interface re-

The most common type of rotaryencoder uses a masked wheel and apair of photodetectors as shown inFigure 1. As you twist the knob, thewheel turns and the photodetectorsreport whether they “see” their re-spective LEDs   through the mask or not. The mask shown in the figure

produces only two pulses per revolu-tion per detector, but real-world unitswill give you a hundred to severalthousand pulses.

Dece mb er ‘9 I/Janua ry ‘92  67 

Page 58: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 58/94

 A   B  Phase

Figure 1 --This ro tary enc od er produc es two pu lses pe r 

revo lu t ion per de tec to r .

Figure 2 holds the key tousing a rotary encoder. The photodetector outputs, com-monly called Phase A andPhase B, are in “quadrature,”which is a fancy way of sayingPhase B has a 90” phase shiftrelative to Phase A. The sign of the phase shift depends on therotation direction: -90” for clockwise, +90”   for counter-clockwise.

variable. TESTBIT  ensures thevariable will be 0 if the bit islow and 1 if the bit is high;although this verification is notstrictly necessary, it makes testsagainst 1 meaningful.

Apart from those instruc-tions, the code needed to deci- pher the encoder’s state is asingle if statement. That’ssimple enough.

However, actually figuringout the direction doesn’t in-volve trigonometry, phaseangles, or complex calculations.Simply monitor Phase A for al-to-0 logic transition; if PhaseB is high immediately after thetransition, then the wheel isturning clockwise. If Phase B islow, it’s going counterclockwise.

n

@  LEDs

Also, you can use encoder interface ICs that handle all thedetails without interruptingthe CPU. These chips would

 be appropriate for high-perfor-mance applications that re-quire extreme precision andrapid rotations. For monitor-ing a knob on a panel, firm-ware alone will suffice! Jeff tells

The most practical way to moni-tor the encoder is to write an inter-rupt routine triggered by Phase A.When an interrupt occurs you knowthat Phase A has   just gone low, soreading Phase B gives an immediateindication of the direction. Each in-terrupt represents 1 /N-th rotation,where N is the number of pulses pro-duced per full turn. A simple signedvariable can hold the number of counts; the interrupt routine incre-ments the variable for each clockwiseevent and decrements it for eachcounterclockwise event. A count of +N means the wheel has gone onefull turn clockwise, -N means thesame but in the other direction.

to flip your code no matter how care- me he’s collecting information for theful you are. definitive encoder tutorial but won’t

Listing 1 shows the Micro-C code commit to a date-stay tuned to hisneeded to update a 16-bit  variable on “From the Bench” column for moreeach Phase A interrupt. Micro-C does details.not support the “interrupt” keyword With input in hand, we can look 

 provided by some other C compilers, at the output display. but the in-line assembler code neededto save and restore the CPU registers   CLASSIC CHARACTERS

is quite simple.Micro-C can’t handle a hardware Although LCD panels are prob-

 bit directly, so the TESTBIT   macro ably the best overall display for smalluses a few assembler instructions to embedded systems, there are somecopy the Phase B input bit into a C situations where they are not appro-

+   OneTurn  4,I I

The connections for a ClarostatModel 600-128 rotary encoder areshown in Figure 3: Phase A goes to

the INTO input on pin 12 and Phase Bgoes to pin 15. The encoder drawsabout 30 mA  from the +5  V supplyfor its LEDs,   photodetectors, and buff-ers. As you might guess from themodel number, the 600-128 produces128 counts per revolution and givesabout 2.8’ per count.

A

Clockwise

Incidentally, the patterns on theencoder wheel can be arranged in twoways. If you shift the Phase B pattern

 by 90” it will move the output signal

 by 180’ (think about it) and reversethe sense of rotation. The Clarostatencoders use this pattern, so expect

Counterclockwise

Figure 2-Photodetector ourpurs nave a YV pna se m m  m a r a e p e n a s on ro ta t i on a i r ec -

t i o n .

Page 59: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 59/94

 priate. If you need high contrast, goodnight visibility, or just a tiny pack-age, LEDs  are hard to beat. The onlycatch is raw LED characters tend touse either lots of cheap componentsor a few expensive ones.

The display for this project is anoldie that solves the component countand cost problems: the Litronix DL-1416 4-character X-segment alphanu-meric display. My data sheet is datedJuly 1979, which should give yousome idea of when these things firstcame out.

Back when TV sets were smalland dollars large, you could get amagnifying lens for that “big screen”effect. The DL-1416 has teeny-tinyLED segments and a big lens bubble

over each character. You need to bedirectly in line with the optical axisto get a good view, but for a lock that’s not a disadvantage at all: howmany people do you want scrutiniz-ing your combination?

The DL-1416 handles all the LEDmultiplexing and refreshing withoutan external clock input. It is not alow-power device: the data sheetspecifies 35-lOO-mA   drain from the+5-V supply. The interface is quite

simple, with two address bits select-ing one of four characters, six datalines for the ASCII character, and awrite strobe to load the data. A chipenable simplifies multichip displaysand a unique cursor function.

The DL-1416 timings are lethar-gic by contemporary standards. Theaddress and data setups are 1000 nsand the strobes must be at least 500ns wide. The simplest 8031 interfaceuses I/O port bits to drive the control

lines, although other CPUs  allow waitstates to match the bus to the display.

Figure 3 shows the connectionsrequired to bring the DL-1416 to life.The -CE (Chip Enable) input isgrounded because I only needed oneunit, so the device is always enabled.Power goes to pin 18, ground to pin19, and the remaining pins are notused.

Although the DL-1416 uses the

ASCII character set, it includes onlycodes 20 hex (space) through 5F (un-derscore). This range includes thecommon punctuation symbols, nu-

meric digits, and upper-case letters.The chip does not convert lower-caseletters and does not include some use-ful symbols, but on the whole it beats

 building discrete LEDs.

THE REST OF THE HARDWARE

Apart from the obligatory 8031CPU, address latch, and EPROM, theonly other chip is a MAX232, whichconverts serial port signals betweenRS-232 and TTL voltage levels.

As you can see in Photo 1, I useda Cottage Resources Control-R boardfor this project. While suitable for onlythe smallest projects because it has a2764 EPROM and no provision for external RAM, it works well when

the job fits. I had to nibble off onlytwo corners to shoehorn it in the en-closure.

The Control-R does have ananomaly that can cause considerableheadscratching. I routinely use anEPROM emulator instead of burningEPROMs, so I was surprised whenneither of my emulators worked onthe Control-R board. EPROM pin 26turned out to be tied to 8031 pin 26,although it’s not shown on their sche-

matic. If the board were to use a 27256, pin 26 would be address bit 13 andthe connection would make sense.However, the board uses a 2764,which shows pin 26 labeled as “noconnection.” The processor’s Al3 wasdriving the pin to a state my emula-tors weren’t expecting. Also, EPROM

 pin 1 is tied high, not low as shownin their schematic.

The catch is both of my EPROMemulators require all unused pins to

 be either disconnected or pulled up.After I tied pin 13 high, both emula-tors (and the EPROM!) worked cor-rectly.

Moral of the story: take nothingfor granted!

INTRODUCING MICRO-C

With so little hardware, the firm-ware must obviously provide the

majority of the lock’s functions. Be-fore diving into the code, I shouldexplain a little about Micro-C so youknow what to expect.

 AUTOMATION WEAR

Limited Edition

Top Quality

Perfect Holiday Gift

Let the world know you

love home automation!

POLO SHIRTSHandsome polo shirts by famous labelOUEREANKS,makersofpremiumclothingand golfwear. Home automation messagebeautifully silk screened on left chest.

SWEATSHIRTSTop quality Hanes grey pullover Sweatshirts bear full-size homeautomation message.

CARDER  FORM Homegggncer Its I935?-C  khitv   Rd.  I  Alfred_

Specify Number   San Diego,  CA 62126

I of Sizes Below Unit Total

I   S M  I- XL  Price Price

I

I

I

I

II

Name   i

 Address   I

City State Zip  I

: : o q Checkor  M.O. Enclosed Iar . EXP- I

L dReaderService  Xl4Q

December ‘9 l /January ‘92   69

Page 60: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 60/94

The Micro-C compiler is a front-end translator that produces interme-diate code. A CPU-specific code gen-erator translates that code into assem-bly language statements, which thengo through the appropriate cross-as-sembler to produce a HEX (or for PCs,EXE) file. The compiler and assem-blers are available for a bewilderingvariety of CPUs: 80x86, 8080/280,8051/31,   6811, 6809.. .essentially  allthe popular micros.

The C dialect is “K&R” ratherthan “ANSI,” so much of what youread about C nowadays does not ap-ply: no function prototyping, no ar-gument checking, no single-line com-ments, and so on. There are some non-standard extensions and quirky idi-

oms (“register” instead of “near”), butthe code is at least nominally por-table to other compilers. It is entirelyusable and a generation of C program-mers got along well enough withoutthe new ANSI standard features.

Of course, that same generationis responsible for C’s reputation as awrite-only language used to createprograms full of bizarre tricks andobscure bugs. You get out what youput in: be neat, be discreet, and stay

OK; be tricky and get dead.

The 8051 C compiler supportsTINY, SMALL, COMPACT, ME-DIUM, and LARGE memory models.You can use in-line assembler codefor speed when it counts. The start-up code includes a tiny debuggingkernel that you can use (I  haven’t,yet) to get your code working directlyon the target hardware.

Dunfield   also has an 8051 CPUsimulator that shows the current CPUstate, disassembles the instructions,and dumps Internal and ExternalRAM. It can connect to a debuggingkernel on the 8031 (through the serialport) to report and control the stateof I/O ports. The current versionworks at the assembly language leveland does not include symbolic infor-

mation, but he is considering addingthat feature and creating a C sourcelevel debugger as well.

The full-up Micro-C packagecomes with source code for every-thing: compilers, assemblers, run-timelibraries, simulator, utilities, youname it. The 8086 compiler can re-build itself, as well as the other pro-grams, using the MAKE files includedto simplify the process (you get theMAKE program and source, too). There

are dozens of sample programs.

To put this compiler in perspec-tive, everything described above willset you back slightly over $100 in-cluding shipping.

Obviously, we are talking obses-sion here. Dunfield’s code is good,tight work that I’d be proud to havewritten. His style is somewhat idio-syncratic, as you would expect, buthe knows what he’s doing and canexplain (or at least justify) his designdecisions without retreating into mys-ticism. Once again, his products showthat the best PC programs come fromone person in pursuit of a vision.

And I have yet to hit a compilerbug. Enough said?

MICRO-C AT WORK 

As you saw in Listing 1, the Mi-cro-C language requires some help tohandle the (admittedly bizarre) 8051architecture. The LED output routinesprovide a better look at what’s neededto write hardware-specific code witha general-purpose language.

Remember, Micro-C was de-signed as a portable compiler to pro-duce code for a variety of machines.The compiler is not the place for 8051-

specific features and quirks; those be-

Figure 3-Using  o stand ard 803 circuit  for i ts c ore, the e lec t ronic c om bina t ion loc k requ i res li tt le a dd i tional c i rc ui try to inter fac e o

the rotary enc od er and LED display.

70   ClRCUlT CELLAR INK 

Page 61: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 61/94

Page 62: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 62/94

Page 63: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 63/94

assembler) functions or in-line assem-bler code (perhaps disguised by a#define to look like a function).

The remainder of the C code forthe combination lock looks just like Ccode you‘d find anywhere else. That’sthe good thing about C; most of thecode in any project has nothing to do

with the 8051 itself, so using a higher-level language to get the most donewith the least effort makes sense. Thedigital lock’s complete source code isavailable on the Circuit Cellar BBS asusual. [Editor’s Note: Software for thisarticle is available from the Circuit Cel-lar BBS and on Software On Disk 24 .

See page 105 for downloading and order-ing information.]

IS MICRO-C FOR REAL?

Despite my admiration forDunfield’s work, Micro-C is probablynot the ideal C for very complexprojects. I’ve gotten used to ANSI Cfeatures and the error checking builtinto current compilers. In addition,high-end compilers support full Csource code debugging, which greatlyreduces the time required to get aproject running. When you’re doingthis stuff for a living, the return on

investment can be compelling.With that in mind, I plan to use

Micro-C for many upcoming Firm-ware Furnace projects. The compilerproduces code for Motorola microsas well as the Intel family, but I don’texpect to write much portable firm-ware because the bit blasting doesn’tconvert nicely. Stay locked in for someinteresting stuff.. .and suggestions fortopics are always welcome.

If the price of entry has kept youout of the microcontroller C market,you have no further excuses. Micro-C is as good as it gets!

CREDITS AND SOURCES

David Penrose’s “ElectronicCombination Lock” entry in the Sec-ond Circuit Cellar INK Design Con-test inspired the topic. He capturedThird Place in the Cost Effective cat-

egory and followed up with a chap-ter in The Circuit Cellar Project File,Volume I. His lock used a 8748 CPU

Ten microwatts.

Less money, lesspower, less time,less work.To place an order, or for more information, call:

1-800-GET-DATA   (438-3282)

1-602-996-0255/fax

With its automatic power cycling, that’s theaverage power draw of the nanoLlNKController/Peripheral in a typical application. Noextras--it’s all built-in and can be enabled withone instruction. Run your application for over two years on a 9V battery, or forever on a

thumb-sized solar cell. And because the nanoLlNK  Controller/Peripheralwas designed to function as a PC peri

8heral--no

programming required--OR as a stan -alonecontroller, you can use it on the bench, in thefield, or both. 8 A/D inputs, 32 I/O lines, 1Apower & PWM outputs, and much more.

 A full-function BIOS is included--no devicedrivers to write. A typical data-loggingapplication requires less than a dozen lines of code. And an interactive editor & macroassembler is included--no expensive crossdevelopment tools to buy.

 And the price? $395, quantity l--call today.

nano l  Power   Devices

Master 

PC/XT/ATwithNBS-10

or NBS-2Interface

Card

INTEL8051

HVACManagement

MOTOROLA68HCll

Data Acquisition

INTEL8096

AutomotIveControl

ZILOGZ180

SecuritySystems

Cimetrics Technology’s g-Bit Solution   networks popular 8-   and 16.Bit microcontrollers   by

taking advantage of the butlt-In  9-Btt multiprocessor   modes.

9 Benefits of the 9-Bit Solutionl Lowest cost embedded controller 

networking alternativel High s eed (62.5K   baud) with low

 etwor  overheadl Compatible with your micro-

controllers* High reliability protocol includes

l Multi-drop Master/Slave RS-485CRC checking

network l Low resource requirements no

external RAM re uiredl 250 nodes per network  l Simple to use so tware toolkit

l Ap lications  include data acquisition

Cimetrics Technoloev’s   Y-Bit SolutionC anfdistributed   c o n t r o l

includes the NBS-2”l 165)   or NBS-10($249) PC/XT/AT   network interface, the

j e rSenb3   121

December '9 l/January ‘92 73

Page 64: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 64/94

Page 65: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 65/94

FROMTHE

Electronic IdentificationBENCH

Jeff Bach ioch l1

Rockville General Hospital, September 20,2005.

“Congratulations Mr, B, you have a new son. We’ve just finished implanting

a PIN microchip under his thumbnail, and his Personal Identification Number is

#USA-CT-9-20-2005-01 36,” Dot announced. “You know, ever since the World

Council mandated PIN implants at birth, I’ve felt more like a technician andless like a doctor. It won’t be too long before every living being on this planet

can be identified and their whereabouts pinpointed in just a matter of 

seconds,” he added proudly. ‘Isn’t technology wonderful?”

“It certainly has made our lives easier, there’s no doubt about it,” I acknowl-

edged. ‘No need to carry ID or credit cards any more, this little implant doesit all.”

FACT OR FICTION

Is this view of the future far from the truth? Today wefanatically organize, alphabetize, and enumerate our lives.We have numbers for everything: phone numbers, housenumbers, zip codes, even time and date codes. The decimalsystem is no longer adequate; we have to have binary, hex,octal, hexadecimal, Roman numerals, and so on.

Take your social security number for instance. Nearlyevery form you fill out or bill you receive has this identifi-cation on it, and you can’t even open a checking or savingsaccount without one. You and I are just numbers in themassive data bank of the IRS.

HALT, WHO GOES THERE?

What is it that links our social security number to us?Fingerprints? Photographs? Magnetic strips or our signa-tures? How can these items lead to our identification?They all have a common thread. Differentiating aspectswithin each item, such as a fingerprint with a whorl versusa loop, a picture of a blond versus a redhead, or your credit

card’s one versus zero flux orientation, help separate onefrom the other. The total number of possibilities for anaspect make up a set. A 16-bit  binary set like the address

range of an 8031 has 65,536 possible IDS   (or addresses).Our social security number has a very large set:1,000,000,000  possible combinations. Your ATM machineinput pad uses the same 104  (10,000) set as your telephone,and security is based on the impracticality of trial-and-error guessing because of the large number of combina-tions.

A signature is adequate identification for our every-day transactions. However, signature recognition by com-puter is still in the Stone Age and not ready for the massmarket, so we must still rely on more conventional meansof identification. Present forms of identification may in-clude your house key, credit card, safe combination, li-brary card, or a password. Some of these forms are moresecure than others. For example, the house key, whichidentifies the bearer as “one who may enter,” can be copiedat any hardware store.

A door key also uses a set of possibilities to specify acombination. Your house key’s notches must match thepin lengths within your door’s lock, or the key can’t rotatethe tumbler and remove the bolt from the doorjamb. Eachnotch is more than the binary value of notch/no notch

because most keys can have notches of varying depths. Atrinary or quadruple value can be associated with eachnotch. A key with eight notches of binary depth has a set

Dec em be r ‘9 l/ Janua ry ‘92  75

Page 66: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 66/94

of possibilities totaling 28  (2561,  and an eight-notchedtrinary depth key’s set is 3’ (6561).   Naturally, the greaterthe number of combinations, the more secure the set. Sousinga   housekeyforsecurityisbasedonacombinationsetthat is large enough to be impractical to break and becauseyou can prevent it from being copied.

HARDWARE AND SOFlWARE  SECURITY 

If you have an AT, you probably have a hardware lockon the front of the box. This lock enables and disableskeyboard entry. Without the proper key no keyboardentry can be made and the system is safe. You may alsohave some variation of password protection to prevent

Figure1 Theho st interfac es at i ts 4.7k pul l -up w i th the 5cOk  pu l l -

do wn of the Ec ono RAM .

unwanted access either to your system or to certain fileareas. Both hardware and software keys establish identifi-cation from their own fixed set of combinations and offera level of security.

Hardware and software securities are oftentimes in-tertwined. Take a look at the ever controversial dongle.This piece of hardware sticks to your computer’s I/O portand perks up under the right conditions to send backinformation to the system. The software that started thetransaction then reads the data sent by the dongle andexecutes a conditional jump based on that data. This jumpcould be a friendly message informing you the dangle  isnot attached followed by a quick boot out of the programif the data is not as expected, otherwise normal executionisresumed. If the software is really nasty, it could calculatehow the dongle would respond and adjust the base ad-

dressof  a jump. Then the data with the added offset wouldequal the next program line to be executed. Datathat  doesnot indicate a dongle would add an incorrect offset to thebase address and jump to somewhere inconsistent withthe normal program flow. This inconsistency could createanything from minor to major havoc. Code of this type isakin to intentional virus planting and as such would be alikely candidate for legal suit. Let’s save the exploration ofdongles for another day.

ID IN A TO-92

Dallas Semiconductor released the product EconoRAMa couple of years ago. At the time the press release crossed

my desk I read it and thought, “RAM in a TO-92 package,WOW!” But then I read further and discovered it was only256 bits, which made the calisthenics needed to communi-cate hardly worthwhile. So into the file cabinet it wentalong with all the other orphan ideas looking for goodhomes.

Every orphan deserves a good home, and I think I’vefound one for EconoRAM. It can be used in the security of

your system. First, at little background. EconoRAM is alow-cost, 256-bit memory device that has reduced its con-trol, address, and data interface to a single pin. Includepower and ground, and you have a grand total of threepins. Operating voltage is from 1.2 to 5.5 V at a current ofonly a few nanoamps. Data retention standby current istypically less than 1 nA.

OK, so how does this 256 x 1 fully static RAM workwith only one lead? The host interface consists of a bidirec-tional bit with an open-drain driver and a pull-up of about4.7k. EconoRAM has the same interface except it uses a500k pull-down. This pull-down keeps the data pin low

when the device is disconnected, but it allows the pin to beeasily pulled high by the host when connected. If the hostoutputs a logic “1,” EconoRAM can pull the data line to alogic “0” state because of this wired-OR connection. Figure1 shows the interface necessary for communication withEconoRAM.

The host is responsible for initiating a read or write bitstream sequence. Each bit of the sequence isa  time slot. Thetime slot begins on a logic “1” to logic “0” transition andlasts for a minimum of 60 ps.  Three types of time slots are

E   CON IN

Figure 2- / f the p ow er source for the Ec ono RAM is alwa ys from a ba t tery , then the numb er of conne ct i ons nvo l ved in  the 8OC52- to -

DS2223 interfac e fa l ls from three to two .

76   ClRCUIT   CELLAR INK 

Page 67: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 67/94

Page 68: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 68/94

Page 69: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 69/94

Page 70: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 70/94

Page 71: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 71/94

Photo 1 -Perhap s b y the ye a r 2005,we ’ / / have a less pa in fu l wa y to Im- p lant the thumb nai l PIN tha n a kn ife and soldering iron.

entially garbled data upon thereading of the device. However,

  for a calculated checksumo be stored along with any other

data, the RAM bits must be bat-tery backed.

Enter a new device. The silicon serial number ex-

tends the possible bit combina-tions from 32 bits to 48 bits ofprewritten ROM. An B-bit CRC isappended to the serial numberensuring data integrity. This de-vice is strictly ROM and needs nobattery backup. Time slots areused for data communication, as

with the DS2223 and DS2224, butthe DS2400 has a unique feature.If the host sends a “zero” time slot of 480-l&   minimum identifier set the groundwork for a whole family of devicesduration, any connected DS2400 will answer with a pres- that are sure to come off the drawing boards of Dallasencesignal. If the host detects the presence of a DS2400and Semiconductor.sends the command byte OFH, the DS2400 will return the Listing 1  is the BASIC shell I wrote for the RTC52. Thistype identifier byte OlH,  followed by the 48-bit serial program makes calls to the time-slot routines (Listing 2)number and B-bit CRC. The presence signal and type written in machine language. The first routine writes 264

Real-Time Multitasking Executive

l INTEL 80~88/86,8096/8OC196l MOTOROLA 68OxO,683xx, 68HC11,68HC16

l INMOS  T400, T800 l ANALOG DEVICES 2100

l Preemptive Scheduling l Written in Cl Fixed or Dynamic Priorities l Source Code Included.  Time out on some services l No Royaltiesl Configurable and ROMable l Technical Supportl Intertask Communcations l Widely Ported

-  Messages l Sensible License Agreement-  Queues l Most Popular C Compilers-  Semaphores Supported

l Memory Managementl Resource Manager 

.  Over 40 Executive Services

l System Level Debugging Utilityl System Generation Utility

One Time License Fee $2,995Discounts for Multiple Licenses/Ports

The only real-time kernel  you’ll ever needTM

aderSeti eXl O9 ReaderServi ce 91

Dec em be r ‘9 l/Janua ry ‘92  81

Page 72: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 72/94

Page 73: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 73/94

SILICON

Summer Harvest

A C ornuc op ia O f Ch ip s 

UPDATE

I Tom anfrell

There was a time when summer in the not-yet-Silicon Valley was a rather

leisurely affair. Not so these days when “Summer Slowdown” refers to the

cyclical dip in IC sales, not sitting on the porch with an iced tea watching the

fish jump and the cotton get high.IC sales may slow down while the nation’s purchasing managers drag their

kids to Wally World, but the development of new and wondrous ICs doesn’t.

Here’s a sampling of Silicon Valley’s summer harvest,

HACKER PARADISE attracting hundreds of chip-heads, including me, fromaround the world.

Where‘s a die-hard computer guru supposed to go Check out the fun-filled schedule for a day at Hoton vacation anyway? Remember, these are people who Chips. All I can say is, watch out Club Med!take their kids to computer camp, not Wally World. Infact, given the propensity of the most obsessed to avoid   8:00-1O:OO Listen to people talk about chipsdaylight at all cost, summer is just a good excuse to spend   lO:OO-lo:30   Break-talk about chips over coffeeeven more hours in the lab. However, the preconception   10:30-1290 Listen to people talk about chipsthat computer types are antisocial is overblown-they   12:00-1:00 Lunch-talk about chips over foodust prefer to hang with their own kind. Thus, a “fun get- l:OO-3:00 Listen to people talk about chipsaway” like the IEEE Hot Chips symposium has no trouble   2:30-3:00 Break-talk about chips over colas

Figure -The u p c om i ng Sup erSp a rc

sup ersc alar ch ip from Sun a nd TI w i ll have 

two integer uni ts.

128-bit  access

Dual-system interface

Dece mb er ‘9 I/Janua ry ‘92  83

Page 74: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 74/94

Complexity Considerations in Big-Issue Machines

l Operand bypassing grows as

  (no_of_src_cperands)  (resulis_ingipeline)  i=  2 fs) i=  0 i’> b

l Data dependence checks grow as

l Plus priority encoder complexity- additionally increases logic complexity or logic depth

l Complexity grows fasterthan issue rate

Figure 2-  Ihe teasibir ity of spe c ulat ive exec ut ion feelies hea vily on the co nven tiona l w isd om tha t ‘ transistors a re free . Howe ver,many  note that ‘ wi res aren ‘ t .

3:30-5:oo Listen to people talk about chips5:00-7:ocl Reception-talk about chips over wine7:00-1o:oo Listen to people talk loudly (good wine!)

about chips

Despite all the talk, there wasn’t much new. In fact,as I claimed in an earlier article that logic synthesis repre-sents the “End Of Hardware,” it seems we’ve just aboutreached the “End Of Architecture.”

These days the main controversies concern two ques-tions: What is the best way to exploit instruction-level

 parallelism, and is there any instruction-level parallelismto exploit?

The interesting point is the questions are being ad-dressed in the above order; that is, people have been

 beating their brains out over the first question for sometime, but only now are they taking a close look at the  second question.

Instruction-level parallelism refers to the fact (hope?)that “sequential” instructions can be packed together for simultaneous execution by a suitably equipped machine.For instance, there isn’t any reason

A(i)=B(i) ; execute oneA(i+lOO)=C(i) ; after the other

can’t be “parallelized” into

A(i)=B(i)  :   A(i+lOO)=C(i) ; execute both; at the same; time

But how about

A(i)=B(i)A(i+j)=C(i)

a4 C lRC UlT CELLAR INK 

On first glance it looks like they could be combinedsimilarly, but don’t forget the case where j=O  which willcause the machine to try to assign two different values toA i at once!

Researchers seem to disagree on the answer to thesecond question (i.e., how much parallelism is present inreal-world programs?). Various studies report resultsranging from 1.37 to 90  Needless to say, research contin-

ues.. .Anyway, since it’s greater than one, we’ll be seeing

more superscalar chips with two integer units like the presumably soon-to-appear SuperSparc   (previouslyknown as “Viking”) from Sun and TI (Figure 1). Suppos-edly Intel had a similar idea in mind for the ‘586, but hasscrapped it (R&D budget shifting to the legal depart-ment?). I assume it may resurface in a later ‘x86.

The problem is, superscalar-which attempts to parallelize your program while it is running-leads tohorrible circuit complexity. Someone put a transparencyup during the “Five Instructions Per Clock: Truth Or 

Consequences” session (after the wine!) that said“Superscalar-The CISC Empire Strikes Back.”

So what’s next? Well, while speculation may havereigned supreme on Wall Street in the ‘8Os,  it’s moving toSilicon Valley in the ’90s: “speculative execution” is thelatest hot-button. For instance, if you have two executionunits and encounter a conditional branch, don’t wait for the condition to be resolved, but simply continue execu-tion down both paths. After the condition becomes clear,side effects from the incorrect path are removed. Thefeasibility of speculative execution relies heavily on theconventional wisdom that “transistors are free.” But ithas been noted by some, including Michael Smith of Stanford (Figure 2), that “wires aren’t.”

Figure J-Th e  Ana log Device s ADXL-50 ac c elerom ete r uses microm ac hining te c hnique s to m ea sure a c ce lerat ion in a single plane from 0 to 50 g ’ s ,

Page 75: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 75/94

Kind of makes youong for the days of BASICn a 6502, huh? That’s how know we’ve rea l lyeached the “End Of Archi-ecture.”

Overheard: Two gurusfrom secret startup XYZ

Corp. comparing their new  to market leader 

ABC’s latest widget:XYZ Guru l-‘/We’re

way ahead of ABC”XYZ Guru 2-“Yeah,

all we’ve got to do is get itworking. . .”

MICROMACHINES

Tethers,

Mass(moving plates1

 Anchors,

Fixed Plates,

In my opinion, the real secret for high performance is 5% accuracy and is designed especially for automotive

“crank the clock,” but such a view would certainly be   airbag  systems that currently use multiple mechanicaldeemed technically incorrect by the supertypes. Never- sensors. However, the ADXL50 can certainly be used for heless, it seems the most interesting developments (like other applications, and they will benefit from the com-

 CMOS) are in the hands of semiconductor pro-  petitive pricing-$5.00 in high volume-dictated by thecess wizards. automotive marketplace.

Beyond high speed, the wizards have even more tricksup their sleeves: micromachines. Micromachines resultwhen semiconductor processes are used to make electro-mechanical devices. For instance, researchers have al-eady demonstrated prototypes of tiny chip motors and

gears.

Figure 4 shows a close-up of the “H’‘-shapedmicromachined sensor located in the middle of the die.The “H’‘-shaped portion is the mass that is acted upon byacceleration, while interleaved capacitors detect thechange. Actually, the device is operated in a Force/Bal-ance mode in which an opposing electrical force is ap-

 plied to keep the mass stationary. The amount of this

charge corresponds to the acceleration, and additionalon-chip circuits further condition and amplify the out-

On a more practical front, micromachining techniques

are already being put to work by Analog Devices in their new ADXLSO   accelerometer (Figure 3).  The device mea-

 acceleration in a single plane from 0 to 50 g’s with put.

Figurel--TheADXL-50’s  ‘I-/‘-sh a p e d m i c r o m a c h in e d  

sensor locotedin  them idd le 

of the d ie s the m ass ha t is 

ac t ed upon by a c c e le ra -  

t ion, whi le inter lea ved c o -

pacitors detect the change.

Figure M o st ha rd disk sup pl iers ore c ur- 

ent ly w orking o n 2.5” mo de ls, but Integ ral 

Peripjerols Inc. is leapfrogging everyone else 

and show ing a 1.8” dr ive. lni i iol o ffering s in- 

c l ude 2O - m e g a b y t e  uni ts , b uf plans for 4U-

 uni ts ore und er wa y.

2 mm x 2 mm 50-pin  header 

10mm

+

69.85 mm 76.8 mm

Decem be r ‘9 l / January  ‘92  85

Page 76: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 76/94

Page 77: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 77/94

Page 78: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 78/94

eparate. Even with a separate controller, tiny disks callor ever more highly integrated control ICs. Integral use aersion of National Semiconductor’s HPC family withpecial enhancements (multiply/accumulator) for disk

motor (spindle and head) control.Along similar lines, Zilog has announced the Z86C94

Figure 6)   which combines a Z8 with on-chip DSP andigh-speed ADC and DAC. Like the National chip, the

dded circuits are designed for high-speed digital servo-motor control.

ISS

“Keep It Simple, Stupid” ranks right up there as onef my guiding precepts (along with “Don’t Fix It If Itin’t Broke” and “S t   Happens”). Thus, I’m just as

xcited about plain-jane real-world problem solvers as Im about the latest technowidget.

I discussed one of these in a previous article: theMaxim MAX232 RS-232 driver/receiver chip. Its simple

aim to fame was +5V-only   operation. Before theMAX232, a triple-output power supply (+5V,  +12V)  or

ludgy DC-DC converter setup was required.The only thing “broke” with the MAX232 is that it

eeds five external capacitors. Well, the new MAX233Figure 7)  is finally the dream RS-232 chip I’ve been wait-ng for. Especially handy for tinkerers, where every extraonnection potentially leads to late-night hair-pulling ses-ons (have you ever tried to debug a capacitor?).

CONTACT

Analog Devices Literature Center70 Shawmut Rd.Canton, MA 02021(617)  937-1428

Zilog210 E. Hacienda Ave.Campbell, CA 950086600(408)  370-8000

Maxim Integrated Products120 San Gabriel Dr.Sunnyvale, CA 94086(408)  737-7600

 holds a B.S. and an M.B.A. from UCLA. He owns andperatesMicrofuture Inc., and has been in Silicon Valley for ten yearsorking on chip, board, and system design and marketing.

RS422 Very Useful423 Moderately Useful424 Not Useful

DIGITAL DESIGNERSMINIMIZE YOUR LOGIC

KARNAUGH MAP SOLVER FOR PC’sMinimum Gates from Your Specs 

l Combinational, Sequentiall Mealy &   Moore State Machinesl 2 to14 Inputs, Any Number Outputsl Sum of Products, Product of Sums

l JK, D, SR, and T Flip Flops

l Expert Reference and Tutorial

-30 Day Money Back Guarantee

SAVE 40% :  1   + 5(P H)

What 8051 compiler would Santause toautomate his workshop?

BCI :”  of course - even Santa knows BASIC!

3Cl51’“BASICcrosscompilerwithintegermath~Supplement   BASIC-5;)r stand-alone 0 Now includes ‘C51 F support l BC151 with assemble1ind  utilities $299 l Powerful Dallas DS5000T   extensions $149Assembly   Language Programmer’s Toolkit l49 l superbdocumentatior 

sq

7a  54 East Roosevelt AvenueSalt  Lake City, Utah 84105301-487-7412 FAX: 801-487-3130

Decem ber ‘9 l / January ‘92  89

Page 79: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 79/94

 Affordable 8031 DevelopmentSingle Board Computers, Assemblers, Compilers,Simulators, and EPROM Emulators

Control-R Series, Single o rd   Computers Software and Hard- Development Tools

 Two models of Control-R series computers make Control-C 8031 Cross-Compiler $200.00prototyping, one of a kind products, or smallproduction runs easy and economical. Both featureRS232 compatible serial ports, single 5 volt supply

 The Control-C 8031 cross-compiler is a full featured K&R style Cdevelopment system available at an affordable price. Optimized

operation, and direct access to Ports 1 and 3 of the 8031.Additional features are as follows:

for embedded system use, it will pmduce ROMable code for any8051 based system including designs using only the 128 bytes of internal RAM. Package includes compiler, pre-processor,

Control-R Model 1 $49.95assembler, simulator, printed documentation and complete librarysource code. Requires IBM PC or compatible. 5.25”,  38OK  disk.

Fully populated board with I /O  header for Ports 1 and3, serial port, and 8K EPROM socket. 3.0” x 4.0”

Control-R Model 2   $79.95

PROMulator 256 $189.95

An EPROM emulator lets you avoid “Burn and Test” developmentcycles. In circuit emulation of 2K-32K  27xx series EPROMs. ABS

Plastic case. Assembled or compiled code is downloaded directly to

Same features as the Contml-R 1 plus 8K of SRAM andthe target hardware.

expansion bus with data, address, RST, INTl, WR,RD, PSEN, ALE and Tl. 3.5” x 4.5”   cottage  e WurceS   c o r p or a t i o n

Suite 151.10271 South 1300 East

Sandy, Utah 84094

VISA/MC,  COD. Call to Order: (801) 268 - 2875

V25 Power Comes to Embedded Control ! Micromint’s new RTCV25 is the perfect marriage of a PC-compatible processor, programming convenience, and control l/O.The heart of the RTCV25 is the NEC V25 microprocessor, an all-CMOS, 8088compatible  device running at 8 MHz. The 3.5” x 5” V25offers engineers 16-bit  processing power, large address space, and compatibility with  many of the most popular and useful software de-velopment tools available today. The RTCV25 enhances the V25’s power with 40 parallel l/O lines; 8channel,  8-bit AID  conversion; twoserial ports (one RS-232 and one RS2321RS1485);  up to 384K RAM and EPROM;a battery-backed clocklcalendar;  1 K bit EEPROM,ROMmonitor, and the RTC stacking bus. The RTCV25 is compatible with the full line of RTC peripheral boards and products.

Features   ODtions

l 8MHz  V25 processor  l i 28 bytes EEPROMl 2 Serial ports l Battery-backed Clock

 _ :: l 40 Parallel I/O lines   9 384K RAM and EPROMl

8channel,  8-bit ADCl

8channel,  lo-bit  ADCl RTC Stacking Bus l ROM Monitor l Small 3.5” x 5’ sizel 5-volt only operation

100 QuantityOEM Configuration  279.00

Actual size

3.5” x 5

MICROMINT, INC.4 Park Street

Vernon, CT 06066

call l - 800-635-3355f 2031871-6170

Fax: i 203j 872- 2204

Reader Senrice  167 

90 CIRCUIT CELLAR INK

Page 80: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 80/94

Parallel Filters

Desig n a nd Sim u la t ion b y Co m p ute r 

he d iffic u lt ies ma ny ha ve 

when hy ing io  wo rk w ith p a ra lle l 

 has resulted  in m uch o f their c a p a b ilit ie s e lY unex- 

plored, b u f using them c a n be 

m uc h ea sie r if a c om pute r d oe s 

 o f he  d i d y  wo rk .

You can use a computer to design a parallel filter withoutaboriously setting up and testing every possible arrange-

ment. Simulation of parallel-T filters by computer is par-icularly simple. The filters can be applied to data inecords of indefinite length, or in real time using a previ-usly developed algorithm [ll,   because they use onlyow- and high-pass filters. They achieve a range of char-cteristics you can conveniently explore using a spread-heet program. I will discuss two such programs andhow some of the filter characteristics they can simulate.

The parallel-T filter shown in Figure la is noted forts sharp rejection of a single frequency. In fact, the at-

enuation at the “resonant” frequency can be infinite with

PRACTICALALGORITHMS

Char les P. Boegli 

precisely sized components. By deliberately altering com-ponent values, you can reduce the severity of the attenu-ations.

This filter has a rather complex transfer function [21.

But the design of Figure la was used by analog-circuitdesigners before isolation amplifiers were easily avail-able; they had to achieve filter characteristics with theleast precise components possible. I will show you howsimpler circuits (meaning those more easily simulated bycomputer) obtain practically the same characteristics.When these simple circuits are used, the parallel-T turnsout to be an example of a number of filters having note-worthy properties.

ANALYSIS

The response of a single low-pass filter section (Fig-

ure lb) is described by the Laplacian expressionGLW  = (’ ,’  Ts>

For two identical filters in cascade, separated by a unity-

gain isolation amplifier [31, the expression is

GL s =   1(1  + Ts)’

(2)

W

igure 1 - a)  An exam p le o f a  pa ral lel f ilter ch ara c terized by i ts sha rp rejec tion o f a sing le freq uen c y 

 co m plex tran sfer func tion. (b) An e xam p le o f a sing le low-p a ss f i / ter . (c)An exam ple of a sing le 

(3)HW  = ’ yT

igh-pass fi l ter.

c)(2) has a flat response forperiods greater than T ,

while for shorter periods

-+

Tthe response drops off at 12dB  per octave.

Similarly, a single high-

pass section having thesame time constant (Figure14  is described by

In these expressions T  is the time constant of the filter,which you can conveniently measure for sample data interms of a number of samples (it equals P/2rc  where P is

the period in samples/cycle at the “turnover” point). Thefilter described by equation

Dece mb er ‘9 l/ Janua ry ‘92    91

Page 81: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 81/94

NoFlMwZ FREQUENCY

L-  me resp o nse o r a    rwo-secnon pa ra re r -/ nlref.

and two isolated sections in cascade behave as

w2 W  = _

(1  +  TS>’ (41

This filter’s response is flat for periods less than T anddrops at 12 dB  per octave for longer periods [4].

Assume a signal is split into two channels, one goingthrough a two-section high-pass filter and the other

through a two-section low-pass filter. After passingthrough the filters (all of which are assumed to have the

However, you may omitmany of the cumbersome stepsleading to equations (6)  and(7)  by using a spreadsheet. Ifthe substitution of jw  for s iscarried out separately for thelow-pass and high-pass filters,addition of real and imaginary

parts leads directly to the mag-nitude and phase of the entirefilter.

At w  = 1 (the frequencywhere all the corners are lo-cated) the numerator in equa-tion (6)   is zero and the magni-tude of the response vanishes.Where w  <  1 the phase is thearctangent of a negative quan-tity, while where w>  1 the arct-angent  is positive. At o = 1 thephase appears to go throughan abrupt transition from -z/

2 to +7c/2.  I’ve simulated these essential characteristics ofa parallel-T filter by a simple arrangement of low- andhigh-pass filters. Figure 2 is a graph of the response.

Total rejection occurs when the responses of the low-pass and high-pass sections are equal and x:  radians outof phase at one frequency. Use at least two sections ofboth types of filter because each one has a phase shift ofx/2 only at a period of 0 or   depending on the type offilter. However, the number of sections has no upper

limit because a shift of rc/2  always occurs within a rea-sonable distance of the corner for every multisection fil-same time constant) the two signals are added. The sum ter.of the two signals has the trans-fer function

G($ = (1 +Tzs2)

(1 + Ts)~ (5)

You can obtain frequencyand phase responses by sub-stituting jw  for s and rational-

izing the resulting expressions.“Normalize” equation (5)without any loss of generalityby setting T = 1. The magni-tude of the response is

 =m   6)

(1 + ClJ’>’

and the phase is

MXiM UZf FREQUENCY 

(71 Figure J-The resp on ses of som e t w o - p a r d e l sec t ion f it ters w here the t im e c on stan ts of the h i g h -

pa ss sec t ions are the rec iproc al of tho se o f the low -pa ss to m aintain the c ente r freq uenc y of 1.0.

92   C iRC UlT C ELLAR INK

Page 82: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 82/94

Page 83: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 83/94

_

NORM UZE FREQUENCY 

Figure a-The respon se o f fwo -sec tion pa rallel f i lte rs w ith va riou s high-p a ss gains In  which fhe  fatalrejection of a sing le frequ enc y appa ren f l y stil l o c c urs.

can be greater or less than 1 .O. 1Ed i t o r ’ s  Not e: Software  for this article is available from the Circuit Cellar BBS and onSoftware On Disk 24. See page 205   for downloading andordering information.]

If the time constants of the low- and high-pass sec-tions are different, total rejection of one frequency doesnot occur. The response continues to exhibit a dip as longas the frequency of the low-pass filter is greater than thatof the high. The opposite condition produces a broadpeak in the response.. Figure 3 shows typical curves forcases in which the time constants of the high-pass sec-tions are the reciprocal of those of the low-pass to main-tain the center frequency  of 1.0.However, if the time constantsof all the filters are identical,but the gain of one set differsfrom that of the other, total re-

 jection of one frequency appar-ently occurs. The rejected fre-quency merely moves off from

f = 1.0 as shown in Figure 4.This parallel-T filter yields asharper cutoff than an assem-bly of simple filters, but at theexpense of greater gain at a dis-tance.

Also, the spreadsheet canfind the response that resultsfrom subtracting (instead ofadding) the outputs of the low-and high-pass filters. The useof a negative gain for the high-

pass filters is necessary. Typi-cal curves are shown in Figure5.

Three-section filtersThe spreadsheet PARAL-

3. WQl   is designed similarlyfor parallel arrays of three low-pass and three high-pass fil-ters. All six time constants canbe set independently. You mayuse the spreadsheet for two-

section filters if the time con-stant of one of the high-passfilters is made very large orone of the low-pass filters verysmall. Figure 6 shows re-sponses, analogous to those ofFigure 2, for a three-section fil-ter in which all sections have again of 1.0 and the time con-stants of the low-pass sectionsare reciprocal to those of thehigh-pass sections.

The steeper cutoffs of thethree-section filter somewhatsharpen the null in the paral-

lel filter, which can be seen in Figures 2 and 6. The phaseshift of three identical cascaded high-pass sections is notn/2 at w = 1.0; the time constants must be 3+05  (and that ofthe low-pass sections 3-O”) to get total rejection at w = 1 .O.When the high-pass part’s gain is altered, the response nolonger goes through a complete null; in this respect, thethree-section filter is not as “well behaved” as the two.

SIMULATION IN TIME

Frequency-domain simulation of parallel filters al-lows rapid, easy observation of their responses and the

NORM UZE FREQUENCY 

Figure5-The resp on se ha f result s ro m  sub tra c t ing the outp uts of low - and high-pa ss f ilters.

Page 84: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 84/94

NWUAUZED  FREQUENCY

and high-pass filters in thetime domain to sampled sig-nals, and I developed algo-rithms that can be readily ap-plied directly to parallel filters[51.

 forathree- sec t ion filterin whicha l lsec t ionshavea ga inof l .Oandthe  t im e 

onstants of the low-p ass sec t ions are rec iproc al to those of the hig h-p ass sec t ions.

An implicit advantage ofthis kind of simulation is cum-bersome calculations for fre-quency-domain simulation areunnecessary. However, certaindisadvantages exist. The sam-pling frequency must be highenough compared to the sig-nal being sampled that certainapproximations will not un-duly degrade the results. Also,you can only examine the par-allel filter’s performance a fre-

quency at a time.Figure 7 is a time responsedrawn with the spreadsheetTIME-2.WQl.I   subjected the

ffects of manipulating the constants. You can also simu- incoming wave to two successive low-pass and high-passate these filters in the time domain using a spreadsheet if filterings simultaneously, and then merely added the re-   I

n algorithm is available to perform the necessary filter- sults sample by sample. The time constants of all theng. In my article “Filtering Sampled Signals” in issue filters in this figure are the same as the radial period of1  of CIRCUIT CELLAR INK, I showed how to apply low- the incoming signal, so the output signal is zero. When

The $595 Solutio n to 8051 System Developmen t 

PDKSI

The PDK51  is a fully integratedhardware, firmware, and softwaresystem destgned   to help you developyour products quickly and costeffectively.

 All you need to use the PDK51 isan IBM-PC/XT/AT or compatible.We supply the rest.

PDWY  PLUS includes everything in the PDKSI  plus Vers.  3 of our popular BXCSl  8051/8052  BASIC compiler-$800.

Call Now! 603-469-3232 or FAX 603-469-3530

qBinary Technology, Inc.Main  Street . PO Box 67 . Merlden.   NH 03770

EIaE i

aderSewice  Xl 14

The EC-32TM is a versatile 8OC32  microcontrollerboard. It is ideal for quickly developing products,prototypes or test fixtures.

l 8OC32   microcontroller (8051 compatible)l BASIC-52 or MONITOR-52 availablel Program in C, BASIC or assembly languagel 8 to 92K RAM, EPROM or EEPROMl Breadboard area and expansion busl RS-232 port and 12 digital I/O linesl $100 for 11 MHz, $145 for 20 MHz

Dec em be r ‘9 l/ Ja nua ry ‘92 - -  

Page 85: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 85/94

Figure7--The  t ime b eha vior of a p a ra lle l f ilter using sp read shet 

TIME-2. WQ  at ICO  sa m ples/ c yc les sa mp ling rate. The i n c om i n

wa ve is sim ulta neo usly sub jec ted to two suc c essive low -pa ss an 

high-pass fi t ters. and the resul ts are added sample by sample.

REFERENCES

1. Charles P. Boegli, ‘Filtering Sampled Signals,’ C~ncurrCELLAR INK June/July 1991, pp. 98-101.

2. This filter is extensively discussed in James, Nichols. andPhillips, The ory of Servom ec ha nism s (New  York,McGraw-Hill Book Company, 1947). p. 117ff.  lhe com-plexity of the transfer function arlses from mutual load-

ing effects.3. The isolation amplifier prevents the second sectionfrom loading the first. The second section Is also pre-sumed to be followed by an isolation amplifier toavoid loading.

4. The responses of both low and high-pass sections donot actually show a sharp transition at the ‘corner’frequency, but rather change smoothly from  oneslope to the next. A single-section filter of either hype

has an attenuation of 3 dB at the ‘corner.’5. Charles P. Boegli, lot. cit. Also see the sidebar.6. Charles P. Boegli, lot. cit.

the period of the incoming signal is changed, the output Charles Boegli is president of Randen   Corporation in Blanchester, Ohio.is no longer zero, which the frequency-response graphs

  Ran n   is a small company offering services in technical computer 

show. programming and analog circuit design.

The starting transient seen in Figure 7 appears in theoutput record until the response has had time to settle. IRSYou can eliminate the response by applying a suitable 425 Very UsefulHanning time window to the incoming data or just ignor-ing it until it settles. +

426 Moderately Useful427 Not Useful

DG32F8031 Controller Board

with FLASH MEMORY

Eliminates the need for Progr ammer 

and UV Eraser 

l Serial Peripherial Interface Portl Supply Voltage Supervisor Circuit

Board size 4.8” x 6”l EPROM monitor with Flash management programl Application software

 A&T BOARD $155 - PARTIAL KIT (all components

and documentation except Flash Memory screw

terminals) $1 IO  PCB - bare board with documentation(manual, shematic  and parts list) $ 40

@ti L.S. ELECTRONIC SYSTEMS DESIGN

6 2280 Camilla Rd. Mississauga, Ontario, Canadav  L5A  2J8   Phone/Fax: (416) 277-4893

Terms: Shipping US/Canada $6 Check or Money Order, Please

NORTHEASTDebra Andersen

49 Walpole Street

Norwood,   MA 02062

(6 17) 769-8950

Fax: (6 17) 769-8982

MID-ATLANTIC

Barbara Best569 River Road

Fair Haven, NJ 07704

(908) 741-7744

Fax: (908) 74 l-6823

SOUTH EASTChrista  Collins

7640 Farragut Street

Hollywood, FL 33024

(305) 966-3939

Fax: (305) 9858457

MIDWESTNanette Traetow

242 East Ogden Avenue,Suite A

Hinsdale. IL 6052 1

(708) 789-3080

Fax: (708) 789-3082

WEST COASTBarbara Jones8 Shelley Rainey

3303 Harbor Blvd.,Suite G-l 1

Costa Mesa, CA 92626(7 14) 540-3554

Fax: (7 14) 540-7 103

96   C lRC UlT CELLAR INK 

Page 86: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 86/94

DOMESTICAUTOMATIONKen Dav idson 

iome Automation:?ead All About It

We often have people new to home automationcall us or leave us a message on the Circuit Cellar BBSasking how to find out more.

“Are there any good books on the subject?”“I’m building a new home and want to prewire it for 

home automation. What should I do?”

Up to now, I’ve always had to go into a song anddance about how the industry is still young, there reallyisn’t much out there for the novice, and most systems onthe market are specialized enough that it would be diffi-cult to write a general-purpose book about home auto-mation.

I’m happyto   report that I can finally stop dancing(I’m awful anyway; just ask my wife) and start recom-mending some real books. I came across two recently andwant to give you my impression of them.

HOW TO AUTOMATE YOUR HOME

Written with the novice in mind, How to AutomateYour Home does an excellent job of covering a broadrange of subjects dealing with all aspects of home auto-mation. Author David Gaddis starts with an overview of the major players in the industry, including X-10,Smarthouse, CEBus,  and Echelon. Because the latter threewere in a state of flux at the time the book was written(as, for all intents and purposes, they still are), some of the details he presents about them were dated even be-fore the book was published. (Now you know why no-

 body has been anxious to publish a book before now.) Of the group, X-10 is the only system actually on the marketthat the individual can obtain, so he uses it as the basisfor much of the book.

Gaddis continues with an overview of the variousmedia used in home automation, and spends a chapter talking about wiring homes, both new and retrofits. Fromthere, he spends several chapters discussing home secu-rity, appliance and lighting control, audio/video systems,telephones, and environmental control systems. In eachcase, he presents equipment currently on the market (anddoes a good job of covering more than just X-lo),   makes

suggestions for how to plan your own automation setup,and presents installation examples that you can use asthe basis for your own system.

The information presented is very good, and Gaddisdoes a wonderful job of covering virtually everythingavailable on the market, but the presentation itself isterrible. The editing is awful, and the book appears tohave been prepared using just a word processor (no in-teresting twists to the layout that can only be provided by

 page layout software). It also looks like it was printed ona dot matrix (or a bad inkjet) printer. The least he could

“I’m b u ild ing a new hom e 

and w a n t o  p r ew i f e  if fo r 

hom e a utom at ion . Wha t

should I d o?” 

have done was beg, borrow, or rent a laser printer for thefinal output. Coupled with cheap paper and poor print-ing, the bad text makes spending much time reading

 before eye fatigue sets in difficult.Most of the figures appear to be bad copies from

many different sources. I even recognized some lifteddirectly from copyrighted material (including the book I’m going to talk about next that I know was on the

market first) with no attribution given.The book also lacks a much-needed index, which

might help lessen eye fatigue because you wouldn’t haveto search as long to find a particular subject.

All in all, How to Automate Your Home is an goodintroduction to the world of home automation if you canget past the poor publishing job. The book runs 128 pages,includes 115 illustrations, and is available for $29.95.

Home Automation, USAP.O. Box 22536Oklahoma City, OK 73123

 405)   840-4751Fax: (405) 842-3419

98    CIRCU/ T  CELLAR INK

Page 87: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 87/94

Page 88: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 88/94

CONNEC-TIME

Conduc ted b y  Exc e rp ts from the C irc uit Ce lla r BBS Ken Davidson 

The text-only environment of a BBS doesn’t lend itself todoing graphics, but some adven turous souls often f y their hand at “ASCII art.” The first thread, dealing with NiCd

batteries, has a schematic that I redrew to make easier toread. The second discussion on using RJ-11 connectors for serial connections has some art left intact.

Put a bunch of engineers  on a BBS, bring up the topic of rechargeable batteries,andyou’ll   end up with enoughgoodinformation fo-write the definitive NiCd  book. Read on.. .

Msg :46149From: RICHARD FOLEA To: ALL USERS

Can anyone tell me what I did wrong? I have a Panasonic

camcorder (one of the large ones that you rest on your shoulder;I can’t remember the model number) that uses a larger re-chargeable battery; 12 volt, I think. After about three months of use, the battery wouldn’t take a charge anymore. That is, thecharger would “charge” the battery, the indicator saying the

 battery was charging would go off, and I would put the batteryin the camera. The battery would only last a few minutes.

Is there something goofy about these batteries that you can’tleave them in the charger all the time, or should I occasionallysuck all of the current out of it and fully recharge it? Now that Ihave a battery that acts like this, can I fix it by shorting theterminals with a small resistance? I’d appreciate any sugges-

tions. Also, does anyone know where I can get new batteries?The local mall wants SSO There has to be a better way.

Msg :46151From: RUSS REISS To: RICHARD FOLEA

Yup! Right on both counts. NiCds (which these undoubtedlyare) get unhappy both with (SOME) continuous trickle charge,and incomplete cycling. You MIGHT be able to bring them back to life by completely discharging, then recharging a number of times. I wouldn’t discharge too quickly, or the internal heatingmight cause damage, but some resistance that approximates

normal usage, I’d guess.

Try calling Periphex Inc. at (800)  634-8132. The fellow there (Iforget his name) is very helpful, sells inexpensive packs, and

The Circuit Cellar BBS300/  1200/2400 bps

24 hours/7 days a  week(203) 871-1988

Four Incoming LinesVernon, Connecticut

I’m sure can give you some tips and get you rolling again. Note:“inexpensive“ NiCds are never inexpensive though. You cansave SOME $$  from him, but they won’t be CHEAP. I buy my

video recorder and ham radio battery packs from him, though,and they are very reliable.

Msg :46154From: TIMOTHY TAYLOR To: RICHARD FOLEA

For batteries, try MCM Electronics, (800)  543-4330. I’ve pur-chased a number of batteries for my Sony camcorder. One thingto remember is to completely discharge the batteries before thecharge cycle begins. That’11 somewhat alleviate the “memory”

 problem. Also, follow manufacturer directions completely whenyou get new NiCds. You’ll really extend the life of ‘em.

Msg :46164From: PHIL COVINGTON To: RICHARD FOLEA

My Panasonic camcorder uses a 12-V gel lead-acid battery; thenumber on the battery is PV-BP8O.   I bought an extra one re-cently and the instructions that came with it states that youshould *NOT* discharge the battery completely and shouldcharge the battery immediately after use. These directions seemto be consistent with the battery type.

Msg :46175From: RUSS REISS To: PHIL COVINGTON

You are  right! Lead-acids should never be allowed to “draindry“ and should not be stored in a dead state. Gee, I’ve not seengel cells in camcorders. I’ve always liked them better than NiCdsin many respects.

Msg :46207From: PHIL COVINGTON To: RUSS REISS

I was expecting to find NiCds too, until I opened an old battery

from my camcorder and found that it was a lead-acid type-ithas six cells with rubber vent caps. The manual for the camcorder also had a warning about breaking the battery and coming incontact with the electrolyte containing sulfuric acid.

10 0   ClRCUlT CELLAR If%

Page 89: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 89/94

Radio Shack’s 1992 catalog has a replacement battery that ap-ears to be identical to the battery I have, but the catalog states

hat it’s a NiCd  battery pack. Having recently purchased anxtra battery pack for my camcorder, I am now wondering if it a NiCd  or lead-acid type. The original Panasonic battery pack as a thin cover that can be pried up and under it you can see

he rubber caps for each of the six cells; the new battery (not aanasonic) appears to be completely sealed. If some of theseeplacement battery packs are in fact NiCds, I wonder what

ffect charging these packs with a charger designed for theriginal lead-acid battery has on the life of the new packs?

Do gel cells suffer from the same problems of incomplete cy-ling as NiCds? I was wondering if anyone makes a gel celleplacement battery pack for my 2-meter HT.

rom: STEVE CIARCIA To: PHIL COVINGTON

Generally speaking if your device comes with a modular trans-ormer and not one of those 1-3 hour intelligent outboard charg-

rs, you can make the following assumption: if the chargingnstructions say plug in the charger overnight, or leave theharger plugged in all the time, but nothing about charging itoo long, it is probably NiCd.  If the instructions say plug it invernight but no longer, or something like “Do Not Overcharge,”hen it is probably lead-acid. NiCds can trickle charge but lead-cids don’t like it after they are at a certain level.

You charge a NiCd with a constant-current charger and a lead-cid with a constant-voltage charger. The little modular sup-lies described above are more like current chargers and there-ore only suitable up to a certain point on a lead-acid battery.

rom: RUSS REISS To: PHIL COVINGTON

Well, Steve pretty much answered it Phil. As for gel cells for   no, I’ve never seen any. That Periphex number I  gave

arlier in this thread is run by a ham, mostly for hams. I havehought about making a “battery belt” one could wear that

would provide long-term power for HTs   for emergency com-munications, camping, hiking, biking, sailing, and so forth. Never id go far with the idea, though.

rom: ANDY SARNAT To: RUSS REISS

couldn’t help feeling a little deja vu when I read the originaluestion about the failing NiCds: the battery pack in my Toshibaaptop had exactly the same symptoms after about 6 months.e., a full “charge” only lasted a few minutes). But I  alreadynew about the NiCd memory problem and I  thought I treated

hat battery pack real nice from the start. I always deep dis-harged it, I never overcharged it or left the charger plugged invernight, did everything but take it to dinner and buy it flow-rs, and this is the thanks I get! So what went wrong?

even tried to rejuvenate it by fully recharging (until the LEDndicated “full”), then discharging to zero by leaving the screenacklight on full intensity until dead, then repeating the cycleix or seven times. No dice.

The local Toshiba dealer says “everybody has to replace their  battery pack once a year or so,” but of course he SELLS batter-ies. So I shelled out for a new battery pack, then pried open theold pack to find six NiCd cells all connected in series with metalstraps spot-welded to their cases, so I don’t see any prospect for replacing the cells myself, even though I’ve been told that prob-ably just one of the cells is bad.

So I’ve got three questions for the battery gurus:

(1) Whuddya do to prevent this?(2) Is there a practical way to replace welded-together cells?(3) How come my Dustbuster sits on my wall trickle chargingcontinuously for years, hardly ever gets deep discharged, and isstill as strong as a Clydesdale?

Msg :46205From: BOB ARMSTRONG To: ANDY SARNAT

You can replace those NiCd cells just by soldering in a replace-ment for the one (or more) that’s gone bad. Just rough up the

surface some with a file or sandpaper to make it take solder, usesome solder wick as a strap, and off you go. I do it all the time.Just don’t short the cells.. . they get kinda hot!

MS@46217From: ANDY SARNAT To: BOB ARMSTRONG

Thanks, I’ll give it a shot. One more question: can you mixdifferent size NiCd cells in series? Since each cell handles thesame current, would the smaller ones suffer damage in serieswith larger ones under normal load? The reason I ask is that thecells in the battery pack don‘t seem to be a standard size. They

are cylinders about 5/8”   diameter and 2.5” long. What wouldhappen if I substituted AA cells for one or more of them?

Msg :46219From: JEFF BACHIOCHI To: ANDY SARNAT

You can mix sizes, but current (when the cells are in series) will be limited to the maximum of the smallest cell.

Check Digi-Key. They offer battery packs and individual cells.Sizes are NOT limited to the standard AAA, AA, C, and D, butinclude 1/2’s, 1/3’s, 2/3’s, and other oddities!

Msg :46248From: STEVE CIARCIA To: ANDY SARNAT

Different size NiCd   cells have different charge (and tricklecharge) ratings. The 100-mA  charge on a D-cell will fry an AAcell. Be careful about radically different sizes in series.

Msg :46252From: BOB ARMSTRONG To: ANDY SARNAT

They sound like “sub-C” cells. Check your local hobby store for cells used in model cars and airplanes. They range from 1000 to1800 mA and can be purchased individually or as a 6-  to &cell

 pack. Packs average $25 to $40 each.

December ‘9 I/January ‘92    101

Page 90: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 90/94

Msg :46294From: JAKE MENDELSSOHN To: ANDY SARNAT

Do not ever try to deep discharge a NiCd  by just leaving theequipment on and draining it to zero. You can get a situationcalled voltage reversal where the voltage of the NiCd is actuallyswitched. Once that happens, you will not be able to rechargethe NiCd.

Here is what happens to NiCds in series: Assume you have five NiCds in series, each with a full voltage of 1.2 V (carbon-zinc batteries have 1.5 volts per cell; NiCds general have only 1.2 V).

The five new NiCds in series give you 6.0 volts. Now after usingthis NiCd set for a while, one of the cells develops an internalshort (see message 46157). This cell is shorted out and is nolonger in the circuit. Now when you try to recharge the set asyou did before, there are only four cells in the series circuit.Your charging circuit will try to charge them to a total of 6 voltsas before. This forces each cell to 1.5 volts per cell. This over-charging damages the other previously OK cells. The end resultis you now have one cell damaged with internal shorts and four cells damaged by overcharging. The whole set is destroyed and

there is not much you can do, except as the salesman said,“Everyone has to replace their battery pack once a year or so.“The 500 recharging cycles claimed in the advertisements is atheoretical limit that I have never even come close to.

If you use a very sharp wire cutter or a Dremel tool you can cutthe thin metal connectors that are welded between the differentcells. Then try &dering   your new good cell into the seriescircuit. The new cell you are adding should have the same levelof charge as the other cells in the series or you end up with thesame uneven charging problem. I always charge all cells indi-vidually to 100% before I solder them together and use them asa team.

There are different configurations of cells with different chemi-cals, different chemical ratios, and different internal structures.Some cells are meant to use used in situations where they areconstantly cycled up and down, others are normally in a fullycharged standby mode and supply current only rarely. Somecells are meant to supply heavy current for a short time, otherslow current for long periods. You really need to match thespecific type of cell for the specific use you have in mind.

Gel cells do not seem to suffer from the same “memory” and“internal short” problems that affect NiCds.

The amp-hour rating of these cells is based on a 20-hour dis-charge rate. Thus, a IO-AH cell will give 0.5 amp for 20 hours(0.5 x 20 = 10). You will not be able to get 10 amps for 1  hour outof the cell. The optimal recharging rate for a cell is 1 /lO to l/20of the load rating. Thus you should recharge a IO-AH cell at a l-to 0.5-amp rate.

MS& :46157From: JAKE MENDELSSOHN To: RICHARD FOLEA

 NiCds have two problems (besides price):

MEMORY-NiCds   tend to “remember” how much they wereused and then only operate to that level. For example, if a NiCdis discharged to its 80% level and then recharged, and if this

102 C IRCUIT CELLAR IM

cycle is repeated many times, then the NiCd  will “remember”that 20% discharge and will not be able to go beyond it. The 20%

 becomes the full 100% capacity. The way around this is to “deepdischarge” the NiCds every once in a while to clear their memory.I rigged up a small resistor and relay circuit to slowly dischargethe NiCds and then stop when the voltage reaches a minimum.You never want to completely discharge a NiCd,  because thenyou may get another problem: “voltage reversal.”

INTERNAL SHORTS-A NiCd  can also develop an internalshort within the cell itself that limits its capacity. The way toclear these shorts it to charge up a large capacitor (>lO,OOO  PI?to 50 volts and then connect the capacitor to the NiCd.  Therewill be a large spark as the capacitor quickly discharges throughthe NiCd. This massive current will burn out any of the shorts.You may have to do this a few times to completely clear theNiCd. Charge the capacitor slowly with a resistor in series, butlet it discharge directly through the NiCd. Be  careful of thelarge current. It can hurt.

Msg :46170

From: JOHN S. FETZIK To: JAKE MENDELSSOHN

What’s your battery discharge circuit look like? What kind of resistor value and what voltage do you have the relay drop outat?

Msg :46293From: JAKE MENDELSSOHN To: JOHN S. FETZIK 

I am NOT a battery engineer, but after many, many years of spending a small fortune on batteries, talking to many batteryengineers, and reading lots of articles, here is what I have gath-

ered:

The circuit I use for deep discharging NiCds looks like this:

Bulb NiCds

Relay

m T MOlll2;P. Switcx 1

  il)JContact

Pushing the momentary switch, completes the circuit and acti-vates the relay. The relay contacts touch thus supplying a cur-rent path when the momentary switch is released. The currentfrom the NiCd goes through the relay coil and the bulb. Whenthe NiCd is drained low enough that it can no longer keep the

relay pulled in, the current stops. The bulb is just a visualindicator that the current is still flowing. I don’t think there isany magic value on how low the voltage should be before the

Page 91: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 91/94

Page 92: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 92/94

Page 93: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 93/94

Page 94: Circuit.cellar.024.Dec.1991 Jan.1992

8/13/2019 Circuit.cellar.024.Dec.1991 Jan.1992

http://slidepdf.com/reader/full/circuitcellar024dec1991-jan1992 94/94

STEVE’SOWNINK 

1Steve Ck fciu

T

Consultant’s Dilemma

  he Circuit Cellar BBS is more than a place for readers to

exchange technical information. Frequently it has become a place

where consultants and business entrepreneurs discuss basic

 business techniques and ethics.

Recently, one of the consultants on the BBS had a potential

customer who wanted to evaluate a design but would only

entertain buying the product after it was designed. Part of thedeal also included building a prototype for evaluation. Because

he didn’t trust them, however, he was asking our advice on

 protecting his design. Was it acceptable to sand off the numbers

on ICs?  Should he pot both the prototype and the finished units

so that they wouldn’t steal his design?

Much to my amazement, messages poured in describing the

 best ways to remove IC nomenclature, complete with discus-

sions on the particular merits of using special solvents instead of 

abrasives.

Often, the BBSers  are so quick to answer a question or offer 

advice that they don’t look at the whole picture. I think every-

 body completely missed the boat. In my opinion, the first rule of  business (consulting or otherwise) is that if you don’t trust the

customer, you shouldn’t even be there. If the design is truly

customized for a particular application, albeit inexpensively

reproduced, you have invested your time and money already.

It’s called risk.

Whether or not the customer buys it depends upon their 

need and willingness to have you as the sole supplier. If distrust

is at the level where a “rip-off” is feared, presenting disguised

designs only fuels unethical behavior. The customer’s perception

will be that your solution is so inexpensive (even if you bargain

price the finished nit) that the ill certainl entertain an

My experience has been that reasonable-sized businesses

cannot deal with black-box purchased products unless complete

warranty responsibility is in the hands of the supplier. A one-

man shop will have difficulty doing warranty equipment swaps

in Saudi Arabia and keeping production rolling at the same time.

Often companies can’t invest in new designs as often as they

like because the process is too cumbersome or political. Justwriting a specification can often take six months. However,

“showing them a product” can create double jeopardy. What

they may not have been able to specify adequately before will

now be much clearer in their minds. The clock starts ticking then

toward the ultimate release of that product whether it comes

from you or them. Unfortunately, if you don’t have adequate

resources to produce the product or warranty as required, you

will be on the outsideagain. This is not being ripped off. It’s called

learning free enterprise the hard way.

Except for being wary when you find yourself using words

like “steal” or “protect,” you should not avoid taking risk and

investing design time for reputable customers. First of all, whileyou may have graduated well up in your class, there are always

smarter people. Count on the fact that a bunch of them work for 

the customer. Anything you design, they can do too. Your best

move is openness. The engineers evaluating your design are

employees, not owners. Holding back information only makes

their job harder. The more information you provide and docu-

ment, in fact, the harder it will be for them to substantiate claims

of an independent design arriving at the same conclusion.

Finally, unless you have the manufacturing resources to

meet the cost, delivery, and warranty requirements of the com-

pan don’t e en tr Don’t gi e them a protot pe that triggers