72
7/16/2019 Circuit.cellar.011.Oct Nov.1989 http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 1/72

Circuit.cellar.011.Oct Nov.1989

Embed Size (px)

Citation preview

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 1/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 2/72

Why 32Bits? EDITOR’s ’ N K

IRCUIT CELLAR INK is a practical sort of magazine. We’ve built a reputation for publishing working projects,hands-on tips, the type of articles other computer magazines just can’t seem to find space for. With all that established,why are we devoting an issue to topics surrounding the glamorous, high-priced world of 32-bit processors?

The first reason is simple curiosity. Our staff, like most of the engineers in the world, spends most of the time upto its collective elbows in &bit microprocessors and controllers. Without exception, however, they want to know what’shappening on the leading edge of processor technology. It’s hard to guess what the next project might require, and evenharder to know which techniques will migrate down from the rarified atmosphere of 32-bit buses and huge caches, sot’s best to learn what’s possible now.

In this issue we look at three different 32-bit processor families. Two of them use 16-bit buses, but the lessons learnedare valuable nonetheless. The 80386SX project that begins here is designed to show you how to build a complete AT-

compatible motherboard or an 80386SX single-board controller. The BCCH16 uses the Hitachi HD641016 in the familiarBCC Bus. If you’re a controller fan, don’t miss Tom Cantrell’s look at the Intel 80960, surely the ne plus ultra ofmicrocontrollers available today. All in all, it’s an issue that we’re proud of. Even if you don’t plan to use a 32-bitprocessor in your next data acquisition design, I think you’ll find it interesting and useful.

ENGINEERING OF THE BEST SORT

A couple of issues back, there was a letter to the editor asking whether engineers (and by extension, magazineswritten for engineers) should be concerned about possible uses for the devices they design. This is a tangled and veryserious philosophical question that I’ll continue to skirt here, but I wanted to tell you about one engineer who does care.

 Joe Sobieski is a retired engineer living in Pennsylvania. He decided, for a number of personal reasons, that theworld needed his talents even though his company could get along without him. Joe turned his mind to the problemsof the physically impaired, and he has developed a system that allows even quadraplegics to have an amazing degree

of control over their career, their social life, and their environment. His designs aren’t gold-plated (I think they illustratethe concept of appropriate technology at its finest) but they do their jobs in a simple, cost-effective, elegant fashion. Hedoesn’t charge for his time or labor, preferring the less tangible rewards that come from simply helping a fellow humanbeing. I’m proud to have him as a C IRCUIT CELLAR INK reader.

 Joe would like to share what he’s learned with others who want to help. If you are interested, send a large self-addressed envelope to me here at CIRCUIT CELLAR INK, and I’ll see that you get a package of information. I’ll also see thatJoe Sobieski gets your name and address so that a correspondence may begin. There may be an article in the future, butuntil then this will get the ball rolling.

COMING SOON TO A MAILBOX NEAR YOU

We are always looking for new ways to present quality technical information to our readers. The newest idea, forour subscribers only, is the CIRCUT CELLAR INK TECH DECK. Now, I know that you’re familiar with most postcard decks,

but we’ve added something different to this one. At least 20% of every deck will be C IRCUIT CELLAR INK TECH TIPS, cardsthat contain processor and peripheral chip descriptions, utility circuits, and technical shortcuts. The first deck shouldbe mailed in mid-October. When you’ve had a chance to read the TEM TIPS, drop me a line and let me know what youthink.

FUTURE PLANS

We have developed our editorial calendar for 1990. It includes the themes for six regular issues plus two specialissues that we are planning. If you are interested in writing an article for one of our theme or special issues, call or writeto request the Editorial Calendar and Author’s Guide.

Curtis Franklin, Jr.Edifor-in-Chief

October /November 1989  1

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 3/72

FOUNDER/EDITORIAL DIRECTORSteve Ciarcia

PUBLISHERDaniel Rodrigues 

EDITOR-in-CHIEFCurtisFranklin, Jr.

ASSOCIATEPUBLISHERJohn Haye s 

ENGINEERING STAFFKen Da vid son Jeff Bachiochi Edward Nisle y 

CONTRIBUTINGEDITORSThom a s Ca ntrell Jac k Ga nssle 

CONSULTINGEDITORSMa rk Dahmke Larry Loeb

CIRCULATIONCOORDINATORRose Manse l l a

CIRCULATIONCONSULTANTGregory Spi tz faden

ART& PRODUCTIONDIRECTORTric ia  Dzied zinski

PRODUCTIONARTIST/ILLUSTRATORLisa Ferry 

BUSINESSMANAGERJea nnet te Wa lters 

STAFF RESEARCHERS

NortheastEric Alber t William Cur/e wRichard Sawyer 

Robert StekMidwest

Jon E/son Tim McDon o u g h

West CoastFrank Kuechmann Mark Voorhees 

Cover Illustrationby Robert Tinney

AR I N K8

I 15INKnet

Part 2-Writing Softwa re for Distrib ute d C o ntro l 

by Ed Nisley

Programming a network meanschoosing between many “right”answers, Ed Nisley shows how hechose to take advantage of thefeatures provided byspecific hard-ware.

The BCCH 16Part 1 -A 16- /32-b i t Mult i tasking Single-Board 

C omp u t e r  by Tom Cantrell

Sometimes your favorite old microcontroller justdoesn’t have the horsepowerto get the job done. In

those situations, a powerful 16/32-bit controller likethe BACH 16 can make the difference between frus-tration and exultation. Contributing editor TomCantrell covers the hardware in the first of two parts.

Editor’s INK Why 32 bits? 1

b y Curtis Frunkl in, Jr.

Reader’s INK-Letiers to the Ed itor  5 

NEW Product News 8

Visible INK-Leffersto the INK Research Sta ff  12

Firmware FurnaceCache Crazinessb y Ed Nis ley

From the BenchGentlemen, Start Your Enginesby Jef f Bac hioc hi 

55

62

2  CIRCUIT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 4/72

 THE COMPUTER APPLICATIONS J OURNAL

q386SX- based

22 PC/AT-Compatible Motherboard-Part 1

by Daryl Rinaldi

Looking deep insidean 80386SX-ba sedISA bus computeranswers many ques-tions about perform-ance,modifications.and applications. In

this first of two parts,we look at the princi-pal componentsthatgo into the neweststandard in personalcomputing.

A::.

Advertiser’s index

Intel’s Dark Horse-The 80960A Pow erful New Con trol ler for Performa nc e-Cr it ic a l Ap p lic a t ion s by Tom Ca r -he l l

nAlgorithms for Trigonometric Functionsb y Jack  Ganss le

onn ec Tjm e -Exc e r p t s f rom the C irc uit Ce lla r BBS Conduc t ed  by Ken Dav idson 

 Those Dazzling 32-Bit Chipsby Steve Ciarc ia 

65

68

73

75

80

Circuit Cellar BBS-24Hrs. 300/  1200/2400 bps,8bits. no parity, 1 stop bit,(203) 87 l- 1988.

 The schematics pro-vided in Circuit Cellar INK are drawn using Schemafrom Omation Inc. All pro-grams and schematics inCircuit Cellar INK havebeen carefully reviewedto ensure that their per-formance is in accor-dance with the specifica-tions described, and pro-grams are posted on theCircuit Cellar BBS for elec-tronic transfer by subscrib-ers.

Circuit Cellar INK makes no warranties andassumes no responsibilityor liability of any kind forerrors in these programs orschematics or for the con-sequences of any such

errors. Furthermore, be-cause of the possible vari-ation in the quality andcondition of materials andworkmanship of reader-assembled projects, Cir-cuit Cellar INK disclaimsany responsiblity for thesafe and proper functionof reader-assembled proj-ects based upon or fromplans, descriptions, or in-formation published inCircuit Cellar INK.

CIRCUIT CELLAR INK 

(ISSN 0896-8985) Is pub-lished bimonthly by CircuitCellar Incorporated.4ParkStreet.Suite X).Vernon. CT06066 (203) 875-275 1.Second-class postagepaid at Vernon, CT andadditional offices. One-year (6 issues) subscriptionrate U.S.A. and possessionsSi4.95.C anada  $17,95,allother countries $26.95. Allsubscription orders pay-able in U.S. funds only, viainternational postal

money order or checkdrawn on U.S. bank. Di-rect subscription orders toC ircuitCe llar  INK,Subscrip-tions, P.O. Box 2099, Ma -hopac. NY 10541 or call(203) 875-2 199.

-POSTMASTER: Pleasesend address changes toCircuit Cellar INK. Circula-tion Dept., P.O. Box 2099,Mahopac, NY 10541.

Entire contents copy-right 1989 by Circuit CellarIncorporated. All rightsre-served. Reproduction of 

this publication in wholeor in part without writtenconsent from Circuit Cel-lar Inc. is prohibited.

October /November 1989  3

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 5/72

Ctfl

READER’S ’ N K Let t ers to t he Edi t or 

COULD IT BE THEIR BREATH? ON WORKING SMARTER

Great Magazine ! I first got into hardware learningForth on the Apple II (“Wow, I can influence the externalworld.“), but it was sitting and examining the SB180schematics closely with a TTL data book next to me that

taught me address decoding, bus architecture, and systembuilding. I was delighted to learn of CIRCUIT CELLAR INKand enjoy the fact that you don’t aim at end users.

I’d like to see a basic article on assembling. It was aneffort for me to learn how to construct projects, evolvingfrom point-to-point wiring through wire wrap and etch-ing. I sense that a piece on the practicalities of putting aschematic onto a board would be valuable to many read-ers.

I’m curious about why you avoid the 6xxx series ofchips. I learned on the very quick, very easy 6502 and lovemy 6809. I use a 6809 system for hardware design withmultitasking OS-9. I’m aware that the 280 is frequentlyused as a controller but Motorola’s 680x family is a goodseries of processors. The evolution up to a 68008 is nicesince it’s still an 8-bit bus processor with no segments anda large address space. In addition, OS-9 and OS-9/68000are often compatible at C source code level.

Anyway, keep it up and keep it practical. I don’t careabout the new VAX 9200-to-Unisys Mainframe interface,but I do care about SCSI, HPIB, homebrew LANs, 6418Os,and controller applications. You’re doing well so far.

Chuck YerkesBrooklyn, NY

Thanks for the letter of commendation and recommenda-tion. We are dedicated to being a  practical, hands-on source of information for all those who sfill roll up their sleeves to buildcomputer and controller applications.

The most distressing part was the programming ex-ample in C for the so-called “parallel” solution. It seems aretrofit from his PLD equations; why else avoid use of the“(XOR) operator? Worse, the algorithm is not parallel; itstill works on one bit at a time. As the BYTE article shows,there is a far better parallel algorithm; in the case of CRC-CCITT, an 8086 code fragment is shown here:

Thereisn’t a conscious bias against any series of controllers MOV AX,crc ; get current CRCorprocessors here. Thesimplefacf is that theengineers here have XOR AH,data ; bring in data

more experience with Intel controllers and processors than with MOV BH,OFOh

those from any other vendor. We have taken great pains to AND BH,AH ; partial result

include projects using the 68000 and 6502, and a 68HCZI MOV BL,AH ; partial resultproject is in the planning stage. ROL AX,1

In CIRCUIT CELLAR INK #9 , I have two bones to pick:

The first, with “An Intelligent SCSI Data AcquisitionSystem.. .” by John Eng, deals with the SCSI terminationscheme shown in Figure 6. When the “termination enable

 jumpers” are removed, the termination resistors will in-duce serious cross-coupling between all SCSI bus signals!This is just the type of problem termination is supposed toavoid.

Termination of a variable-length bus, whether SCSI,Unibus, or any other, is best served by termination plugs.Real SCSI supports this with +5V supplied at one end ofthe bus specifically for this purpose.

“Cheating” on standards, whether by using physi-cally different connectors or by playing fast and loose withelectrical and timing specs, is a recipe for erratic andunreliableoperation. If you know exactly what isgoingonin all subsystems you can usually get away with it; other-wise it’s long nights and great aggravation.

The other cavil is with “Computing CRCs in Parallel”by Jack Ganssle. It reminded me of the old saying “Whenyour only tool is a hammer, all problems resemble a nail.”

The first part of the article reminded me of a similararticle, “Calculating CRCs by Bits and Bytes” in the Sep-tember 1986 issue of BYTE, which was far clearer in boththe mathematics and the circuit descriptions for the serialalgorithm.

October /November 1989  5 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 6/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 7/72

/V~l#PRODUCTNEWSNElIt/PRODUCTtiEWS

A new chip from DallasSemiconductor combines areal-time clock, alarm,watchdog timer, and intervaltimer in a standard 28-pin

 package that can be pluggedinto an existing memorysocket. The DSl286 Watch-dog Timekeeper contains aninternal lithium battery andquartz crystal to eliminate the

need for external circuitry. Inthe absence of system power,data is retained for more thanten years.

Calendar informationcan be read or written in thesame manner as bytewidestatic RAM. Specific memorylocations are designated asday, month, year, etc., andare automatically updated tothe current time. Timeintervals from hundredths of a second to years are trackedwith its leap-year-compen-sated 400-year calendar.

The chip has three programmable timingfunctions in addition to thecalendar. The first is awatchdog timer that guards

against computer malfunc-tion by restarting themicroprocessor if thecomputer does not check in atuser-specified time intervals.The second and third arecalendar and interval timersset in conjunction with analarm.

A unique double- buffering scheme allows theuser to access accuratecalendar data instantane-ously. Two copies of the dataare maintained so that theuser can read one copy whilethe other is being updated.In addition, 50 bytes of nonvolatile RAM are

 provided for extra storage.Intelligent control circuitrywrite-protects this memorywhen power goes out of tolerance.

The DS1286 WatchdogTimer costs $13.75 in 100- piece quantities.

Dallas Semiconductor4350 Beltwood ParkwayDallas, TX 75244(2 14) 450-0400

New 8096 Full-Function Simulator

A PC-based full-function simulator for the 8096 family of microcontrollers has been announced by Lear Corn Company.The new simulator allows the PC to be used as a powerfuldevelopment system to run and debug 8096 programs withcomplete function and interrupt support including A/Dconversion simulation and full implementation of the HSIHSO, and serial communications features of the 8096 family.

The simulator is fully interactive and permits the user tomodify variables and instructions at will through the key-

 board. Breakpoints are provided so that programs can be runone instruction at a time, or between selected addresses.

The 80% simulator  (SIM96) is being offered at an intro-ductory price of $300.00. The 8096 cross-assembler is availablefor $100.00, and the simulator plus assembler package will sellfor $350.00.

Lear Corn Company2440 Kipling Street, Suite 206

Lakewood, CO 80215(303) 232-2226

CAE/CAD Softwarefor the Macintosh

Caplurc

Digital Simulation

.::

,-:

Layout & Routing

High-performanceelectronic design software for the Macintosh is availablefrom VAMP Inc. McCADoffers an integrated family of software modules to cover the complete design cyclefrom schematic entry to

 printed circuit board designto fabrication.

need for an actual bread- board. Circuits can beexcited and their behavior recorded. Extraction of SPICE data from the Sche-matics module allows directanalog analysis with manycommercially availablesimulators.

The Schematic Capturemodule, Schematics ($495),allows the designer to easilycreate and revise analog anddigital circuit designs directlyon the Macintosh. Featuresinclude on-line schematiccapture, net list, SPICE netlist, and parts list extraction,standard libraries, device andtext rotation, file import andexport via clipboard, anduser-definable symbols andlibraries. Two PCB layout

 packages are available. The

PCB-1 ($395) is an affordable,easy-to-use system for creating, editing, and revisingcircuit board artwork. It doesnot directly integrate with theother McCAD packages.PCB-ST ($995), is a high-endcircuit board layout packagewhich integrates withSchematics and includesautorouting capability.

Schematics-DS ($895)integrates a digital simulator into the Schematics package.This gives the user the ability

to test his captured design for functionality without the

The McCAD GerberTranslator ($175) is a utilitywhich converts any of its PCBdatabases into standardGerber format for photoplot-ting. It is available as astand-alone program or as

 part of the EDS-1 package.The EDS-1($1495) is a

 bundled package consistingof the Schematic Capture,Printed Circuit Layout,Routing, and Gerber Transla-tor. It is recommended for the Mac II, but can be utilizedon a Mac Plus or Mac SE with

a memory upgrade and ahard disk. The minimumconfiguration for any of themodules is a Mac Plus, with 2megabytes of memorystrongly recommended. AllMcCAD software is config-ured for use with the newROMs.

Evaluation diskettes areavailable for most of themodules.

VAMP, Inc.6753 Selma Avenue

Los Angeles, CA 90028(213) 466-5533

a CIRCUIJ  CEIUR  INK

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 8/72

NEWPRODUCTNEWSNEWPRODUCTNEWS

Fuzzy SetComparator ChipSimplifies Pattern

Recognition

An artificial intelligenceIC from Micro Devices Inc.has applications in embeddedcontrollers as well as power-ful, high-speed multiproces-sor systems. The MD1210Fuzzy Set Comparator isdesigned for real-time patternrecognition applications suchas objects, characters, voices,etc. The MD1210 is trainable

and can be taught to recog-nize patterns without the useof built-in algorithms or other preprogramming. It incorpo-rates a digital neural network for processing fuzzy data(inaccurate, noisy, variable)to do pattern recognition.

A single MD1210 cansimultaneously compareeight unknown data streamsto one known data stream, or eight knowns to one un-

known. Up to 32 units can beused together on an expan-sion bus to provide simulta-neous comparison of 256patterns against a singleinput. It can work in realtime or from data stored inRAM or disk.

An Evaluation Kit isavailable to demonstrate thefeatures and operating modesof the chip. An MD1210 iscontained on the EvaluationKit circuit board which iscompatible with the IBM PCor compatible. A NTSC

video interface, extensivesoftware, user’s manual anddata sheets are also provided.The Evaluation Kit withmemory costs $250; withoutmemory $200.

Micro Devices, Inc.

Special Products Division of 

Chip Supply56958 Beggs Road

Orlando, FL 3281 O-2603

(407) 299-0211

Device Provides Automatic Data BackupWith Power Failure

The Boomerang, from Microsync Inc., is a unique systemsaver that automatically saves system data to hard disk when

 power is interrupted. Boomerang constantly monitors com- puter power, and when a brownout or outage is detected,supplies battery power to the computer while it saves the stateof the entire system to hard disk. It then shuts down thecomputer and parks the hard disk heads. When normal power returns, a simple command restores the computer to its

 previous state with no loss of data.

Boomerang mounts inside any IBM PC or compatible and plugs between the power supply and motherboard. It doesnot require an expansion slot and supports VGA, Windows/286, and most 386 systems operating with DOS 2.1 or later.Other hardware requirements include 256K of RAM (uses only18K to run), an internal hard disk drive, and any videomonitor. Its internal battery recharges from the computer 

 power supply in normal operation.Boomerang allows you to turn off power while in an

application, and reboot to the same place. This saves reloadingthe software and repositioning the cursor. Protection for accidently shutting down the computer without savingcontents of a RAM disk is also provided.

Boomerang has a 30-day, money back guarantee and aone-year limited warranty. The suggested retail price is$299.00. AT systems with a hard disk capacity greater than 40

megabytes require an additional battery kit priced at $47.95.

Arrick/Microsync, Inc.

2107 W. Euless Blvd.Euless, TX 76040(800) 543-0161

C Compiler/lnte-grated Editor for6805 EmbeddedSystems

The C6805 Code Devel-opment System from ByteCraft Limited is a fully inte-grated cross-developmenttool for the IBM PC andcompatibles. It features a Ccompiler with a built-inmacro assembler andintegrated editor to enabledesigners of embeddedsystems to use the C lan-guage for development on

6805/6305 single-chipmicroprocessors. TheIntegrated DevelopmentEnvironment accesses in-circuit emulators, PROM programmers, debuggers,and simulators with a fewkeystrokes to providecomplete integration for anentire toolbox.

The C6805 compiles atgreater than 6000 lines/minute on an ~-MHZ IBM

PC/AT or I’S/2 Model 50and produces fast, tight codewith an artificially intelligentoptimizer. The object code isgenerated in either Sl or Intelhex formats. The C6805

checks the source codeagainst the target hardwaredefinition, giving on-lineerror information. ExtensiveC language support for interrupt routines is also pro-vided, and development timeis further reduced by directlygenerating ROMable code.

Minimum hardwarerequirements are an IBM PCor compatible with onefloppy drive and 512K of RAM. The price for theC6805 Code DevelopmentSystem is $795.00, and ademo diskette is available.

Byte Craft Limited

421 King Street NorthWaterloo, Ontario N2J  4E4

(519) 888-6911

October/November 1989 9

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 9/72

NEWPRODUCTNEWS WPRODUCTNEWS

New Hardware for Se‘curity Applications

Two new products fromPULNiX America Inc. offer many possibilities for 

surveillance and motiondetection. The Excel is anattractive, dual-elementsensor, passive infrared (PIR)

motion detector with modelsthat feature three lens

 patterns: wide angle (40’ x40’), long range (100’ x 20’),and curtain (40’ x lo’). Thesensitivity of the unit isautomatically adjustedrelative to the temperature of the environment. For 

example, if the room becomeswarmer, the sensitivityincreases; as the room cools,the sensitivity decreases.This eliminates the need for temperature compensationand provides optimal

 performance.

that it has activated an alarmduring its armed period. Analarm signal is sent if the

supply voltage drops belowthe g-volt minimum, and aremote LED allows the walk test light to be enabled or disabled remotely from acontrol panel. The dimen-sions of the unit are 3.7 incheshigh, 2.6 inches wide, and 1.6inches deep.

The unit features analarm memory to indicate

The TM440/460 is a low-cost full-feature CCD camerawith a 0.50-inch  high-resolution imager (422 H x

489 V NTSC, 422 H x 579 VCCIR). It features externalhorizontal, vertical, andcomposite sync capability,and 2:l interlace scanning. Ithas a sensitivity of 3 lux (f1.4)and provides a video signalfor auto iris capability. Theunit operates from 12 voltsDC or 24 volts AC (TM-

44OL/46OL) and weighs lessthan half a pound. A C- PULNiX America, Inc.mount with back focus lens 770-A Lucerne Drivemount and tripod mounting Sunnyvale, CA 94086

 provisions are provided. (408) 733- 1560Pricing was not available at

 press time.

live Video Merges with Computer Graphics

The SPECTRUM NTSC,from Redlake Corporation,merges standard basebandvideo with computer graphics on a multisyncmonitor. This is accom-

 plished by digitizing,deinterlacing, and speedingup the video signal to match

the scan rates of the computer video output. A proprietarysynchronization technique isused to digitize video with

 poor time base or sync properties, such as that froma VCR in pause mode.

The SPECTRUM NTSCuses an 8bit digitizer to

 produce 16.8 million colorsand provides much better video quality than a 5-bitsystem. VGA compatibility,

single-screen operation, andlive video in all modes areincluded, and the unit can be

CIRCUIT CELLAR INK

 programmed to operate withmost window shell programs.Other features includeresolution up to 800 x 600,fully preserved 4:3 aspectratio in any mode, hardware

 pan and zoom, and NTSCoutput of the digitized imageto a VCR or monitor.

System requirementsinclude an IBM PC/AT, or compatible, with 640K of RAM, an analog multisyncmonitor, and a VGA card. Aset of drivers and a demon-stration software package are

 provided with each board.The SPECTRUM NTSC is

 priced at $2495.

Redlake Corporation15005 Concord Circle

Morgan Hill, CA 95037(408) 779-6464

(800) 543-6563

;;

rAttention Manufacturers!

Circuit Cellar INK provides itsreaders with news about signifi-cant product developments inhardware, software, and devel-opment tools. If your companyhas a new product that our read-ers should know about, pleasesend your product announce-ments to:

Circuit Cellar INKNew Products Editor

4 Park St., Suite 20

Vernon, CT 06066

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 10/72

Ctrl

VISIBLE ’ N K Let t ers to t he INK Research Stafl

 Answers; Clear and Simple

AND NOW FOR SOMETHING COMPLETELY DIFFERENT...

We have a problem here which I have never seenmentioned anywhere-that of mildew attackingdiskettes.I imagine it is a common problem in tropical climates insituations where air conditioning is not heavily used. Wecannot use air conditioning all the time due to blackouts.

The mildew problem arises when diskettes are not

used for a number of months, and seems to favor backupdiskettesespecially! Two possibilities suggest themselves:either low-humidity storage using a mini-air conditioneror silica gel to discourage mildew growth; or using avolatile fungicidal agent in storage boxes to kill the mildewand spores. The latter seems the best but we have not beenable to locate any suitable fungicide which will not dam-age the diskettes. Any suggestions?

Incidentally, the mildew can be removed with alcoholbut this is very tedious and the surface of the diskette mayhave been permanently damaged by the mildew.

Andrew ManceyGolden Grove, Guyana

You have no idea what a discussion your letter kicked up!We have solved many technical  problems, but The Mildao That

 Ate The Diskette isn’t one of them. Around here the worst problem seems to be mice storing seeds in the hub hole of a stackof diskettes.

We think your  idea of usingsilicagel in a sealed box is muchbetter than tying to find a diskette-safe fungicide. The gel isreasonably inexpensive,easily  reconstituted,and  doesn’tgiveoffhorrible chemicalfumes. You should keep all of your diskettes ind y storage boxes to prevent the spores from taking hold.

You should clean your drives on a regular basis; thecrud onyour readlwriteheads must beasight to behold. Take thedrivesoutofyourPCandclean them withcottonandalcohol;becarefulnot to damage delicate mechanisms as you’re poking around.

offered at a variety of access speeds. How do 1 determinethe needed speed for memory to be used with, for example,an 8031 or 80C52-BASIC?

Also, in CIRCUT CELLAR INK #7 the article on the Image-

Wise/PCshowstheuseof74LSICswith82C54and 74ALSdevices. The article on the Home Satellite Weather Centeruse 74LS devices with a 74HC154. Why are the logicfamilies mixed? Can you give some guidelines on what

type of mixing might be reasonable and desirable?

Bill DornbushFarmington Hills, MI

The topic of matching memo y to processors can (and does) fillentirebooks. It turnsout  that,as withmanysimplequestions,there are no simple answers!

What you need to do is sit down with the manual for themicroprocessor you’re using, figure out the timing for all thecontrolsignalsanddatalines(takingintoaccountdecodinglogicand bus buffers), then examine the RAMS to find out when thedata will arriveafter the last control line becomes valid. That’show it’s got to be done, eve y time.

When it comes to logic families, you can think of them as fitting under a bell curve, with the high-speed, high-fan-outdevices at one end, the low-speed, low-fan-out devices at theother, and most of the families somewhere in the middle. Youusually won’t have trouble mixing devices from somewhere inthe middle in the same circuit, but be careful when tying to usedeuices from opposite ends at the same time. In general, thecircuit’s performance will only beas good as the lowest-perform-ance family used.  Mixing 74LS,74HCT, and similar parts asyou’ll sometimes find in C I R CU I T  C E L L AR  INK articles won’t

 present major problems. For the  final say, though, you shouldconsult the data books for whatever families you‘re using.

COMPUTING ON THE RUN

I am currently working on a mobile, autonomousCHIP SELECTION BLUES robot system. My background is primarily mechanical

engineering with a fair amount of motor application expe-Most of your construction articles include a micropro- rience, but I have limited experience with computers. I am

cessorormicrocontrollerandRAMand/orEPROM. When in the preliminary design stages and need assistance in

I look at the memory devices which are available, they are choosing the central computer to be mounted on the robot.

12 ClRCUlT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 11/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 12/72

INKnet Part 2

Writing So f tw u re fo r Dist rib ute d C o ntro l 

by Ed Nisley

N ow that you know

how to share network

bandwidth and keep

those nodes under con-

trol, I can explore mes-

sage structures, BASIC

language extensions,

and the MONITOR pro-

gram. While INKnet

serves as a sample im-

plementation, the prin-

ciples are applicable to

any network.MEET THE MESSAGES

All of the data sent between INK-net nodes travels in messages with thestructure shown in Figure 1. Whilenearly any arrangement for the byteswould suffice, every message on anetwork must have the same struc-ture so the firmware can locate thecontrol fields. fEditor’s  Note: Execu t-able INKnet software is available for downloadingfrom the Circuit Cellar BBSor on CIRCUIT CELLAR INK Software On

Header

Data

mst   be  zero

we-age   length,10 to 255  bytes

Target (“to”)

Opcoda (message

Source ("fmmu)

Fleservingnode

Status flags

I - -II II  +   I

1  + I Data bytes

1  +if needed

I

I II-  -1L-l

Figure l-Al/  NKnet messages have twosections:  u header containing routing infor- 

ma t ion and an op t iona l da ta sect ion.

Disk #Il. For downloading and orderinginformafion, see page 78.1

The first ten bytes of every INK-net message are the header and carrysimilar information regardless of therest of the data. The total number ofmessage bytes is contained in theLENGTH field.

The maximum message length is255 bytes, which is the largest possibleLENGTH  field value. There may beup to 245 data bytes after the header,so longer blocks of data must be bro-

ken up by the sending node.The OPCODE field identifies themessage contents so the recipientknows what to do with it. Figure 2 isthe list of current INKnet opcodes, butothersmaybeaddedastheneedarises.Your application programs may useany opcode values from 00 through 7Fhex for whatever purposes you canimagine. Opcodes between 80 and FFhex are reserved for INKnet firmwareand software; messages with these

opcodes will not be passed on to yourapplication and may interfere withnetwork operations if you use them.

The SOURCE and TARGETNODEfields indicate which node sent themessage and which node should re-ceive it. Because every node “hears”allnetworktraffic,anynodecaneaves-drop on messages to any other node.The INKnet firmware, however, dis-cards messages not addressed to yourapplication’s node.

The RESERVING NODE fieldindicates whether the sourcenode (theone that sent the message) is reservedfor the exclusive use of another node.Nodes ordinarily accept messagesfrom any other node as long as thetarget field matches their networkaddress. Reserving a node simplymeans that the reserved node willrespond only to messages from thereserving node.

Figure 3 defines the STATUS fieldbits, which report the network firm-ware status to other nodes. The mostimportant bit is BUSY, which indi-

Octobe r/ Novemb er 1989  15

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 13/72

Hex Opcode Function

80 POLL Poll from master to node

81 STATUS Status response from node to master

82 UNBUSY Force node "unbusy" regardless of actual

status (use with caution!)

88 RFSERVE Reserve node for exclusive use of "from"

node (except for polls & responses)

89 RELEASE Release node for general use (may be

sent by any node)

90 CONSOUT Console output (to display)

91 CONSIN Console input (from keyboard)

92 CONSECHO Echo of console input message

93 CONSFILE Console input (from file)

Figure 2- lhe Opcode In each message identi f ies the message function and determines i f there is any da ta ollowing the heade r. Network programs should use o pc odes between 

Co and 7F for internode m essag es. Opcodes be tween  80 an d FF are used for netwo rk ma nagem ent; user programs wi l l not rece ive these m essag es.

cates whether the node can accept anew message. Because the RTC52

nodes have limited memory, they canhandle only one incoming message ata time. If a message arrives while thenode is busy, the firmware will dis-card the first message and set theOVERRUN status bit.

The CHECKSUM  field is com-puted from all of the rest of the bytesin the message by treating pairs ofbytes as one 16-bit number and add-ing them together. If the message hasan odd number of bytes, the last byte

is padded with a low-order zero bytebefore theaddition. Theresultingsumis truncated to 16 bits, complemented,and inserted into the message. If youare implementing this algorithm,remember to zero the checksum fieldbefore you add up all the bytes in themessage!

The firmware eavesdrops on allnetwork messages and sets theCHECKSUM status bit if any messagehas an invalid checksum. Damaged

messages are discarded; because anybyte may be incorrect, there is no wayto determine which node should havereceived the message and no way to“patch up” the results. While we couldhave used an error-correction code,8051 processors can be swamped veryeasily.. .and running network firm-ware is not the processor’s most im-portant job.

Figure 4 shows the bytes in a se-ries of INKnet messages. Notice thatthe master node sends a poll to itselfduring each polling cycle, then re-sponds with an ordinary status mes-sage. This simplifies the node firm-ware by treating the master node as“just one of the gang” for all messagesother than the polls themselves.

TIMING IS EVERYTHING

Although all INKnet data travelsin messages, some information isconveyed by message timing. TheINKnet master node imposes restric-

Bit Name Function

15 BUSY  Node is busy handling previous message14 OVERRUN  At least one previous message was lost13 ECHO  Node will echo all CONSIN messages12 LFSTRIP  Node strips LF after CR on CONSIN msgs11 CSUM  Node detected a checksum error10 reserved 9 reserved 8  MASTER Node is network master

Flag bits 0 through I are reserved.

Figure &The Status Flag s field indic ate s the no de state . Eac h nod e m onitors the flag s 

from all other node s to upd ate its ow n tab les.

tions on the net to ensure orderly traf-fic flow. As with all designs, the tim-ing specs are a compromise amongconflicting requirements.

Net messages must be separatedby a minimum of 5 milliseconds togive an 8052 node ample time to moveall 255 bytes of a message from one

spot inmemory to another  while doingsome “in-flight” data analysis. If yournet design uses slower processors, youmay need to increase this delay time.

A node must start its responsewithin 15 ms of the end of a poll. If themaster node doesn’t detect a responsewithin that time, it concludes that thenode is missing or dead and continueswith the polling cycle. Longer delaysallow the nodes to run with interruptsdisabled during critical code sections,

but would slow largenetworksdown.The JNKnet MONITOR program

polls the nodes in ascending orderstarting with Node 0 and stopping ata specified maximum node. You canimprove the performance of yournetwork by assigning node addressescontiguously between zero and thehighest node number. The net mastercould simply stop polling nodes thatdo not respond, but then there mustbe another timeout to allow new nodes

to join the network conversation.The polling scheme can be as

clever as your programming skillsallow, but we think simpler algorithmsare more robust, easier to debug, andcertainly more practical to implementon smaller processors with limitedRAM and processing power.

Because all of the nodes are con-nected in parallel, any node that trans-mits out of turn can disrupt communi-cation on the whole network. TheRTC boards have an LED on the trans-mitter-enable signal, so you can deter-mine if a board is “stuck on” by simplylooking at the LED. This problem iscommon to all parallel bus networks;finding Ethernet coax cable shorts isan Olympic sport in LAN installationsworldwide!

Nodes may use any timingmethod to meet the specifications, butthe easiest is to measure delays againsta free-running internal clock tickingevery 5 ms. Because the end of an in-coming message will not normally

16 ClRCUlT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 14/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 15/72

Poll Stat Poll  Message Poll

 No maximumtime Minimum 5 ms  before next poll!

. . _,_,,,. -blgure  5--INKnt?f message r im ing  equi rements . me  noUes m ay use any t im ing me t / wa s long a s the result meets spe c ifica tions! 

node’s control algorithm. The realproblem occurs with MONITOR,because the AT’s clock normally inter-rupts once every 54.9 ms: we had topump that up by a factor of ll! Youcan try faster clocks on your networkto find the best tradeoff between traf-fic and computations.

switching between nodes is a matterof a few keystrokes.

Figure 5 summarizes the INKnet

timing requirements. It is worthmentioning that there is no maximumtime limit between the end of a mes-sage and the next poll; this simplifiesdebugging by single-stepping pollmessages.

The 8052 firmware gets controlduring the BASIC-52’s power-on re-set sequence. It checks the memorysize (which must be either 8K or 32Kbytes) and reserves space for the net-work buffers at the high end of RAM.The value of MTOP (Memory TOP)

used by the interpreter marks the lastbyte below these buffers, so BASICwon’t try to write over the buffers.

TERMINAL CONNECTIONS

The BASIC-52 interpreter is a(moderately) high-level language in asingle-chipcontroller. Theinterpreter

communicates with theoutside worldthrough the 8052’s on-chip serial port.Whatever else the network does hadbetter allow this to continue!

A simple ASCII terminal won’twork, however, because the networkhardware uses an RS-485 transceiverand network messages aren’t legiblewhen translated into ASCIIcharacters. The solution is achunk of 8052 firmware toconvince the BASIC inter-preter that it is still connectedto a serial terminal, while re-ally shuffling charactersamong net messages.

A peculiarity of theBASIC-52codesurfaced while I was writing the firm-ware: The Death of Ten ThousandNibbles. The interpreter checks in-coming bytes for special control char-acters such as Ctrl-S, Ctrl-Q, and Ctrl-C, but discards each character afterthe test. This is reasonable on a serialterminal because the characters come

directly from the keyboard, but theeffect is to drain the network’s ringbuffer before the BASIC program canexamine the characters! I’m lookingfor a way to allow type-ahead whilenot eliminating the control characters,but everything so far looks like a forcefit.

The console I/O functions handlecommunication with the display andkeyboard, but the nodes must com-municate with each other, too. Mostlanguages have a fixed set of key-words that represent everything the

language can do for you, but gener-ally that doesn’t include networking!That is true of BASIC-52, but, unlikemost other languages, it has a cleanway to add new keywords for specialapplications. The firmware adds aNET statement to give a simple inter-face between your BASIC code andthe network routines.

Figure 6 lists the new BASIC state-ments created using the NET keywordand their arguments and return val-

ues. These are functional in both di-rect and program mode, so you cantry something out by typing it at theprompt, then incorporate the result inyour program with no changes. Thecurrent firmware does not allow anyBASIC statements other than REM onthe same line as a NET statement.

TheNET   OUTPUTstatementsendsa message to another node. Your pro-gram must build the message in aRAM buffer, then execute a NETOUTPUT with the buffer address. Thefirmware copies the message into atransmit buffer, fills out the header,and sends the message when it re-ceives the next poll from the masternode. Your program will regain con-trol immediately after the message iscopied to the firmwarebuffer; the firm-

ware uses interrupts to sendthe message.

On the other end of thenetwork, MONITOR collectskeystrokes into console inputmessages and displays thecontents of console outputmessages on the screen. Be-cause the AT has lots of RAM,

MONITOR can maintainconsole output histories forall the BASIC network nodes;

Photo 1 - MONITOR c an sim ulate up to 3 I serial terminals, each with a sc reen sim ilar to this. Eac h node produc es outpu t on a separate screen.

18 ClRCUlT CELLAR INK

EXTENDING BASIC

Similarly, NET INPUTspecifiesan addressat whichthe firmware will copy a newmessage from the receivebuffer. Your program canthen analyze the messageopcode and decide how tohandle it. The firmware re-turns only messages ad-dressed to your node ad-dress, so NET INPUT cannotbe used to eavesdrop onmessages for other nodes.

Both NET INPUT

a n d NET OUTPUT return StatUS

information on the BASIC-

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 16/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 17/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 18/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 19/72

PRODUCT REV IEWS:  The Next GenerationC irc uit C e lla r NK se / / s o ut a nd enjo ys ii! 

It’s not often that one is witness to a major event in humanhistory, but if you’re reading this, you’re not only a wit-ness, but an eyewitness! Yes, you see before you an oc-

currence of epoch-changing proportions. Mere humaninventions pale in significance before this. Polio vaccines,atomic energy production, and those little plastic thingsthat slowly slither down your walls all fade away whencompared to what you hold before you.

What am I talking about? Why the Circuit Cellar INKBenchmarking, Product Evaluation, and Junk-Food Con-sumption Testing Facility.

Now, I know we said that you wouldn’t see any “me-too” reviews or evaluations in Circuit Cellar INK, but hey,times change. First, we saw what was being passed off asproduct reviews by other magazines and realized that nopublication in this end of the universe wasbetter qualifiedto write technical, hard-hitting reviews than were we.Second, we were getting miffed that companies weren’tsending neat toys (free of charge) to our offices. Third, itseemed like a good way to get paid for breaking stuff.

No Dweebs Here

At Circuit Cellar INK, when we decide to do some-thing, we don’t go in for half-measures. Before we openedthe CCINK BPE&JFCTF, we performed an exhaustivestudy of what “the other guys” were doing. What did wefind? Wimpy software benchmarks and effete instrumen-tation, that’s what! Where were the calisthenics for indi-vidual instructions, the particle accelerators, the blast cra-ters? They were not to be found, at least not until now.

We have assembled the only testing facility of its typein the free world. On the hardware side, we put together

a state-of-the-art laboratory filled with expensive gadgets,heavy industrial machinery, and scary electronicstuff. Forwringing out the software, we contracted with a little-known hacker/genius to write assembly code that’s socompactly written, so immune to optimization, and. sothorough in its exercising of undocumented features, thatwe’re not sure what the hell it really does. Finally, andmost importantly, we’ve assembled the strangest group ofgonzo testing weenies ever to don lab coats. These guyslive to trash computers, and subsist on Chinese take-out,Cheeetos, and Jolt soda. Is our crew qualified, or what?

Let the Games Begin

Aswe began look-ing through the litera-ture on evaluating sys-tems, we worked ourway through the Whet-stones, Dhrystones,Savages, LivermoreLoops, and many more.We found that none ofthem really told volumepurchase influencerswhat they needed toknow about the systemat hand. We thoughtabout presenting all ofthe tests in an easy-to-read chart format sothat readerscould form

their own opinionsbased on the informa-tion presented. Then we came to our senses and realizedthat what readers really want is to be led by the nose,bludgeoned by a single sledgehammer factoid that they /

can point to in selfdefense when things fall apart. If it’sa flattering number that companies can use in advertisingto justify their high prices, all the better.

With all of the above in mind, we formed our “MagicNumber Search Committee.” We knew that the mostimportant piece of the puzzle was the name. After hoursof research, pages of dictionary work, and several intenserounds of Balderdash, we found The Word. Henceforth,

when systems of any type are compared, they will be_ _ Icompared in our devastatingly elegant unit of measure, I

the Mopoke. The range of Mopoke is from -53 to 177, I

using a logarithmic scale. Using the logarithmic scalemakes for snappier graphics and often makes manymediocre products look far better than they truly are.

Inside the Mopoke

Where most benchmarking programs content them-selves with simple performance measurements, you must

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 20/72

understand that the Mopoke is a unit for measuring far more than mere performance. In deciding to use theMopoke, with all its subtle complexities, we acknowledgethat most users are interested in more than how fast theprocessor can idle, or how many bits can be blasted to thedisk per second. No, most users really want, and CircuitCellar INK alone is now able to offer, an objective evalu-ation of the true gestalt of the system.

We start, of course, with performance. The first stageof Mopoke evaluation is to individually exercise everysingle instruction possibleina given system. Each instruc-tion is performed, with no setup, overhead, environment,or operator intervention, for one million iterations. The

time for each individualiteration (timed andrecorded by a specialnearly nonintervention-ist external CCINK BPE&JFCTF clock that

is linked by special opti-cal links to the AtomicClock at the NationalBureau of Standards) islogged, and the resultsare averaged using ageometric mean. Next, polar Fourier transformsare performed on thetotaldatasetat5degree

intervals. These results,

along with the geomet-ric mean from the firstevaluation,becomefod-

der for the Mopoke can-non.

 Next, we fearlesslydive into the human factors morass. Our dedicated staff painstakingly measures keyboard feel (key travel, key capsize, depth at roll-over, angle of attack, height of the littlebumps on the home keys), display ergonomics (dot size,dot pitch, glare, aspect ratio, jitter, swim, bugaloo, accessi-bility of controls, versatility of inputs, and how hard it is tosneak the thing home touse  withyourVCR),and  mainunitconstruction (footprint, depth, height, hat size, presence of nifty LED displays, decibel level of the fan, pitch of the fan,aesthetic considerations). We then go where no review hasgone before and quantify what can only be called “EgoAppeal Factor” (EAF). The EAF takes into account impor-tant issues such as: Will this system make your bossealous? Does the color of the system complement your 

power ties? Do the noises of start-up guarantee thateveryone in the office knows when you fire that sucker up?We run the results from all of these scientific tests through

a weighted averaging system, where weights are deter-mined using a complex system based on the researcher’sbiorhythm, the hourly exchange rate between the U.S.dollar and the Greek drachma, and the Solunar Tablepublished in Field and Stream.

We don’t overlook reliability in the Mopoke, either.We are the only publication that runs each and every testunit through both a steel annealing oven and a cryogeniclife-extensionchamber to check for continued operation attemperature extremes. We also operate each system in

 booth #7 at the “Tans for the Memories” tanning salon andat the bottom of a washtub filled with Evian water to testfor susceptibility to damage from humidity extremes. Our line-noise isolation test includes operating the system onthe same line as a heliarc welder, and injecting a signaltaken from side B of Def Leppard’s most recent single intothe test AC line.

As thorough as are these tests, we recognized thatmost failures involve hard disks. To stress-check harddisks of portable computers, we bolt the little monsters tothe main oscillating mixer down at “Merle’s Paint’N’Plas-ter World.” Desktop units are subjected to a patent-

 pending procedure we like to call the “Extreme PrejudiceTest.” Suffice it to say that this rigorous examination of 

Winchester technology involves expensive disk drives,high-velocity ammunition, and a very low “Pass” ratio.

 Now, most magazines would stop right there, butwe’re committed to press on. We know that most users arefar more afraid of their system’s manufacturer failing thanof the system itself failing. So, in an action unprecedentedin computer journalism, we rate the reliability of themanufacturer. First, we use the standard ratings based oninformation from Standard & Poor, Dun & Bradstreet, andthe men’s room attendant at the New York Stock Ex-change. Next, we test based on “look and feel” issues such

as color (or presence) of the CEO’s hair, number of com- pany executives wearing brown shoes with blue suits,glossiness of the annual report, and quantity of shrimpserved at the company’s COMDEX party. Finally, we takea hard look at marketing expertise including public rela-tions budget (did they bribe us?), advertising budget (dothey advertise with us?), and use of inappropriate celebri-ties, water fowl, or hors d’oeuvres in their ad campaign.

As with the other categories of data, companyreliabil-ity information is not left to peacefully ferment. No, werun the raw numbers through a data colander unmatchedin subtlety and precision, The results are factored withnumbers taken from deep between the lines of the WallStreet Journal, lVeul York Times, and Daily Racing Form.

When we’re through, you’re presented with the one num- ber that can indicate beyond a shadow of a doubt whether you should place your trust in a company by purchasingits product. Several Wall Street heavies have come to us

 begging for our numbers, but we have steadfastly refused.You see, we value the welfare of our readers far more thanwe value the paltry few million dollars offered for our secrets. Knowing that you will be able to make major pur-chasing decisions based upon what you read here is worth

more to us than miles of yachts or buckets of caviar.So now you know the why and the wherefore of our 

review process. As you turn the page, do so with the proper reverence, for you are truly taking part in a new era:The Age of MOPOKE. 0

989 23

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 21/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 22/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 23/72

Schemattc 1 -The 80386.5X microprocessor makes up the core of WI/S PC/AT-compatible computer motherboard.

:hematic  P-The 82230and 8223 co nta in m ost o f the cont ro l signa l log ic fo r the b oa rd in two neat pa ck ag es.

Oc t obe r / Nov embe r 1989  27

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 24/72

Writer’s Guide for the 386 architecture.This liferafurecan beobtained byconfacf-ing a local Intel sales office.1 It is avail-able in a 68-pin Plastic Leaded ChipCarrier (PLCC) package.

MEMORY SYSTEM

The local DRAM resides on thememory bus. The Memory Address(MA) bus is a IO-bit (MAO-MA9)multiplexed address bus which goesfrom the 82335 to the local DRAMS

only. The Memory Data (MD) bus is a16-bit bus (MDO-MD15) that is con-

nected via two 74F245s to the localdata bus.

The Terminator contains 1 MB oflocal DRAM in the form of two banksof 256K x 9 DRAM SIMMs. Each bankis 18 bits wide (2 bytes + 2 parity bits).The DRAMS are 100-ns  fast-page-modechips. Fast-page-modeDRAMs

have a short page-mode cycle timewhich allows the 386SX to run O-wait-state bus cycles.

When determining whether aparticular DRAM is fast-page-mode,three DRAM specifications are criti-cal:

1. fCAS-Column AddressStrobe Pulse Width

2. fCAC-Column AddressStrobe Access Time

3. f CP -Column Address StrobePrecharge Time.

To be fast page mode:

1. tCAS must be c= 35 ns2. tCAC must be c= 35 ns3. tCP must be <= 20 ns.

Understanding 386 bus cycles iscrucial to understanding wait states.While a full explanation of the buscycles will be given in the Part 2 of thisarticle, a brief explanation of the 386’sbus cycles and wait states will help

here.A386SXbuscycleismadeupofT-states. The first T-state of a bus cycleiscalled  Tl and every T-state after thatis called T2. Each T-state is two proc-essor clock (32 MHz) cycles long. Thefirst clock cycle in a T-state is phase 1and the second is phase 2.

The 386SX will terminate a buscycle when it receives a READY backfrom the accessed I/O device ormemory location. If, at the end of T2

(the second T-state), the CPU has notreceived READY, it will keep waitinguntil READY is active. A two-T-statebus cycle is the fastest possible386 buscycle. EachadditionalT-staterequiredis considered a wait state. As you cansee, a O-wait-state 386SX bus cycle isfour processor clock cycles (two T-states) long.

The CPU will always check forREADY at the end of every T2. The82335 generates the READY for local

DRAM accesses. The 82335 passesREADY through to the CPU, from thecoprocessor on a coprocessor cycle, orfrom the 82230 on a PC/AT cycle.

The 82230 automatically gener-ates READY after one wait state formemory accesses and four wait statesfor I/O accesses. This default numberof wait states can be dynamicallyoverridden by use of inputs to the82230/82231  suchas  OWS\, IOCS16\,IOCHRDY\, F16, and FSYS16. I’llexplain these inputs and their relationto PC/AT bus cycles further in thesection on expansion bus cycles.

28 CIRCUIT CELLAR INK

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 25/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 26/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 27/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 28/72

:hematic J-The system a d d ress b us is sep ara ted from the loc a l ad d ress b us b y 741.9546s. The X ad d ress b us is b uffered b y 74LS245s.

Schematic 4--The system and p er ip hera l da fa bu ses are buf fered in a mannersim ilar to the a d d ress b uses ab ove .

32  C lRCUlT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 29/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 30/72

:hematic 5-A Pair of 27256 EPROMs provide the system with 64K bytes (32K x 16 bits) of storage for the BIOS.

~r~rmunc  o-une megaDyre o r RAM IS prov iueu on the b oa rd throug h the use of four XJOK x Y SIMMS.

34 CIRCUIT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 31/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 32/72

arag *oLI,  ,“B,90!

~~e~~ t i c  7 -Low -Pow e r CM OS RAM is used to store the system c onfigu ration sett ings w i le pow er is o ff

I I i ,

c h e m a t ic  8- l n order to be co m pa t ib le w i th exist ing B-bi t per ipheral boa rds, the or ig inal IEM PC 8 -b i t  / O bus is prov ide d.

CIRCUITCELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 33/72

(RTC) in the 82230. This RAM is usedfor storing system information re-quired at power-up. Because of thebatteryback-up, thisinformationstaysvalid when the system is turned off.

After the 82335 is programmed,the PC/AT part of the system needs

initialization. Thisinvolves program-ming the keyboard controller and thevarious82230/82231 peripherals. Thisis part of the Power-On Self Test(POST).

Whenitisfinished withthePOST,the BIOS sets the LOCK bit in the82335’s configuration register. Thiscauses the 82335’s registers to becomeinaccessible until the next system re-set. In other words these registersbasically “disappear” from theTern-&nator’s I/Oaddress space. This is nec-essary to retain PC/AT compatibilitysince these registers are not a part ofthe PC/AT I/O address map. ThePC/AT I/O address map is shown inTable 5.

The BIOS initialization will alsoset up add-in cards. The BIOS scansthough the memory address space

looking for an adaptor ROM “signa-ture.” This is a special bit pattern thatsignifies that an add-in card has itsown BIOSat this location. The systemBIOS will turn over control to the add-in card BIOS which then sets up thecard. The add-in card BIOS is free to

use system information available inthe system BIOS data area and theCMOS RAM.

Lastly, the BIOS will check thedisk for the operating system boot-strap program. If it is available, it willload the bootstrap and transfer con-trol to it.

VGA

Although the VGA circuitry

physically resides on the motherboard,it islogically treated asan add-in card.It interfaces with the Terminator onlythrough the expansion bus, as wouldany VGA add-in card. The low chipcount of the Terminator system hasbasically allowed us to place an Intel-designed VGA add-in card physicallyonto the motherboard without chang-

ing the add-in card’s operation. There-fore a VGA access is considered an off-board or expansion bus access. Sinceit is logically not part of the Termina-tor system, I will not further discussthe VGA circuitry in this article.

AND ON TO THE BUS CYCLES.. .

So far I have described the basic logicof the Terminator board. In Part 2, I’lldescribe the Terminator’s bus cyclesand present the VGA portion of theschema tic. This should round out yourunderstandingof thecomponentsandexplain how they all function togetheras a system. +

Daryl Rinaldi is an application engineer at

Intel Corporation and works on the386SXandassociated products. In his spare time, he likes

to explore California.

IRS207 Verv Useful208 Moderately Useful209 Not Useful

~~~~~~~~K  y-i-or  comp le re   c / A I Compa t ~D l l i t y ,  &b it expa nsion b oa rds are supporfed in a dd it ion t o B-b i t bo a rds.

October/November 1989

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 34/72

The BCCH 16A 76 / 32 -b it M ult ita sking Sing le -b o a rd by Tom Cantrell

Microelectronics have cer-tainly benefited all in the form of cal-culators, watches, PCs, audio, cars,and a myriad of other mass-produceditems. However, an important seg-ment of the economy-small manu-

facturers-have been poorly servedby computer technology.I encourage all technocrats to

practice a little self-enlightenment.Make a visit to a small industrialpark-you know, over there on theother side of the tracks where younever go. Don’t be intimidated by theramshackleappearance, funny smells,and loud noises. Look around. Whatyou’ll see are small outfits offeringmyriad mundane industrial productsand manufacturing services. But you’ll

also be shocked to see how “low-tech”these places are.

For every industrial giant tryingto decide whether to spend $1 or $2Bon the latest factory automation ef-fort, therearea lOOsmall  businesses-theinvisibleenginesof  theeconomy-who can’t computerize their way outof a paper bag. What? You meanVME-based “cells“ connected with abroadband fiber-optic LAN aren’t theanswer for Joe Smallco who needs a

remote display for his truck scale?RISC, ASIC, CASE, AI, and othersaren’t the solution either.

The most important criteria isn’tMIPS, LIPS, MOPS, or FLOPS. In-deed, manyautomatable tasks requireminimal performance. What’sneededare systems that are easy to use fornoncomputertypes;systemsthatdon’trequire an army of engineers and labfull of expensive tools to get working.

We decided to design a compu-terized controller that would fill the

needs of those who need advancedcontrol but don’t need to becomeexperts in obscure assembler lan-guages. We settled on a BASIC-lan-guage controller sitting on an estab-lished control bus (in our case, the

BCC bus) as a general direction tofollow.

BCCH 16 HARDWARE DESIGN

The goals of the BCCH16 hard-ware design are:

l Maximum performanceat rea-

Comp u t e r  

sonable costHardware compatibility withthe BCC busSoftware compatibility withexisting BCClSO BASIC pro-gramsSmall form factor and low-power operation

Of course, I think the BCCH16meets the goals handily, but let meexplain the design and you can judgefor yourself. First, take a look at theBCCH16 block diagram (Figure 1) andthen follow along as I describe each ofthe major subsystems: CPU, memory,

I/O, and BCC bus interface.

THE H16 CPU

The Hitachi HD641016 (the“H16”) is the middle member of therecently introduced “H Series” com-prising the H8, H16, and H32 devices.Though the CPUs aren’t object codecompatible, they are pretty much as-sembly language upward compatible.This means assembly programs for alower numbered chip (i.e.,

Part 1

HB<H16<H32) will assemble and runon a higher numbered chip. The“pretty much” proviso relates to on-chip I/O devices; each existing (andfuture) device has a different mix ofon-chip I/O. Obviously code that

accesses an I/O device on one H-Se-ries CPU will have to be reworkedwhen ported to a different H-SeriesCPU that doesn’t have that I/O de-vice!

Though not object code compat-ible-a dubious idea at best for chips

I 24 Parallel I/O Lines

m-232 BCC Bus

S-232/:

-422/485

BASIC- Data

BASICSOUI?X

(PSRAM)6 Object(EPROM)

BASICCompiler

hRuntimePackage

Figure I-The  BCCHl6 c ontains a 16/32HD44 10 16 (H 16) CPU. up to 768Kl3 of mem - o ry (256KB each for system, program a nd da ta) . and 48 pa ral lel l /O l ines. The CPU i tsel fpacks two serialpo rts and (not shown)t imers and DMA c hann els as we l l. The boa rd ta lks to exisfing B-bitBCC-bus-com-pat ib l e boards and a cc omm odates l&b i tI/ O bo ard d esigns as wel l .

Q ClRCUl l CELLAR NK

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 35/72

that span the application spectrumfrom phones and VCRs to worksta-tions and multi-FPU image proces-sors-the members of the family dosharesomecommonarchitecturalandimplementation aspects.

General-Purpose Registers

The machines have lots of regis-ters. The H16 has 16 32-bit registers,RO to R15, shown in Figure 2 (ignoreall the other stuff in the figure for now)

which all work exactly the same. Thisis far different than CPUs such as theIntel “86” family in which registersare limited to special functions andeven the Motorola 68xxx family, whichrestricts some registers for addressesand some for data. The only thing to

remember about H16 registers is thatR15 serves as the stack pointer (actu-ally, R15 is general purpose as well-you can hit it with any instruction youwant, but be careful!).

Regular Instruction Set

Without getting into the “ISC”(RISC, CISC, CRISC, etc.) religiouswars the story on the H-Series is asfollows:

l Few basic instructions-MOV,ADD, BRA, AND, etc.

l Lots of addressing modes anddata types.

l The instruction set is very or-thogonal to the registers, ad-dressing modes, and datatypes.

l Unique special-purpose instruc-tions and data types for differ-ent H-Seriesdevices that targetparticular applications. For in-stance, the H16 has bit-field in-structions useful in multichan-nel on/off (relays, switches,lights, etc.) control and bitmapCRTs/printers while the H32has multi-FPU coprocessorsupport.

l High code efficiency (i.e., bangperbyte). For instance, theH16,unlike some other 16/32-bit

CPUs, supports byte-alignedinstructions(allowingl-,3-,etc.byte instructions where the

Gbbal  Mode

Noles: 1. 11 R15 o r slack pointer is selected by an inslruclion when the S bit of  the SR regisler is set to 1.

the supervisor slack poinler (SSP) is used.

2. If the S bit of the SR register is cleared lo 0. the user stack pointer (USP) which is R15 of 

general-purpose register is used.

Figure 2-  The programmers view of the H 16 primarily consists of 16 32-bit registers  (W-R 15,top left). A num be r of the o ther con t ro l reg isters ( top r ight ) a re re lated to the register bank 

mo de s (g loba l and ring , bo t tom ) .

older chips would have to use2, or multiples thereof, bytes)and features “short-forms” forcommonly used instructions(an examplebeing special shortexpand BNE instructions, sincethey are used so often, as wellas a longer “universal” condi-tional branch form).

High-speed on-chip memory

This takes different forms: code

EPROM on the H8, register banks/data RAM on the H16 and, a myriad ofcaches on the H32.

Advanced CMOS process

Very fast and surprisingly lowpower-less than 100 mA at 10 MHz,and half that when you exploit pro-grammable low-power modes.

REGISTER BANKS

As mentioned previously, one ofthe precepts of the H-Series architec-ture is to exploit high-speed on-chipmemory to speed overall performance.

In the case of the H16, this takes theformof  lKbytesofon-chipRAM. TheRAM is “fast” in two ways. First, on-

October/November 1989 41

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 36/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 37/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 38/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 39/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 40/72

Figure  h-The  first Page of the schematic consists mainly of the H 16. address latches U8 and U9 (which serve to demulfiplex thePrOcessorS address/data bus). and , on the left. the serial I/ O transceivers (which offer RS-232, RS-422, and RS-485 options).

MORE THAN JUST A CPU l Then,add I/O functionsusingthe same criteria.

Each area’s access privilege level (user

There was a time when the previ-or supervisor) can be assigned, while

ous section would have completely. Keep adding stuff until you accessing an “undefined” address (not

run out of transistors.described the CPU chip. But, looking

mapped to any chip select) causes an

at Figure 4 you can see everythingexception,all of which helps to harden

said so far comprises only a small

Exploiting the same integration the system against the inevitable soft-

portion (CPUand RAM) of the device.strategy, the H16 incorporates the ware bugs. Each of the four areas alsosame basic functions as the HD64180,

 The rest of the goodies on the chipfeatures programmable wait states

thougheachH16functionisupgraded (from 0 to 7) and an external WAITcan be roughly divided into two cate-gories: system (less affectionately

from the older chip’s counterpart. input is provided as well.

known as “glue”) logic and I/O. Chip Select/Wait State DRAM Refresh ControllerThose familiar with the company’s Controller

HD64180 B-bit chip will recognize theintegration strategy:

There is no better place to put aThe H16 provides two chip-select DRAM refresh controller than on the

lines (PCSO,  PCSl) which encode one. First, build in system functions

CPUchip(withthepossibleexception

that are required in almostof four chip-select areas, each of which of on the memory chip itself-more

every design and/or work

has programmable size (in 64K-byte later). Besides hiding the asynchro-

increments) and location within thebetter on-chip than off.nous and high-speed timing glitches

processor’s 16M-byte address space. that can plague an external DRAM

46  CIRCUIT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 41/72

controller scheme, integration unifiesDRAM refresh with other CPU opera-tions such as DMA and even reset.The H16 DRAM refresh controller isimproved from that of the ‘180 in twokey ways. First, it supports DRAMSneeding up to 11 bits of refresh ad-dress (including lM- and4M-bit chips)where the’180 only offers 8 bits (up to256K-bit chips). Second, the H16’scontroller deals with the special casesof refresh when another “master” hascontrol of the bus and when the H16 isin one of its low-power operationmodes (SLEEP and STOP). The con-troller keeps trackof deferred refreshesand can juggle the bus priority to catchup before the DRAMS start to fade.

Interrupt Controller

Being designed for real-time ap-plications, the H16 includes an inter-rupt controller to field requests from amultitude of sources. The shortly-to-be-discussed onchip I/O devicesaloneaccount for 22 interrupt sources.To manage all these interrupts effec-tively,thecontrollerincorporatesfour-level programmable interrupt prior-ity. NM1 is always the highest prior-ity, but the other internal and externalsources can be freely assigned to theremaining three levels. Not only doesthisallowprioritizationdependingonthe application, but the priority can bedynamically changed to adapt to vary-ing loads and response time needs.

The H16 includes the same basicI/O selection as the HD64180, but, asin the case of the on-chip system logic,the functionsaresomewhat improved.

UARTs

The H16 includes two full-func-tion UARTs called ASCIs (Asynchro-nous Serial Communication Inter-faces). Like those on the ‘180, theASCIs contain all the features andfunctions of the fanciest stand-aloneUART chips-baud rate generator,programmable formats, handshakelines, and so on. Two key improve-ments are a) the baud rate generator is

more independent of the system clock(youcanderivestandardbaudratesatmany different system clock frequen-

Figure 7--The sec ond p ag e of the schem at ic c onta ins log i c  (UlO.  Ul 1, a nd U12) to 

ge nerate va r ious on-b oa rd co nt rol signa ls. U 14 is respon sible for ge ne rat ing a n ‘Early Write’ EWR\ ) st rob ereq ui red by the 8255sand otherch ips wi th long wr ite da taho ld t imes.

U 13 b uffers 8- and 16-bi t co nt rol signals asser ted d ur ing of f -boa rd KC bus ac c esses.

ties) and b) there are a full comple-ment of handshake lines (CTS\,DCD\, and RTS\ for each channel)and they work in a more straightfor-ward manner than on the ‘180.

Timers

The H16, like the ‘180, includestwo 16-bit counter/timers. However,unlike the HD6418O’s timers, whichdo little more than count system clockpulses, the H16 timers each have twoI/O lines (TIOA and TIOB) and aplethora of operating modes whichare illustrated in Figure 5.

Notably, the timers also work withthe on-chip DMAC so you can set upa table of timer values which are auto-matically loaded one after the other

by the DMAC to generate any kind ofvariable waveform you desire with-out CPU intervention.

DMA Controller

Speaking of the DMAC, the H16includes four DMA channels (versusthe HD6418O’s two) which speed thetransfer of data within the system.The DMAC supports transfer fromand to anywhere, on-chip or off, with

one exception: you can’t DMA to/from the DMAC itself! The need for aDMAC might be questioned by thoseused to lower-end g-bit chips, butremember that one of the main rea-sons to use a 16bit chip is to acceleratedata transfer. Furthermore, if DMA isneeded, you’ll be very glad it is in-cluded on-chip since the integrationeliminates all kinds of potential head-aches. For instance, theon-chipDMACworks hand-in-hand with the chip-

select/wait-state controller, DRAMrefresh controller, and even the user/supervisor protection scheme.

O c t o b e r / N o v em b e r 1 98 9 4 7  

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 42/72

tlgure o-  me SIX &?pin sockets which76BK bytes.

compr i se fhe BCChi4.s mem ory are eac h cap able of hold ing IM bi t memo ry ICs for a Tota l of Sockets U 17 and U 18 are switchab le betwe en RAM a nd ROM w ith jumpe rs (JP6) loca ted just below  l / IS.

Beyond this, the DMAC featuresall kinds of extras: different request

(edge or level sense), bus (burst, singlecycle, or cycle steal), and priority(normal or “express”) modes;continueoperation for repetitive block trans-fers (ideal for CRT refresh); and busmatching between 8- and X-bit ports.Furthermore, unlike the ‘180 DMACwhich features only dual-address(read source and then write destina-tion) transfers, the H16 DMAC alsooffers single-address transfers (readsource and write destination simulta-neously) by exploiting dedicatedDACK\ lines for each channel.

Anyway, the bells and whistlesare great, but those who really need

DMA will tell you that the bottom lineis raw speed. At a CPUclock rate of 10MHz, the H16 can achieve a maxi-mum throughput of 6.66 Mbytes/second which, I suspect, is more thanfast enough for most applications.

I could go on and on about theH16-bus retry (you don’t want your “mission critical” box to choke on an

alpha particle), prefetch algorithm,trace exception, precharge wait state,and so on. Anyway, you get the idea.The H16 has everything on it but thekitchen sink (actually, I heard a rumor 

it is in there, just not documented). If you want to know more, wade through

the 600-page(!) manual yourself.Fornow, wecansumuptheH16’s

role by referring to the first page of theschematic (Figure 6). There we see theH16  WI) which, thoughdrawn tolooklike a DIP, is actually packaged in anapproximately 1-sq.-inch8CpinPLCC(Plastic Leaded Chip Carrier).

At the top left of the schematic isthe logic which connects the H16’s

ASCIs  WARTS) to the outside world,ASCI channel 1 (RXDl,  TXDl, etc.) is

intended to connect to the main con-sole (whether a terminal or PC run-

48 ClRClJlT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 43/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 44/72

PHI

Tl T2 Tw Tw T3

II L - r

gure 1 O---The last section of the schem atic finishes the de sign with two 8255s (48 I/ O   i n e s l and the BCC bus connec t i on .

hip the bus names are changed to themore conventional ADO-15 and

O-A15.The AND gate at the top right

ecodes accesses to the top 4 mega-ytes as a signal called BCC\. This issed to signal that an access is goingff the board onto the BCC bus. WRITE DATA 

Finally, at the top of Figure 7, UlOdecodes the H16 chip select

nes PCS0 and PCS1  ) to generate chipelects for the other devices on theoard. Notehow the “C” input (most-ignificant bit) to the decoder is con-ected to the previously mentioned

signal. When BCC\ is lowndicating an external bus access, thehip select outputs are shifted to theO-Y4 pins which aren’t connected tonything. This ensures that no on-oard devices will be selected duringn off-board access. Also, gates U5nd Ull decode H16 status lines ST1

EWR\/

Figure 1 I -The 8255s requi re a long w i fe d ata ho ld t im e (the t im e for whic h the da ta 

rem ains stable a fter the trail ing e dg e o f WR\ ).The t ime prov ided by a W R\ de rived from 

th e Hlb da ta strob es HDS\ and LDS\ ) is not suffic ient, so a n “Early Write’ (EWRU is generated which easily meets the 8255 spec .

50 ClRCUIT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 45/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 46/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 47/72

to input D on the shifter. Once again(as in using a UART handshake linefor auto-baud detection), an H16 lineis being used for an unintended pur-pose. In this case, the timer line acts asa simple l-bit output which is used toprogrammably “tune” the write cycle

timing in case we run into other chipswith difficult timing requirementssomewhere else in the system.

BCC BUS INTERFACE

The system so far is a completecomputer with H16 (and all it in-cludes-timers, UARTs, etc.), mem-ory, and parallel I/O. All that’s left isto provide a way for this computer toaccess boards out on the BCC bus, a44-pin bus for control applications.

As you’ll see, the basic bus inter-face is pretty simple (the 44-pin limithelps discourage “creeping ele-gance”). The major challenge is tofind a way to remain completely com-patible with existing &bit I/O boardswhile at simultaneously supportingthedevelopmentof high-performance1Bbit I/O boards (likely candidatesare fast A/D and parallel I/O). Here’sthe solution and it turns out to be sur-prisingly easy.

The existing 8-bit bus spec uses atotal of sixteen lines for address anddata: Multiplexed address/data linesADO-7 and non-muxed addresses A8A15. Thus, the obvious place to startis to decide that 16-bit accesses willsimply use the same lines for the H16smuxed address/data bus ADO-AD15(actually All%A16D15, but I ex-plained about renaming thesealreadydidn’t I?). Now, how to decide whichtypeof  buscycle+? or l&bit-should

be run?The answer is embodied in theremaining logic on page two of theschematic (Figure 7). First, gates inUll and U7 generate BCCS\ andBCClG\ signals (which identify 8 and16-bit cycles respectively) based ontwo inputs-BCC\, which decodes aBCC-bus access in general and A15,which partitions the BCC-bus spaceinto 8 and 16-bit halves. It turns outthat all existing BCC-bus I/O boardsfeature jumper address selectionwhich allows them to be positioned at

high addresses (8OOOH-FFFFH) so wesimply adopt the convention thataccesses to this range are 8-bit whilethosefromOOOOH-8OOOHare  %-bit. Inessence, what was once a 64K byteBCC-bus space hasbecome a 64K wordspace of which 96K bytes are usable-

32K 8-bit ports and 32K 16-bit ports(Figure 12). This is all hooked into theBASIC INP and OUT statements-ifyou INP from /OUT to a port addressbetween 8OOOH-FFFFH  8-bits will bemoved while 16-bits will be movedfor accesses to ports OOOOH-8000H.

Having derived BCC8\ andBCC16\ signals, they are used to se-

lectively enable the respective buscontrol lines driven by U13. Half thechip drives the existing 8-bit controllines (AS\8,  DS\8,  RD\8 and WR\8)while the other half implements thenew 16-bit bus lines (AS\16,  DS\16,R/W\16 and a spare-RSVD\lG).

Notice that since this design only en-ables U13 during actual BCC-buscycles, pull-ups (RN2) are required toprevent possible I/O board glitcheswhen the BCC bus is “idle.”

These bus control outputs run overto the last page of the schematic (Fig-ure 10 ) where they hook directly to theBCC bus connector. All that’s left to

Put

uit Cellar INKwork for you.

Circuit Cellar INK readers are engineers, program-mers, consultants, and serious computer tech-

nologists. Bring them into your store by sellingCircuit Cellar INK.

Circuit Cellar INK’s Direct Dealer Sales Programlets you increase your store traffic-increase yoursales-increase

 your profits withminimal risk andup-front invest-ment.

For information onhow your businesscan become part of the growing CircuitCellar INK success

story, write or call: Circuit Cellar INKDealer Sales Program4 Park StreetVernon, CT 06066(203) 875-2199

October /November 1989 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 48/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 49/72

FIRMWARE FURNACE

Cache Crazinessby Ed Nisley

I f you believe the ads and re-views, the recent proliferation ofcaches in high-end PCs is the bestthing since the IC. It seems that nomatter what programs you run, nomatter what your job, things go better

with cache.. .The recent history of micropro-

cessor systems is studded with “break-throughs” that first appeared in themainframe world decades ago. Thisseason’s PC innovation seems to becached main memory. Contrary tothe advertising excitement, a cache issimply one way to match a fast centralprocessor to relatively slow memory.

Because a cache seems to give yousomething for nothing, the usual ca-

veat applies: something that looks toogood to be true probably is. In thiscolumn I will explore the cache funda-mentals sometimes lost in the glare ofpublicity.

Before the cache, however, camethe wait state.

LYING IN WAIT

The venerable wait state is thesimplest way to saddle a fast CPU

with slow memory. In fact, it formsthe basis for all other methods! If thememory cannot respond by the timethe CPU is ready, a circuit freezes theCPU until the data arrives. The dura-tion of the wait is measured in ticks ofthe CPU clock.

For example, a 33-MHz 80386 (thecurrent heart throbof the Crystal Crazys&requiresvalid data twoclockcycles(60.6 ns) after it issues a request, a timescale that is slightly beyond the capa-

bilities of affordable DRAM. Eachwait state adds 30.3 ns to the access

time. Figure 1 sketches the number of instructions perform some useful workwait states required at various mem- on-chip between memory accesses.

ory speeds for a ‘386; note that the Obviously, you can sandbag the re-speeds shown are for the entire sults either way by carefully choosingmemory system and not just the RAM the instruction sequence used for test-chips themselves. ing.

Start ofmemoryaccess

data availablefrom RAM system

ata accepted by 80386 CPUt end of cycle

I  Icycle"dead" time between

-data available anddata accepted

tate

k-100 ns --A

two wait states

three wait states

Figure 1 - Wa itstate sreq uired for variousm ain m em oryspe ed s on  a33-MHz80386 system.DRAM a c c ess time s a re alwa ys faster tha n ove rall mem ory system times! 

Fortunately, ‘386 instructions donot need data at a continuous 16.5-MHz rate! Although a single waitstate degrades performance by 50%on each memory access (requiringthree cycles instead of two), the effect

is less than half that for a typical se-quence of instructions, because the

But wait states, no matter hownecessary, do not make good adver-tising copy, so staticcolumn DRAMor page-mode DRAM appeared. In-stead of one or two wait states, allmemory accesses after the first within

a given range of addresses require nowait states. That first access, however,

October /November 1989  55 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 50/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 51/72

Figure J-Cache data paths. The c ac he ha s J6K l ines and uses direct ma pp ing to one 

o f 64K ma in mem ory locat ions. Eac h ca che / he co nta ins four data bvtes.

at full speed, while the I/O bus isthrottled down for compatibility withthe I/O devices. I will leave it to youto infer the performance effects ofputting memory on the “AT I/O bus”section.

HITTING THE CACHE

Because the cache memory is fast,

any data found in it can be returned tothe CPU with no delay. But, becauseit is small, there must be some data inmain memory that isn’t in the cache.The cache control logic’s job is to guesswhat data the CPU will ask for and tryto have it in the cache memory, readyfor use.

Themost important figureof meritfor a cache is the “hit ratio” whichmeasures the success of the cachelogic’s guesses. The hit ratio is simplythe number of zero-wait accesses di-vided by the total number of accesses.

For example, if the CPU made 100 ac-cesses and 80 had zero wait states, thehit ratio would be 0.8 or 80%. Obvi-ously, the higher the hit ratio, thebetter.

The dark side of the hit ratio is thenumber of accesses that are not in thecache. For example, that 80% hit ratiosounds pretty good unless each cachemiss requires five wait states. In that

case, the CPU “sees” memory with anaverage of one wait state. Calculatedout, 100 accesses x 0.2 miss ratio x 5waits/miss = 100 waits, or one peraccess!

Al though five waits per miss mayseem high, Figure 1 shows that even apeppy 100-ns memory system takesfour cycles for each access. Ordinarilyonly the last two cycles count as waitstates, but if the cache control logicdetects a miss it must start an access

from scratch during the second cycle;all four main memory cycles count as

wait states. The overall access willtake six cycles!

Although you might think thatthe control logic could start simulta-neous accesses in both the cache andthe main memory, then cancel the mainmemory access after a cache hit, the

situation isn’t that simple. The mainmemory logic usually cannot cancelan access, so the circuitry would betied up for four cycles anyway; a sec-ond access would have to wait for thememory to recover from the first,canceled,access. Also, recall that DMAaccesses may be running on the otherbus, so any additional CPU accesseswill clobber I/O performance. Ah,tradeoffs!

Takealookat theadsforl’cswith

main memory caches. Try to find thenumber of wait states per cache miss,but don’t be surprised if it doesn’tappear anywhere. For extra credit,deduce the number of waits from themain memory speed if you can findthat number. Interesting, no?

RUNNING THE LINE

A good-sized PC cache has 64Kbytes of fast RAM. Current IBM I’S/2s are limited to 16 MB of main mem-ory because the DMA controller gen-erates only 24 address bits, but futurehardware will probably remove thislimitation and allow up to 4 GB ofRAM (talk about sticker shock!).Simpledivision tells you that thereare64K bytes in main memory for eachcache byte!

It makes sense to divide the cacheinto “lines” that can be filled by onemain memory access ra ther than worryabout individual bytes. For the 80386,

the natural cache line is four byteswide. The number of lines in thecacheis simply the total cache size dividedby the line size; in this case the cachehas 16K lines.

The first byte in each line has amain memory address with two low-order zeros. The 80386 CPU can ac-cess four-byte words starting at anyaddress, so parts of the result canoccupy two lines. I’ll ignore the obvi-ous complications, but you should

note that the cache must tuck the rightbytes into the right parts of the right

October/November 1989 57

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 52/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 53/72

to that data will always be a cachemiss.

Ah, more tradeoffs!The second method requires a

“Dirty” bit to mark cache entries thatmust be copied back into main mem-ory; the cache control logic (and some-

times the CPU firmware) uses that bitto schedule updates. Some imple-mentations use a FIFO holding thenew data and addresses so the mainmemory can perform updates whenit’s not doing anything else.

In the cache I’ve been describingso far there is only one possible spotfor each main memory byte: in the lineselected by address bits 2-15. Such acache is called “direct mapped” forthis reason. Another cache design,

called a “set-associative” cache, hasseveral possible lines for a given ad-dress; typical set-associative cachesallow two or four locations for eachmain memory byte.

You can think of a set-associativecache as having two (or four) tag,address, and data RAMS. Each CPUaccess activates all of the cache RAMS

in parallel; only the line holding amatching address will be a hit and theothers will be misses. In these de-signs, the cache control logic musthave a way to select one line from theset to hold new data. Although somecaches pick a line at random (honest!),

the Least Recently Used algorithm ismore common.For set-associative caches, an

“LRU” bit is set whenever the line isaccessed. Periodically, the cache con-trol logic examines the LRU bits andinvalidates any line which hasn’t beenaccessed since the last examination.New data always goes into an invalidline unless all lines in the set are valid(they are all “recently used”); in thatcase the logic can pick any line.

Top-dollar mainframe cacheshave an additional bit that disablesthat line. This “Error” bit is set whenthe system detectsanerror in the cacheRAM. PC-sized caches solve thisproblem in two ways: they don’t haveparitycheckbits(sodiagnosingafailedcache RAM is difficult) and you re-place the entire chip. If you had to

replace the entire system board to fixa single-bit error, you would clamorfor better cache error checking, too!

STRIDING INTO TROUBLE

Now that you know all about how

a cache works, we can explore how itaffectsprogramperformance. Despitesome advertising claims, there aresome things that do not go better withcache!

The ideal situation occurs whenall of the instructions and data are inthe cache. Conversely, if every mem-ory reference is a cache miss, the sys-tem will run slower (sometimes muchslower) than it would without thecache. Because the cache hardware

design is a given in a particular ma-chine, your program and operatingsystem behavior determine the cachehit ratio.

Because the cache shown in Fig-ure 3 has four bytes in each line, thedata in the third statement of thisprogram fragment will always have acache hit (assuming no interrupts get

SA-20 EPROM PROGRAMMERStand-Alone 8 Gang Programmer  $750 

Programs2716,2732,2764,

27256.27512.

Quick Pulse Menu-DrivenAlgorithm Operation

27CO10,27COiO, Binary, Intel Hex A9 Intelligent27CO40 and Motorola S Identifier 

Parallel VO cir  FE232Formats

Full 1 year warranty

Call Toll-Free I-800-248-5487

Coindata, Inc.3026 Owen Dr., Suite 106, Antioch, TN 37013In TN (615) 793-9142 FAX (615) 793-9177

 A rugged CABl%GE CASE? lined withplenty ot foam for your equipment canTAKE A LOAD OFF YOUR MIND

when you’ve got to travel.

TAKE A LOAD OFF YOUR BACKwith our  exclusive tilt-wheelsand extension handle option.

~~~~

UNLOAD ON US!Call or wnte to tell us about your shipping or carrying problems

WE HAVE SOLUTIONS!CABBAGE CASES, INC.1166-C STEELWOOD ROADCOLUMBUS, OHIO 43212-1356

(614) 466-2495 (600) 666-2495

October /November 1989  59 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 54/72

r x11 Xl*   Xl3  X,4 1

14

18

1c

24

28

2c

30

34

38

3c

Figure 4-Array ofshortreals and t he c o r re -  

spond ing storage l ayout .

control between the second and thirdlines!):

 MOV  SI, lOOOh

 MOV   AX, [SII MOV  BX,[SI+2]

While the natural length of a cacheline is the processor’s memory buswidth, longer cache lines can improvethe hit ratio by fetching more data oneach cache miss. Because most pro-grams use data and instructions moreor less sequentially, a miss is (usually)the start of a series of references tosuccessively higher addresses. If that

is true for your programs, longer lineswill improve the hit ratio by preload-ing more of the information your codeis about to use.

However, longer lines imply awider interfacebetween thecache andmain memory, or several accesses tofill a single cache line on every miss. Ifthat interface must be shared with theI/O system, some complications arisein getting the right data on the rightpart of the bus; it is rare to see a four-byte I/O device! Adding a separatebus for the cache implies that therewill be three system buses and a dual-

60 ClRCUlT CELLAR INK 

ported main memory, so you can seethat the choices are not at all simple.

Loops and caches seem to be madefor each other, because after the firstpass all the instructions should be inthe cache and the data may benefitfrom preloading. Usually that is the

case, but the code in Listing 1 showswhat can happen to the unwary pro-grammer working on an image proc-essing application. In this example,the code is adding the contents of two&K-byte buffers and storing the re-sult in a third. All three storage refer-ences use the same cache line, so everyaccess is a miss despite the fact that thecache is busily preloading three bytesfor every one actually used!

That loop also has the interesting

side effect of flushing everything elseout of the cache. Regardless of thestate of the cache when the loop starts,it will be full of image data at the end,with the possible exception of a fewloop instructions that may sneak backin after the loop data addresses runthrough their line.

A similar problem arises withengineering and scientific calculationson large arrays. Figure 4 shows anarray of short (four-byte) real num-

bers and the corresponding storagelayout. Each array element will oc-cupy one cache line and most compil-ers will align the elements on a four-byte boundary, so each cache line holdsone element.

While the small array in Figure 4fits into the cache with no trouble, amuch larger array may flush the cacheevery time it’s accessed. Even if onearray fits, the first pass through it willbe all misses. Worse, if the code makes

only one reference to it, those missesare wasted effort and slow the pro-gram down while the cache recovers.This sort of situation occurs oftenenough that some workstations candisable their cache under programcontrol.

Multitaskingenvironmentsintro-duce another complication, Supposeyour program is running a hot, tightloop from the cache. At that point, theoperating system switches to anothertask. The new code just happens torun a loop that flushes your code anddata out of the cache. Your code will

return the favor when it gets controlon the next time slice, and all thosecache misses start adding up.

The process of flushing and re-loading the cache is called “thrash-ing” and can cause significant per-formancedegradat ion. Unfortunate

there isn’t much you can do about itbecause your program is at the mercyof all the other processes using CPUtime. This effect does not show upunder DOS, because the only “multi-tasking” is the occasional interruptwhich uses only a few dozen instruc-tions. How caches will perform under--  .-OS/2 is open for discussion and ex-perimentation.

Incidentally, the term”thrashing”also applies to virtual memory sys-

tems subject to similar contention. Inthat case, however, the performancedecrease is even worse because thesystem must hold the flushed infor-mation in a disk file!

PRESCRlPTlONS

The truth about caches is some-where between the hype you will seein ads and the somewhat pathologiccases described above. It behooves

you to find out as much as you canabout your machine’s cache and pro-gram accordingly: avoid stepping onyour own feet whenever possible!

If you know that your machinehas a cache, but the manufacturer’sliterature does not tell you much aboutit, it will be worthwhile to write sometest programs to exercise the cachecontrol logic and find out how it be-haves under stress. The results ofthose tests will give you a good ideahow to structure your code to bestadvantage. +

Ed Nisley is a member of the Circuit Cellar INK engineering staff and enjoys makinggizmos do strange and wondrous things. Heis, by turns, a beekeeper, bicyclist, RegisteredProfessional Engineer, and amateur racon-teur.

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 55/72

FROM THE BENCH

Gentlemen, Start Your Enginesby J eff Bachiochi

The automotive industry perpetually seduces uswith glimpses into the future. A future in which comput-ers will infiltrate the American dream. The automobile hasbeen the American dream ever since its introduction over80 years ago.

THE SPARK OF LIFE

When we dream of how a computer controller might

be used in an automobile we conjure up thoughts of videodisplays and keyboards, dash mounted and within easyreach. Not only will they aid us in planning the best routeto our destination, but also serve as chauffeur and auto-pilot.

The Ignition Control Unit, or ICU, is responsible fortriggering the ignition coil. It receives data directly fromthe knock sensor, distributor, coolant temperature sensor,throttle valve switches, and altitude sensor.

The knock sensor is a piezoelectric crystal mountednext to cylinder #3. Vibrations in the engine are trans-ferred to the crystal which creates a small voltage. Bymonitoring this voltage the ICU can sense ignition knockand retard the ignition timing to prevent it.

Not many of us realize that the march toward realizingthis dream has already begun. The first applications ofsolid-state devices in our vehicles were not computercontrollers but substitutes for mechanical parts whichwore out and had to be replaced. Electronic ignitionreplaced the mechanical points in the distributor with aHall-effect sensor and magnet for noncontact dwell-angle

timing of the ignition’s firing. Windshield wipers of thepast were limited to one of a few speeds, often timescreatingtheneed toconstantlyturn themonandoffinlightrain. Today’s wiper control, which offers adjustment ofthe off time between wipes, is regulated by an RC timeconstant.

The distributor has no need for centrifugal or vacuumadvance. The ICU can calculate and adjust the timingbased on engine speed. The engine speed and crankshaftposition is picked up from a trigger wheel with five teeth,one for each of the five cylinders. A Hall sensor sends avoltage pulse to the ICU indicating the appropriate firingpoint for each cylinder as the engine turns the distributor

shaft past the sensor. The total pulses per minute dividedby five (number of cylinders) equals the crankshaft speedin RPMs.

The coolant temperature sensor consists of two inde-pendent NTC (negative temperature coefficient) resistors.

The next generation of integration is truly computercontrolled and is already in production. Full electroniccontrol of the ignition and fuel injection system is not justa dream, but is being played out in real life by manufactur-ers such as Audi. Let’s take a look under the hood of anAudi 5000s equipped with 2.3-liter engine using the CIS-

E III Engine Control System.

SHARING THE BURDEN GETS THE JOB DONE

The CIS-E III Engine Control System is made up of twocomputer controllers: the Ignition Control Unit and theFuel Injection Control Unit. A serial link between the twounits allows the exchange of accumulated data. Each unitreceives input from a variety of sensors associated with itsjob function. All inputs and outputs are checked for validdata by self-diagnostic troubleshooting which stores faultswithin system memory. These faults can be displayed as

specific on/off patterns of an indicator light in the instru-ment cluster.

Figure 1 -Distributor’s Hall-effect sensor.

62 C IRCUIT CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 56/72

ohms Resistance Curve

ttgure z-- I v/ L r e w o r  eswance versus tem pe rature.

One NTC resistor provides output for each of the controlunits since engine temperature is necessary for calculatingboth the correct ignition timing and fuel mixture.

Throttleswitches,bothidleandfull throttle,aresimplemechanical switches which detect the throttle position.The idle switch indicates when the throttle is closed andaffects the idle stabilizer value, deceleration fuel shut-off,and ignition timing map. The full-throttle switch indicates

that the throttle is in the last 10 degrees of rotation andaffects the full-throttle enrichment and ignition timingmap.

The altitude sensor is a barometric chamber which willexpand or contract with a change inatmospheric pressure.

Resi stance

track 

Figure 3-A l t i t ude sensor.

Barometri c

el ement

This movement operates a variable resistor and sends avoltage toboth control units for high-altitudeadjustments.

The ignition coil is driven from a Darlington powerstage which switches the primary of the ignition coil onand off. The secondary of the ignition coil produces astepped-up voltage which is routed through the distribu-tor to the appropriate cylinder’s spark plug. The ICUtriggers the power stage to provide the correct ignition

timing based on engine speed and engine load. A look-uptable stored in the ICU holds precalculated ignition timingadvancements based on RPM and load.

Regular FuelIgnition Map

'BTDC DecreaseII

Engine

load 

IIncrease

O”11111000 2000 3000 4000 5000 6000 7000 RPM

Figure 4- Ign i t ion ma p .

Actually, there are two ignition maps programmedinto the ICU: one for regular fuel and one for premiumgrade. The ICU uses the regular fuel ignition map whenthe engine coolant temperature is less than 149’F or the

knock sensor indicatesrepeated ignition knocking. Knock-ing is regulated on a cylinder-by-cylinder basis, since theICU can control the ignition timing of each cylinder inde-pendently. If a knock in one cylinder is detected, itsignition timing will be retarded. The timing will be re-tarded 3.4 degreesat a time (maximum of 12 degrees) untilthe knocking stops. The timing will then be advanced by054-degree steps to bring it back to the normal look-upvalue.

THE HIGH-OCTANE DIET

The Fuel Injection Control Unit, or FICU, controls thecold-start valve, idle stabilizer valve, differential-pressureregulator, and carbon canister shut-off valve. It receivesinput data from the oxygen sensor, coolant temperaturesensor, throttle valve switches, altitude sensor, and airsensor potentiometer.

The oxygen sensor located in the exhaust systemmonitors the oxygen content of the exhaust gas. Thesensor has its own heating element which helps compen-sate for large temperature changes as in initial enginewarm-up. Data from the oxygen sensor assists in deter-mining the correct air/fuel mixture.

The air sensor potentiometer is a variable resistorwhich is positioned by an air sensor plate. This plate is

O c t o b e r / N o v em b e r 1 9 89 6 3  

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 57/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 58/72

_ _.. ____ _ _

ADVERTISER’S INDEX

ServiceNumber   Advertiser 

101102103104105106107108

l

109110111

l

113114117118119120121122123124125126127128129

115/116131132133134135136137138139140141142143144145146147148149150

l

151152153154l

155

 Ail Electronics Alpha Products American Advantech AvocetBerry ComputersBG AssociatesBinary TechnologiesCabbage CasesCiarcia Design WorksCircuit Cellar Circuit Cellar CoindataCollins AssociatesComputeMliseCottage Resources“,cI;;; inc.

Dycor industrialElectronic Energy ControlEngineers CollaborativeEpoch DataExpress CircuitsHazelwood Computer Heath Co.Hogwareinfinico, Inc.innotecintro1 CorpJDR MicrosystemsKoiod Research, inc.Laboratory MicrosystemsLear Corn CompanyLogical SystemsLTS/C CorpMarkenrichMeredith InstrumentsMicromintMicromintMicromintMicro ResourcesMing EngineeringNOHAU CorpOmationParadigm SystemsParallax, Inc.PseudoCorpQuinn-CurtisR & D ElectronicsReal Time DevicesRyle DesignSilicon AlleyTab Book CompanyThinking ToolsTimelineTinneyUnkel Software

156 Witts Associates

PageNumber 

HAJAR ASSOCIATES

NATIONAL ADVERTISING SALES

REPRESENTATIVES

NORTHEASTLisa D’AmbrosiaTel: (617) 769-8950 

Fax: (627) 769-8982 

MID-ATLANTICBarbara Best

 Tel: (201) 741-7744 

Fax: (202) 741-6823 

SOUTHEASTChrista Collins

Tel: (305) 966-3939 

Fax: (305) 985-8457 

M ID WEST 

Nanette TraetowTel: (322) 789-3080 

Fax: (312) 789-3082

 WEST COASTBarbara Jones & Shelley Rainey

 Tel: (714) 540-3554Fax: (714) 540-7103

SUBSCRIPTIONPROBLEMS?

If you have problems with yoursubscription (delayed or miss-ing issues, change of address,or questions on renewals). callthe Circuit Cellar INK Sub-scriber Service Line at (914)628-0885 or write:

Circuit Cellar INKSubscriber Service Dept.

P.O. Box 2099

Mahopac, NY 10541

IRSINK Rating ServiceHow useful is this article?

 At the end of each article and somefeatures there are J-digit numbers bywhich you can rate the article or fea-ture.

Please take the time to let us, at CircuitCellar INK, know how you fell our mate-rial rates with you. Just circle thenumbers on the attatched card.

Oc tobe r /Novembe r  l989 65

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 59/72

ture and cranking speed. After start-up, enrichment isreduced as the coolant temperature increases. Duringacceleration the mixture can also increase based on the airsensor potentiometer, coolant temperature, and enginespeed.

If the full-throttle switchindicates that there isa driverwith a lead foot behind the wheel, the FICU will increase

the fuel mixture contingent on the output of the altitudesensor. However, during deceleration the FICU sends alarge negative current to the regulator cutting off fuel flowentirely to the injectors. This reduces exhaust emissionsand fuel consumption.

The carbon canister shut-off solenoid blocks the purgeline from the carbon canister. If the fuel vapors pass intotheairintake when theengineistumedoff,theymaycausestarting problems. The FICU will not allow the vapors tobe purged until the engine is running.

SELF DIAGNOSTICS

Both the ICU and F’ICU constantly monitor the sys-tems’ sensors, wiring, and input signals. Either of thecontrol units can flash the fault indicator light on the in-strument cluster. The only fault indicated without access-ing the fault memory is a problem with the knock sensor orfully retarded ignition timing due to ignition knock.

The fault memory stores any other faults and attemptsto use a nominal value as opposed to the out-of-tolerancevalue actually found. The fault memory holds a four-digitcode which indicates the probable location of the fault.The code, indicated through a flashing fault light on the in-strument cluster, is accessed by inserting a spare fuse intothe fuel pump relay for four seconds. The number offlashes equals the digit of the code number. Reinsertingthe fuse for an additional four seconds flashes the nextdigit. Note that this must be done after warming up thevehicle and leaving the ignition on. The ICU will reportany faults first, then the FICU.

The control units can also generate signal outputs. Toenable the output mode the fuse must be inserted into thefuel pump relay before the ignition is turned on. Theoutput signals can be sequenced similar to the fault memory

display. Inserting the fuse for four seconds will step

r-l Amount of enrichmentdependent on coolant temperature

mA

current

I

Starting  After-start Warm-up

enrichment enrichment enrichment

Flgure 7-Mixture enr ichmen t .

66  C//?CUlJ  CELIAR INK 

Code Location of Fault

1111 Ignition control unit or fuel injection

control unit

2121 Idle switch

2122 Engine speed signal or Hall sender

2123 Full-throttle switch

2141 Knock regulation

2142 Knock sensor

2223  Altitude sensor

2232  Air sensor potentiometer

2233 Reference (supply) voltage for air

sensor potentiometer and altitude sensor

2312 Coolant temperature sensor

2341 Oxygen Sensor control

2342 Oxygen sensor

4431 Idle stabilizer valve

4444  No faults stored in memory

0000 End of diagnosis

Figure 8-Fault input codes.

through the output codes by flashing the fault light on theinstrument cluster. To enable a specific output, sequencethrough the codes until the one of interest is displayed,then close the full-throttle switch.

SURGERY NOT REQUIRED

Each control unit contains its own micro. Decentraliz-ing tasks keeps each task loop short. Real-time control ishandled more effectively by not over-burdening the proc-essor. Let’s take a look at one of the control units.

A peek inside the ICU will drop your jaw a few inches.Two double-sided (components on both sides, friends, not just traces) circuit boards are connected by a flexible 25-pinconnector. Each board measures about 2” x 4”. A Siemensprocessor, three additional DIP ICs, a full-size crystal, andtwo dozen other discrete parts are mounted on the top sideof the boards. On the other side are eight ICs and over 150(!l other discrete parts all surface mounted. The twoboards are folded like a closed book and enclosed withina weather-tight plastic enclosure.

The total engine control system, as we’ve seen, re-ceives input from a number of sensors: vibration: crystal;RPM:Halleffect;temperature:NTCresistor; throttlestatus:mechanical switches; air pressure and speed: mechani-cally linked variable-resistive elements; and oxygen con-tent: 0, element. The system sends outputs to a variety ofcontrolling devices: ignition timing: power Darlingtondriver;and fuel supply: solenoid valves (includingplunger-

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 60/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 61/72

Intel’s Dark Horse-The 80960

A Pow e rfu l New C o ntro lle r for Pe rfo rm a nc e -C rit ic a l A p p lic a t io ns 

by Tom Cantrell

Like many here in Silicon Valley, I did time in thehallowed cubicles of Intel. In fact, some of you oldstersmay remember my “8088 Processor For The S-100 Bus”articles in BYTE.

The 80x86 family of processors has been good to Intel.Thereare those who would argue that thecompany shouldfocus on new additions to this particular series of chips,and not waste time in other areas. It’s to management’scredit that Intel has developed some new chips (undoubt-edly over the heated objections of the financial types in thecompany).

Let’s take a look at one of these: the Intel 80960. I don’tknow how much attention it will get compared to the80x86s and the new media darling 80860, but (perhaps asurprise for those of you who think I’m an incorrigiblecynic) in my opinion the 80960 is a darn neat chip!

A FRESH START

The 80960 is a high-performance 32-bit CPU targetedat embedded controller applications. Gone are the seg-ments; the chip features a linear 32-bit (Cgigabyte) ad-dress space. A block diagram of the ‘960 is shown inFigure 1.

Thankfully, the ‘960 doesn’t have any pretensions todesktop work. The purposeful control orientation of thechip, in this era of “retro-marketed” UNIX chips, is quiterefreshing.

Today, the ‘960 family consists of three members: the80960KA, KB, and MC. The first two are commercial

bad for introductory prices, though limiting the chips toapplications which really need performance at any price.Meanwhile, the MC goes for !$2400!

There is also a CA version in the works which shouldbe announced imminently. From what I can tell, it dis-penses with the floating point (like the KA) but deliverseven higher raw performance than the KA and KB thanksto internal architecture enhancements. Also, the current‘960s include reserved “Special Function Registers,” soperhaps we’ll see some “special functions” on the CA.

Even if you can’t justify a ‘960 in your latest controlproject, it’s worth taking a look at to see those features thatare deemed worthy by today’s chip architects.

Right off the bat a look at Figure 2, which shows the‘960 KB register set (the KA deletes the go-bit  floating-point registers), indicates this chip is definitely not off theold block. Gone are all those “special” registers (each withits own “unique” instructions) that have characterizedprevious Intel CPUs. Instead, the architecture has beengiven a good dose of laxative for regularity and consis-tency.

Make no mistake, the ‘960 isn’t a “single chip” like theg-bit controllers you’re used to. Besides no on-chip memory,thechipdoesn’tintegrateanyI/O(timers,UARTs,DMACs,etc.) either. Instead, Intel assumes (correctly, I think) thatfor the targeted high-end applications you can easily addcommodity outside memory and I/O ICs (Figure 3 showsa basic interface to outside I/O devices). The ‘960 siliconis purely dedicated to processing, which it does quicklyindeed.

products which differonly in the presence(KB) or lack of (KA)on-chip floating point.The MC is a militaryversion which featuresspecial architectural l-lsupport for Ada as wellas the typical militarytemp range and manu-facturingflow. TheKAis quoted at $174 andthe KB at $380 in 100-piece quantities-not Figure 1 -m e 8096OKE sp orts a h ig hly pa ral lel microa rc hi tec ture.

68  ClRCM7 CELLAR INK 

WHAT’S HOT ANDWHAT’S NOT

Much of the ‘960promotional literaturetalksaboutitsRISCheri-tage. If you read my“RISC vs. Reality” opin-ion in the first issue of CIRCWIT CELLAR INK, youknow where I stand onthe “ISC” wars: instruc-tion set complexity as a

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 62/72

00 0'GLOBAL

REGISTERS(i)

m

LOCALREGISTERSI

ARITHMETIC CONTROLS

piiF-1 INSTRUCTION POINTER

pit-32_BITSl

232- l i

PROCESS CONTROLS

TRACE CONTROLS

Flgure 2-  lhe 80960 register set is ric h w ith g ene ra l-purpo se reg is- 

ters a s w ell as floa ting-p oint re g isters.

technical issue is vastly overblown (it is a big marketingissue though).

Indeed, the ‘960 does exhibit many of those featureswhich characterize the RISCy approach including:

l Fixed-size(32-bit) instructions, many of whichexecute in few (1 or 2) clocks.

l Load-store architecture-instructions oper-

ate only on registers, not memory.. Lots of registers including four local “banks”to minimize memory references across sub-routine calls.

l A healthy instruction cache (512 bytes) tominimize the memory bottleneck whichchronically plagues RISC.

However, in other ways the ‘960 deviates from RISCideological purity (the reality part):

. More instructions and addressing modes than

considered fashionable by true RISC zealots.l Some of the complex instructions take many

clocks to execute and are implemented with(horrors!) microcode.

l It is possible to write’960 assembly language;the speed features are largely in hardwareand don’t require an optimal optimizingcompiler.

I find it interesting that the “R” word is used in somedocuments and carefully avoided in others. Instead, theinstruction set is characterized as “simplified” (SISC?) and

“versatile” (VISC?).If fiddling with the instruction set isn’t a big deal, what

are the true performance features of the ‘960?

Parallelism -On-chip, multiple functions can proceedin parallel including regular instruction execution (inte-ger unit), floating-point instruction execution (floating-point unit), bus access (bus interface unit), and branchprocessing (handled by the instruction decoder). Parallel-ism is the key to Intel’s claim that the ‘960 can theoreticallyone-up RISC by executing more than one instruction perclock!

Scoreboarding-Doing multiple things at the same timecan get confusing; it is important that the chip not getahead of itself (in computerese, a “hazard”). To this end,the ‘960 implementsa big-computer feature called register“scoreboarding.” The scoreboard keeps track of whichregisters have pending changes. For instance, when aregister load instruction is encountered, the targeted reg-ister is marked in the scoreboard. Now, the next instruc-tion execution can be started, even before the previousload completes, as long as this next instruction doesn’t usethe marked register. Of course, if the next instruction usesthe marked register, everything must “stall” until the loadcompletes. In general, the four functional units mentionedpreviously may proceed independently and completionorder can differ from the order of initiation. Where RISCrelies on the compiler to keep things straight, the ‘960 doesit in hardware.

Register Sets and Cache-All “few-clock-per-instruc-tion” (and more so “multiple-instruction-per-clock”)machines suffer from the memory bottleneck. The com-mon cry is “where can I get some cheap IO-ns DRAM S?”Until the memory folks deliver, the answer is to keepaccesses on-chip. The’960 takes a two-fold tack. First, lots

of on-chip registers increase the likelihood that importantdata can be kept at hand. Second, a 512-byte instructioncache is provided in the hope instructions can be foundthere, instead of in memory. Furthermore, the cachefeatures parallel load/decode. When a miss occurs, themissed instruction is loaded into the cache and sent to theinstruction decoder at the same time. Note that no datacache is provided, which is the simplest way to avoid the“cache coherency” problem associated with multiproces-sor designs.

Bus Bandwidth-A truism in the automotive world isthat there is “no substitute for cubic inches.” Sure you can

take a 2-liter engine and add turbos, valves, fuel injectors,and so on, but when the light turns green, give me a 454-c.i. V8 any day. Much the same goes for computers.Despite the registers and instruction cache (I remain to beconvinced that the latter will be well behaved in a multi-interrupt-driven application), it is imperative that a fastCPU be able to feed its voracious instruction/data appe-tite. So a simple metric, like cubic inches, is bus band-width-namely how fast and how wide. The ‘960 specswell on both accounts with 1620-MHz clocking of its 32-bit multiplexed address/data bus. Furthermore, it sup-ports’burst” transfers (a natural match for modem DRAMcolumn- and nibble-access modes) which boosts the ratefor sequential accesses to 50+ megabytes per second at 20MHz.

O c t o b e r / N o v em b e r 1 9 8 9 6 9  

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 63/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 64/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 65/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 66/72

SOFTWAREAlgorithms for by DESIGN

Trigonometric Functions -by Jack Ganssle

M ost real programs are forced to use floating-point numbers to handle high-precision data over a widerange. Even in embedded systems floating point is oftenneeded to convert raw data into some useful form. EdNisley discussed the difficult problem of converting fromfloating point to integers in Firmware Furnace in Cr~currCELLAR INK #lo. A complementary problem is imple-menting transcendental functions in floating point.

equations. In practice, often several steps can be reducedto one. Or, you can take advantage of the nature offloating-point numbers to reduce computation time.

C and other high-level languages usually include all ofthe standard math functions built-in to the library. How-ever, assembly language programmers, already saddledwith the tedium of generating detailed machine code,must also develop their own approximation algorithms.Sometimes C programmers face the same issue, particu-larly if they delete the math library to save space.

For example, whenever a value must be raised to aneven power (e.g., squared), increment the number’s expo-nent digit. With most floating-point formats, adding oneto the exponent digit doubles the value; it is equivalent toshifting the value left one bit. Similarly, don’t compute thesame value repeatedly; do it once and use it as required.Finally, neUer compute a constant; if you need n/2, pre-compute the constant’s value and build it into the code asa fixed constant.

THE TANGENT

The very nature of trig functions implies that no exact The tangent is almost always computed using thesolutions can exist in a digital computer. All trig routines relation fan(u )=s in (a ) /cos(a) . The  sin and cos functions areuse some sort of approximation to solve for an input value. described later.

Hundreds of different algorithms exist. Each involvesa tradeoff between precision and computation time. Tofurther complicate matters, many algorithms are designedonly for limited ranges of input data; calling the functionwith a value outside of the range will often give wildlyinaccurate results.

How do you decide which algorithm to use? If youknow the data will be confined to a small range, you caneasily optimize the algorithm to cope with that data. Or, ifspeed is not an issue but precision is, then slow but preciseroutines can be employed. No one compromise is ideal forall applications. The algorithms I’ll present represent a

fair tradeoff for many applications. Note that some ma-chines have hardware support for parts of some of thesefunctions (e.g., the 8087); with careful planning you canpartition the problem in such a fashion that the hardwarehandles what it can, and the software takes up the slack.

*If the input argument is X and the result A:

STEK'l: IF X-CO THEN BEGINX=absolute value of XCALL STEP2CALL STEP3CALL STEP4RETURN-A

(since ATAN(-ATAN(

ST!ZPZ: IF x>l THEN BEGINX-l/XCALL STEP3cALLSTEP

RETURN -A+pi/2(since ATAN(X)=l'c/2-ATAN(l/:

Most transcendental functions are based on some sortof series expansion. The obvious choice is the Taylorseries, but in practice it converges to useful answers muchtoo slowly. Many other series can be used, but the mostcommon is the Chebyshev.

STEP3: IF )(>TAN(pi/12) THEN BEGINX-(X * SQRT(3) - l)/

(SQRT(3) + X1CALL STEP4A-A + pi/6

These algorithms are shown in a “pseudo language”so they can easily be implemented in any computer dialect.

They’ll work with any floating-point format.You can simplify these algorithms quite a bit. For

clarity’s sake they’re shown decomposed as a series of

STEP4: Tl= 0.99999999971301T2= -0.3333331319373T3= 0.199977320113T4= -0.14195746243T5= 0.963034789A = X * (Tl + T2*X**2 +

T3*X**4  + T4*X**6 + T5*X**8)

RETURN

Figure 1 -An arc tangent rout ine.

October /November 1989  73 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 67/72

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 68/72

CONNECTIME Excerpts from t he Circui t Cel l ar BBS 

THE CIRCUIT CELLAR BBS300/l 200/2400 bps

24 hours/7 days a week87 1-1988 - 4 incoming linesVernon, Connecticut

In this installment of  ConnecTime, we’ll deal with keypad,telephone line, and motor control interfacing. But first,proper power supply decoupling is crucial in any TTLcircuit for reliable operation. Placement of  bypass capuci-tors can be tricky at best, especially on multilayer boards,as we find out in the first discussion.

Msg#:22565From: BOB PADDOCK To: ALL USERS

I hope you can give me a definitive answer to a question about theproper way to connect decoupling capacitors on a multilayer PCboard.

Let’s say my circuit is a 74AC273 and 0.33pF decoupling cap ona four-layer PCB (two layers for signals, one layer for ground, onelayer for Vcc).

Each output of the 273 can sink or source 24 mA, so if all eightoutputs change state while fully loaded, we have a current ofabout 200 mA for ground and Vcc. (For this discussion, we’llassume the part isn’t going to melt from exceeding its packagedissipation rating.)

There are several ways that the 273 and 0.33pF cap can beconnected to Vcc and ground:

1) Connect the pins of the 273 to the interlayers (GND & Vcc) atthe pins of the 273. Connect the cap to the interlayers. There areno traces between the 273 pins and the cap, just the interlayerconnection.

According to Intel appnote AP-125 “Designing MicrocontrollerSystems for Electrically Noisy Environments,” the 273 currentswill take the shortest path to the highest nearby voltage source(the cap, hopefully). This way takes up the least PCB area (youdon’t need traces between the 273 and the cap).

2) Connect the pins of the 273 to the interlayers at the pins of the273. Run traces from the cap to the 273 pins. We now haveinductance between the cap and the 273.

3) Connect the cap to the interlayers. Run leads from the 273 tothe cap. Inductance between the cap and the 273.

4) Connect both parts to the interlayers and run traces betweenthe parts. Seems redundant, and you have parallel inductance.

Conducted by Ken Davidson

The message base of the Circuit Cellar BBS in now availableon disk. See page 78 for details.

RCA appnote “Printed Circuit Board Design Using AC/ACTLogic Devices” has this to say:

“DO NOT decouple the Vcc and ground plane by tying Cd[decoupling cap] between planes near an IC.

“DO connect Cd leads right at the IC Vcc and ground terminals.

Preferred placement of the decoupling cap is diagonal to the Vccand ground pin-under the IC or on the bottom of the PCB. [Easy

to say, tough to do.]

“For surface mount, AVOID extra inductance of through-boardconnections to Cd. It should be remembered that an ampere ormore of high-frequency transient current courses between Vcc/GND pins and the Cd body. [We’re not using surface mountparts on this project, but we still have the current transients.]”

They don’t say at what point to connect to the interlayers (at thecap or at the 273). Probably should do as case 2 above.

It seems that Intel and RCA disagree on how to hook up adecoupling cap. I feel that what RCA says makes the most senses,but on a very tight PCB using case 1 above makes layout so mucheasier.

So what do you think is the right thing to do?

Msg#:22614From: ED NISLEY To: BOB PADDOCK

Well, the point of having separate power and ground planes is toreduce the inductance between the power supply point and the

ICs. By increasing the copper area you reduce the inductance,and by having two parallel planes you increase the distributedcapacitance. Decoupling capacitors should be relatively small(100 nF or so), have good high-frequency characteristics, and bedistributed relatively evenly over the board.

If you have a good power and ground plane setup, the caps canbe located physically near the ICs, but connected directly to theplanes. The transient currents will come from the distributedcapacitance through the planes, which will have much lowerinductance than traces connecting the ICs and caps. Because thecaps are associated with the planes rather than the ICs, you don’tneed redundant traces connecting them.

Putting a ferrite bead at the point where the power supply entersthe board, with a IO-PF tantalum cap just inboard of that, reduces

October/November 1989 75

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 69/72

the hash crossing theboard connector through the power supply.The remaining caps on the board are all relatively small decou-pling caps spread evenly over the area: The rule of thumb is onecap per IC; although you can reduce that somewhat for SSI gates,you should not scrimp around bus drivers!

I’m not sure what difference surface mounting makes; the induc-tance of the vias is probably less than the inductance of the PCtraces or the leads on standard caps. In any event, more smallercaps will give better results than fewer bigger ones simplybecause they’ll improve the distributed capacitance.

Measuring the actual power supply noise is an art unto itself; youneed good equipment and impeccable techniques. A friend ofmine found this out the hard way when he was measuringswitching power supply noise: he had to build a special fixture toget the scope probe and ground connections to the right pointswithout the inductance of ordinary leads!

Real-time controllers often require some form of  operator input, and a keypad is a popular choice for the user interface. The complexity of  the circuit used to interfacethe keypad depends heavily on what else the controller isdoing, as the next conversation shows.

Msg#:21846From: ROBERT BARBAGALLO To: JEFF BACHIOCHI

I am in the process of building an analog multiplexer for alighting control system using the 8051.  I have written and tested

both input and output routines and they work great. Where I’mhaving trouble is with the keyboard routine. I would like to use4x 4matrix keyboard to cut costs, but I am unwilling to debouncein software, so I chose the MC14419 to take care of the problem.The soft problem is that the multiplexer can accept an input from1 to 192 (decimal) which reflects dimmer output number, andfrom 1 to 96 (decimal) which reflects input channel number.There is also a clear key and an enter key. When I read thekeyboard port, it is in BCD and I can’t figure out how to separateall this. I’ve never done any keyboard routines; could you adviseme on a good book or some sample listings that may help me.

Msg#:21876From: JEFF BACHIOCHI To: ROBERT BARBAGALLO

If you haven’t already seen Ed’s Firmware Furnace from the January/February 1988 (#l) issue of Circuit Cellar INK, shameon you. There, Ed explains the task of using minimal hardware(74LS240) for keypad-type input. It is a polled system with nohardware debounce. This design was used in the Infrared MasterController (“Ciarcia’s Circuit Cellar,” BYTE, February 1987).

If you want to use the Motorola device, it is simple to use. A four-

by-four cross-matrix l-of-16 input gives BCD output and strobe(needs a clock-80 kHz max.). An interrupt upon strobe routine

could read the outputs which, if the high four bits were tied low(DPD7) on, say, port 1 of your 8051, would read decimal O-9.Note that the keys A-Fdo not produce a strobe. They do produce

76 ClRCUl7 CELLAR INK 

an output, but contact bounce can exist on the output whichwould normally be cleaned by the strobe. Since you are in controlof what “legal” input looks like, set up some rules.

For example, dictate that input will consist of three numericdigits (O-9,0-9,0-9) followed by a mode digit (A-F). Each digitentry will cause a strobe. Take the first digit times 100, add thesecond digit times 10, and add the third. Now look for a modedigit (A-E) by polling. Determine the function and whether ornot the value is legal.

If you must, you can use only decimal digits; the first or last digitcould indicate the mode (level, channel, clear).

Other alternatives are available. Check out the 74C922

fINS8242N), HD100165, or cascading two 74LS148s fall are avail-able from Jameco and others). The MC14490 (six debouncers)could be used to debounce a 4 x 4 matrix on port 1 which is splitinto four output bits and four input bits (similar to Ed’s circuit).Whatever you choose, it will depend on the rest of your program.If the controller is not doing much more than responding tokeyboard input, you can get away with less expensive hardware.Otherwise you may need to forego polling and use a strobedinterrupt routine.

Projects which need to connect to the telephone networkare always popular, but special precautions must be takenbefore they can be legally connected to the nearest phone

 jack. The next message thread deals with whether a DAA(Data Access Arrangement) is the best way to handle those

 precautions.

Msg#:21313From: EDWARD ARCHIBALD To: ALL USERS

I’m building a project which is essentially an 8031-based phoneanswering machine. I have completed all of the basic hardwareand firmware and am currently using a device that is manufac-tured by Cermetek (CH1813) which provides a DAA for mydevice. It also provides ring detect, off-hook detect, audiocoupling to the phone line, and a means for forcing the line off-hook and on-hook using a TTL-level signal. However, this thing

is expensive and there are number of other things that I wouldlike to do. I don’t really have the experience to know how toproceed. Any tips on these things would be appreciated. Also,any tips that indicate the reasons why any of these things couldnot be done, or would be expensive to do, would be very useful.

Are there any books available whose subject is exclusively tele-phone electronics and includes sample circuits?

1) First off, I would like to duplicate the functions that theCermetek device provides at a lower cost (< $26.00)

2) Let’s say that I have a telephone hooked up to my phone

answering device that has a ringer that cannot be turned off. Howcan I inhibit ringing on this phone while still being able to detectthings like the phone going off-hook? I would like to be able to

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 70/72

control this with the microprocessor so ideally a good answerwould include a TTL-level interface.

Msg#:21328From: KEN DAVIDSON To: EDWARD ARCHIBALD

3) I would like to be able to use the DTMF keypad of a phone that A $26 DAA is already cheap. Just a few years ago you’d haveis connected to my device without causing the phone switching been hard pressed to find any for under $100. As Nathan said,equipment to take notice. Is this possible? Maybe there is a you could probably build one for less as far as parts go, but dosequence of tones that can be dialed to disable further interpreta- you really want to spend a few thousand dollars to get it certifiedtion? so it is legal?

4) How can I detect that a calling party has hung up before thetelco finally disables the connection? How about when the telcofinally drops the connection?

5) Let‘s say that I have two phone-type devices hooked to mydevice. I would like to be able to discriminate which of the twodevices has gone off-hook.

Radio Shack sells (sold?) a book called “Understanding Tele-phone Electronics” that provides a good introduction to mosttelephone basics. There aren’t specific examples in terms ofcircuits, though, and not many of the questions you pose areanswered.

Msg#:21446From: EDWARD ARCHIBALD To: KEN DAVIDSON

Msg#:21321From: NATHAN ENGLE To: EDWARD ARCHIBALD

I’m sure that there are some books about the telephone network,but since I work at AT&T I usually find it easier to just picksomebody’s brain. The parts required for a phone line interfaceare cheap: just a transformer, a switch-hook relay, some zenerdiodes, and various resistors and caps.

$26.00 is cheap for a DAA? That’s good information. I wonderwhat the folks who build answering machines that retail for$50.00 do? I don’t think my wife is going to like this, but ouranswering machine is about to become a volunteer for the sakeof science.

Msg#:21452The big cost in building it yourself is that you’ll have to registeryour device with the FCC (as per Part 68 of the FCC regs). Thereare a LOT of restrictions on what sorts of things you’re allowed todo: maximum amounts of current you’re allowed to pull, maxi-mum signal levels you’re allowed to produce, minimum on-hookimpedance, and so on.

From: KEN DAVIDSON To: EDWARD ARCHIBALD

To tell if someone on your circuit is off-hookyou

can use a sort ofcomparator setup. Line voltage difference is about 50V betweentip and ring when you’re on-hook, but when someone goes off-hook the line voltage drops down to about 6V.

The guys who make cheap phones design the circuit and have ittested once at a cost of a few thousand dollars. Then they makeseveral hundred thousand units, and thecost amortized over theentire production run becomes a few cents per unit. DAAs areproduced in much lower quantities and have more features than

a typical CO interface in a phone will have, so they are moreexpensive.

Msg#:21457You can hang additional phones in parallel on a phone line so thatmore than one person can listen and speak, but there’s a definitelimit tothenumberthatyoucandobecausetheextrasetswilltendto distort the signal a little bit.

From: NATHAN ENGLE To: EDWARD ARCHIBALD

I can get an address for you, but I really can’t recommend divinginto Part 68 as an intro to telephony. It’s a little dry.

Individually your questions don’t ask for much, but taken as awhole I think it could get complicated, especially the FCC stuff.They’re in the process of “simplifying” the FCC regulations again

and nobody really knows 100% of how everything is going tosettle down. There’s going to be a five-year grace period duringwhich everyone is supposed to learn the new regulations (includ-ing the FCC people who will have to enforce them); I know thatour department is intentionally waiting to let the dust settlebefore we try to get new approvals on any of our products.

Ken’s right about DAA modules at $26 per; they’re not reallymeant for something you plan to make a million of. If you’vereally got something that big up your sleeve then it would be well

worth your while to design and register yourself. However, forprojects of the sort that 99% of experimenters do, $26 is a veryreasonable price.

Msg#:21445

One alternative to chopping up an answering machine would beto use one of those cheap0 import phones. They have similarelectronics as far as the phone line is concerned, they cost a lotless than answering machines, and cutting them up is purepleasure (I hate those phones). :-)

From: EDWARD ARCHIBALD To: NATHAN ENGLE

Thanks for the info. Now is the time that I wish I knew someonewhose brain I could pick for the answers to these questions. By the

way, do you know where I can find the details of the Part 68 regs?This is beginning to sound like it is significantly out of my league,but I could probably learn a whole lot by trying.

Msg#:21593From: DAVID LAWSON To: EDWARD ARCHIBALD

If you need, I’ve done several phone systems and did telephoneinterfacesfromverycheap($7)  toveryexpensive($lOO).  I’vealso

October/November 1980 77

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 71/72

 been present at the Part 68 testing and know what they werelooking for two years ago, so I might be of some help.

I haven’t found a good way to monitor the line to see if someone picks up a phone locally. On detecting when someone hangs upremotely (the called party) most COs (I think; at least mine does)will reverse the line polarity momentarily when the calling partyhangs up. The way I sense for remote hangup is my CO willreassert dial tone 10 seconds after the remote party hangs up. Ialso have a fail safe that will disconnect me after 60 seconds. Myunit won’t stay on-line long because it doesn’t have a lot to say;it just calls a paging transmitter.

Msg#:21769From: EDWARD ARCHIBALD To: DAVID LAWSON

Thanks for the reply Dave. Since I posted, I’ve run across a fewschematics for phone interfaces, and they look pretty compli-cated to my novice eyes. The main characteristic in all of them isthe use of optoisolators. Anyway, thanks again.

enough. I am going to need about a thousand of thesecontrollers,and anything much more than $1.50 (per motor) for the compo-nents would break the bank. Finally, I don’t mind ganging upthese controllers to provide, say, eight controllers on one board.This may allow the use of 8-wide parts such as drivers, resistor  packs, etc.

Msg#:22254From: STEVE CIARCIA To: WILSON SNYDER 

Optoisolators usually aren’t good for powering loads directly.Take your isolator outputs and drive a couple pass transistorsand it will probably work.

A neater solution is to use a power op-amp like the SpragueUNL3751 Z. Such anop-amp has a3.5-amp output current at 28V.Simply apply the drive voltages (514V unless we add externalcomponents to allow +_2OV) to the op-amp and run it like a logiccomparator or amplifier. Negative voltage in, +14V out; positivein, -14V out; or OV in, OV out. These chips cost about $1.50 inhundreds. Contact a Sprague distributor and request samples.

OUY last interfacing discussion deals with the best method for controlling motors used for track switching in modelrailroads.

Msg#:22159From: WILSON SNYDER To: STEVE CIARCIA

I am looking for a suggestion on driving switch-machine motors

for a college model railroad. These 30-mA motors select which of two tracks are routed to a third. Theinput of this circuit needs to be two digital lines: one to drive the motor forward and one todrive reverse (active low). Protection is not needed to prevent

 both from being low at once, with the exception of a couple of nanoseconds when the signals are switching. The other input isa 18VAC wire to power the motor (I usediodes to derive plus andminus voltages). Also, 5V is available. The output is a singlewire: a positive voltage to turn the motor one way, a negativevoltage for the other, and open to throw neither way. This outputdrives the motor (the other side of it is grounded), and a nonpo-larized lOOO+F cap across the motor.

I tried an opto-Darlington, the NEC 2502-4, but it dies most likelydue to the capacitor in-rush current (resistor limit it?). The circuitI tried is:

N E C 2 5 0 2 - 2

REV\*

M o t o r  

330QFWD\+ I_

1000uF

A nice design might use one of the Signetics power drivers, butone of the big problems I have had is getting a design that is cheap

The Circuit Cellar BBS runs on a IO-MHz MicromintOEM-286 IBM PC/AT-compatible computer using themultiline version of The Bread Board System (TBBS2.lM) and currently has four modems connected. Weinvite you to call and exchange ideas with other CircuitCellar readers. It is available 24 hours a day and can bereachedat (203) 871-1988. Set your modem f or 8 data bits,1 stop bit, and either 300,1200,  OY 2400 bps.

IRS231 Very Useful232 Moderately Useful233 Not Useful

____--

SOFTWARE and BBS AVAILABLE on DISK

Software on Disk

Software for the articles in this issue of Circuit Cellar INK may be downloaded freeof charge from the Circuit Cellar BBS. For those unable to download files, they arealso available on one 360K, 5.25” IBM PC-format disk for only $12.

Circuit Cellar BBSon DiskEvery month, hundreds of information-filled messages are posted on the CircuitCellar BBS by people from all walks of life. For those who can’t log on as often asthey’d like, the text of the public message areas is available on disk in two-monthinstallments. Each installment comes on three 360K, 5.25” IBM PC-format disksand costs just $15. The installment for this issue of INK (October/November 1989)includes all puMic messages posted during July and August, 1989.

To order either Software on Disk or Circuit Cellar BBS on Disk, send check or money order to:

Circuit Cellar  INK - Software (or BBS) on Disk

P.O. Box 772, Vernon, CT 06066

or use your MasterCard or Visa and call (203) 875-2199. Be sure to specify theissue number of each disk you order.

78 C/RCU/l- CELLAR INK 

7/16/2019 Circuit.cellar.011.Oct Nov.1989

http://slidepdf.com/reader/full/circuitcellar011oct-nov1989 72/72

STEVE’S OWN ’ N K

Those Dazzling 32-Bit Chips

ave you ever looked into a car mirror and seen the sun? If you’re like most people, you’ll snatch yourgaze elsewhere, but not before being dazzled. At first, the intense white light overwhelms anything else inyour vision. For long minutes after, everything you see has the image of the sun burned into it. Even if you

close your eyes, the amazing brilliance is projected on the back of your eyelids.When I listen to engineers talk about the glories of 32-bit processors and controllers, I think about beingdazzled. It seems like everyone who looks at these fast new computational wonders sees them wherever theylook for months afterward. Even worse, some of them seem to have been temporarily blinded to commonsense by the brilliance of what they’ve beheld. I’ll be the last person you hear saying that we need to returnto the “basics” of the 4004, but I will say that shoe-horning a fire-breathing, muscle-bound super-processorinto every project that comes along is a short-cut to sloppy engineering.

The trouble is not so much the 32-bit processors and controllers themselves, but with the attitude of manyof the engineers who turn to them on a routine basis. When you’re working with machine intelligence thatmakes the “hard stuff” easy, it’s tempting to turn to the same solution over and over again. Most of the new-generation 32-bit processors will let you get away with it because they just do so much. Of course, in mostof the applications that come along most of the capabilities of the processor will be wasted, but this is dazzling

technology. The picture of the hot new processor shows up on every new project that comes along. If youbelieve enough of the press releases you read concerning the processor, before long you’ve startedsubstituting sheer power for thoughtful, professional design work.

I guess, when you get right down to it, this is my biggest problem with the biggest microprocessors andmicrocontrollers. I’ve always felt that the design is more important than the hardware. Getting inside aproblem, understanding all the alternatives, and then deciding on the best approach for a solution get meexcited. By the time theactual hardwarerollsout, it’salmost (and onlyalmost)an anticlimax. I know that thereare situations which demand narrow constraints on your final design. I just see a huge difference betweenworking with limits placed by clients, supervisors, or existing conditions, and limits established by anengineer’s personal set of blinders. One set adds to the challenge (and sometimes, the fun) of engineering;the other will lead inevitably to inflexibility, mediocrity and, worst of all, boredom.

Thirty-two-bit microcontrollers have their place. If I were designing the control system for a commercial

nuclear reactor or an advanced avionics system, I would probably go with 32 bits as the minimum acceptablesystem. If, on the other hand, I’m working on distributed building control or industrial data acquisition, myexperience tells me that 8 bits is the place to start looking for reliable, cost-effective solutions. I really don’tcare how powerful the new generation processors and controllers are: The one between my ears blows themall away and it’s the one I’ll rely on to provide the best solutions to application problems