80
8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991 http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 1/80

Circuit.cellar.018.Dec.1990 Jan.1991

Embed Size (px)

Citation preview

Page 1: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 1/80

Page 2: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 2/80

  EDITOR’S

I’ve Seen the Future INK Curtis Fran klin, Jr. 

I recently  led a panel discussion at the Embedded SystemsProgramming Conference. I met interesting people, arranged for a few articles, and ran into lots of folks who were carrying crystalballs in their fanny packs. I thought you might like to know whatthey say you’re going to be doing in the next few years...

OPERATING SYSTEMS

 You’re going to be using an operating system. I’m not talkingabout the operating system on your desktop computer, but thecomplete multitasking operating system that you’ll be buildinginto each and every control project. Depending on who you talk to, you’ll be using an MS-DOS variant, a UNIX variant, or aspecialized embedded 0s  for your development. All of these willmake your life easier, your software more powerful, and your breath fresher. They may be right, but I’m not fully convinced.

First, an operating system assumes that you can accept ahefty chunk of overhead in your software. Anyone who’s stillforcing their code into 8K EPROMs will be in special trouble, butthere will be more about that a little farther down the page. Mostfolks at the show weren’t worried about memory constraint, andthey weren’t terribly worried about the cost the OS adds to theproject. I’ve seen prices ranging from $99 for Coherent (a UNIX-

like OS) to 3,000+  for some of the specialized embedded prod-ucts. It’s a different type of overhead, but substantial overheadincrease all the same. Finally, an operating system adds another level of complexity to any debugging exercise. You can’t justworry about how your software is interacting with the hardware,you have to consider how the passions in the hardware-OS-application software triangle are affecting one another. The timeinvolved is still more overhead that must be absorbed by theproject. All of this overhead is starting to add up, unless you’rewriting a truly large application.

LARGE APPLICATIONS

 Youknow the 8K EPROM I mentioned in the last section?Well you can forget putting code into it. You’re going to bewriting embedded software that needs 500,000-l,OOO,OOO  lines of code. Stop for a moment and let that sink in.

Are you still with me? If you’re going to spend the time,money, and effort to develop a million lines of embedded code,the overhead of an operating system gets lost in the backgroundnoise. Furthermore, I’m willing to say that, if you have a million-line program, you need an operating system to support your code. You also need a high-level language, heavy-duty libraries

and support programs, and a debugger that will work with youin a most intimate fashion. Oh yes, you also need a processor thatwill let you get to that much code.

32-BIT PROCESSORS

There weren’t many people talking about 8-bit  processors atthe show. Intel mentioned the 8051, saying that they have nowshipped over 100,000,000   of them, but that came as a passingstatement at their press conference announcing the latest mem-

 bers of the 80960 family. Motorola was ready and willing to talk about 68030 and 88000 applications, National was discussing the32000, and everyone was announcing the arrival of the 32-bitfuture. Once in a while I heard talk about 16-bit  chips like the80186 and 8096, but there was a noticeable absence of discussionon anything having to do with 8-bit applications.

All of the predictions I’ve talked about are fine and probablytrue if you are involved in building avionics for the B-2 or automating a nuclear power plant. If, on the other hand, you’reworking on building automation, data logging, or day-today

 process control, 32-bit processors and million-line applicationsrunning under UNIX may be a bit of overkill.

CIRCUIT CELLAR INK 

So what are we going to do? We’re going to renew our commitment to 8-and 16-bit  applications, with a special empha-sis on stretching the limits of the possible with 8-bit processors.There are new g-bit  processors coming onto the market, and wewill let you know about them. If you need more power, there isalot of activity in 16-bit processors, and we’ll keep you up-todatethere. Operating systems will play a part in both 8- and 16-bit

applications, as will high-level languages, so we’ll look at how both can affect the project you work on. Finally, we’ll remember that one of the reasons most of you read C IRCUIT CELLAR INK isthat we take “the road less traveled” in our approach to applica-tions. We’re going to be going a little farther down those less-traveled paths in upcoming issues.

A NOTE

Scott Ladd’s “Practical Algorithms” is taking a one-issue va-cation. It will be back in CIRCUIT CELLAR INK 19.

December ‘90/January  ‘9 1

Page 3: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 3/80

FOUNDER/EDITORIAL DIRECTORSteve Ciarcia

PUBLISHERDaniel Rodrigues

EDITOR-in-CHIEFCurtis Franklin, Jr.

MANAGINGEDITOR

Ken Da vid son 

PUBLISHINGCONSULTANTJohn Haye s 

ENGINEERING STAFFJeff Ba c h / o & i

Edward Nisley

CONTRIBUTINGEDITORSThom a s Cantre l l

C hristo p he r C ia rcia 

NEW PRODUCTSEDITORHarv We ine r 

CONSULTINGEDITORSMa rk Dahmke 

La rry Loe b 

CIRCULATIONCOORDINATORRose Manse/la 

CIRCULATIONCONSULTANTGregory Sp iizfud e n

ART PRODUCTIONDIRECTORTric ia  Dzie d zinski

PRODUCTIONARTIST/ILLUSTRATORLisa Fe rry 

BUSINESSMANAGERJeanne t te Walters 

ADVERTISING

COORDINATORDa n Gorsky 

STAFF RESEARCHERS

Northeast

Eric A lbe r f

William Cu f / ew

Richard Sawyer 

Robert Stek

Midwest

Jon E/ son

7im  M c D o n o u g h

West Coast

Frank Kuec hmannMark Voorhees 

Cover Illustration

by Robert Tinney

THE COMPUTER APPLICATIONSJOURNAL

 12

  ONDI-The  ON-Line Device Interface, Part 2Softw a re fo r Rem ote PC C on trol 

by John Dybow ski 

A complete computer remote-control system wraps up with a look atthe software for remote control, operation, and display.

 18 Principles of PC-based Data Acquisition andControl Systems

by Chris Ciarc ia 

Writing control software can’t start until you understand the problems.A lesson in control theory can save you hours in wasted design time.

An Interface for Portable Battery-Backed RAUsing the M itsub ishi BEE Ca rd fo r Non - volat i le Da ta Storag e byTim McDonough  Bruc e Webb 

“Credit card” memory offers non-volatile storage in a portable package.

Interfac ing to Mitsubishi’s versioncouldn’t be simpler,

A Ve nerab le History and a 

Certain Future by Steve Ciarc ia Burt Brow n 

Motorola’s 68HC ll  is a powerful 8-bitprocessor. It’s a perfect choice for acompact controller.

Designing with Flash MemoryIs The re a New Alterna tive to EEPROM a nd SRAM ? 

b y Markus A . Lev y 

Flash memory is the lat

nonvolatile storage.A PC-bus design illus-trates techniques forinterfacing and

programming.

2    C lRC UlT CELLAR NK

Page 4: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 4/80

clEditor’s INK 

1 I ’ve Seen the Future

b y C urtis Fran klin, Jr.

 The times are a’changing...and  so is our industry. A recent industryconference provided a (murky) crystal ball for your editor.

141Reader’s INK-Letters to the Editor

81MWroductNews

1

7Firmware Furnace

6 1ANSI Controls and Fixed PointsThe Furnac e Firmwa re Projec t Co ntinue s 

by Ed Nisley The fine points of getting the right results and showing them to theuser are the heart of this installment.

clFrom the Bench

71 Magnetic Levitation: An Example in Closed-Loop ControlHow to De fy Gra vity Without the Use of Black Magicby Jett Bach ioch i

Closing the loop with a floating ball can teach you a lot about howa control system works.

Silicon UpdateGoodbye CRT, Hello LCDby Tom Cantrel l

New LCD devices and controllers make LCD a more viable choicethan ever before for demanding display applications.

ConnecTime-Excerpts  from the C ircuit Cellar BBSConduc ted b y Ken Dav idson 

Steve’s Own INK The Whole Jobby Steve Ciarc ta

Engineering doesn’t end when the solder cools. Steve talks aboutthe rest of the job.

Advertiser’s Index

Circuit C ellar BBS-24 Hrs.

300/l 200/2400  bps, 8 bits, no

parity, 1 stop bit, (203) 871.

1988.

 The schematics provided

in Circuit Cellar INK are

drawn using Schema from

Omation Inc. All programs

and schematics in Circuit

Cellar INK have been care-fully reviewed to ensure that

their performanc e is in ac-

cordance with the specifi-

cations described, and pro-

gramsarepostedon theCir-

cuit   Cellar BBS for elec tronic

transfer by subscribers.

Circuit Cellar INK makes

no wa rranties and assumesno responsibility or liability of 

any kind for errors in these

programs or schematics or

for the consequences of any

such errors Furthermore, be-

cause of the possible vari-

ation in the quality and con-ditionof materialsand  work-

manship of reader-as-

sembled projec ts, Circuit

Cellar INK disclaims any re-

sponsiblity for the s e  and

proper function of reoder-

assembled projects based

upon or from plans, descrip-

tions, or information pub

lished   in C ircuit Cellar INK.

CIRCUITCELLAR INK (ISSN

08968985) is published bi-

monthly by C ircuit Cellar In-

corporated, 4 Park Street,

Suite 20, Vernon, CT 06066(203) 875-2751. Second-

class postage paid at Ver-

non, CT and additional of-

fices. One-year (6  issues)

subscription rate U.S.A. and

passessionsS14.95.Canoda/

Mexico S17.95. all  other

countries $26.95 (surfac e),

$38.95 (air). All subscription

orders payable in U.S. funds

only, via international postal

money order or check

drawn on U.S. bank. Direct

subscription orders to C ircuit

CellarINK.Suhcn’piions.P.0.

Box 3050-C. Southeastern,PA 19398 or call (215) 630-

1914.

POSTMASTER: Please

sendaddresschangestocir-

cuit  Cellar INK, Circulation

Dept.. P.O. Box 3050-C.

Southeastern, PA 19398.

Entire contents copyright

0 1990 by Circuit Cellar In-

corporated. All rights re-

served. Repfoductionofthis

publication in whole or in

partwithoutwrittenconsent

from C ircuit Cellar Inc. is

prohibited.

Decembe r ‘ 9 0 / J anua r y  ‘ 9 3 

Page 5: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 5/80

READER’SINK 

1Letters to the Editor

MILDEW REDUX

I wrote to you last year concerning the problem ofmildew attacking diskettes which have been stored for sixmonths or more in a tropical climate without air-condi-tioning. In your published reply (CIRCIJ~  CELLAR INK ll),

you could not offer a remedy but asked that we write back

if we found a solution. Well, it does seem that we havesolved the problem since nearly a year has passed and wehave not had a recurrence. The solution found was neitherthe use of desiccators nor of fungicides but the use of acupboard kept a few degrees above room temperature.This remedy was suggested by a friend who said it wasused by photographers to store stocks of film and keepthem freeof  mildew. It seems to work for diskettes as well,with no bad sideeffects. Thecupboard is warmed by a bulbof about 10 W (I use either a 60-W 240-V bulb at 120 V ortwo 25-W bulbs in series as I could not get a 10-W bulb).

I suspect that others living in humid climates mayhave this problembut without recognizing it. If you exam-ine the surface of your disks (especially back-up copies) inreflected light, mildew appears as light blotches-it isdifficult to see otherwise. Frequent use keeps it at bay forsome time, but may eventually lead to disk errors. Con-tinuous air-conditioning no doubt also prevents mildew.

Andrew ManceyGuyana, South America

BACK TO THECOMEFROM

The article by J. Conrad Hubert entitled “Implement-ing a ComeFrom  Statement” (CIRCUIT CELLAR INK 15)brought back memories of a project I led in 1980 to developa microcomputerized controller for the paging system atLambert  St. Louis International Airport. We wanted totrigger the interrupts of a 6502 microprocessor (part of anAIM-65 board) from a sanity timer to restart the system incase the processor got off track and wasn’t executingproperly. We had the same problem: Once we got the

microprocessor’s attention, how would we get it to go backto restart instead of back to where it left off when theinterrupt occurred, without causing stack problems? The

4   ClRCLJlT  CELLAR INK

only logical thing to do was to modify the return addresson the stack.

This method, while very practical, would probably befrowned upon by those adhering to strict structural tech-niques, especially those who develop software for militaryapplications (per standards like DOD-STD-2167). How-ever, if it is viewed as a form of exception handling, then it

would probably be considered “respectable.”I’m not sure, however, that this method helps “dis-

cover where your code has been,” as your subtitle to thearticle suggests, but rather, it “changes where your code isgoing to.”

Kenneth J. CiszewskiOverland, MO

LEG0 CONTROL

I’d like to comment on the letter “Keep those LegosMoving” in CIRCUIT CELLAR INK 16.   The little motor drivercircuit that was described is essentially available as Spra-gue UDN-2952B or UDN-2952W full-wave bridge motordrivers. They are available from Circuit Specialists, Mesa,Arizona. They are capable of 3.5 A of output current andfeature thermal protection. They require a 5-V and a motorpower supply. Typically, the control signals are a DIREC-TION and a NOT ENABLE line. The use of a NOT EN-ABLE line prevents the motors from running when the

control lines are disconnected. Remember that TTL inputsfloat high. It isalso  possible to drive the NOT ENABLE linewith a PWM signal to allow speed/torque independence.

I have successfully used these to control some smallDC motors. DC motors have an overrun problem whenstopped. In order to minimize this, I added a relay andsome logic which would short the motor winding whenstopped. This provides very quick dynamic breaking. Themotor is acting as a generator into a short circuit andtherefore stops rather rapidly.

Ron Dozier

Wilmington, DE

Page 6: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 6/80

ON ANOTHER LEVEL

I have been “into computing” for quite a few yearsnow: My first computer job was in 1957, preparing data forthe IBM computer operated by Hughes Tool in Houston. Iworked on mainframes (IBM 7094s,  36Os, 37Os,  and

 for several years, while wanting a computer ofmy own. I finally managed to “graduate” to micros in 1981

when my boss got me an Apple II+ (at last, a computer of“my own”).

I have been mostly a software person for many years(application and systems programmer and systems ana-lyst, currently teaching programming at a communitycollege), but I have occasionally messed around with elec-tronics (yes, I know my way around a soldering iron&mycall sign is KA7PHM.

I subscribed to CIRCUT  CELLAR INK because I hoped tofind a place that would give some tutorials on computercircuit design-such as how to go about putting togethera computer “from scratch”-you know, what chips are

needed, what ones go together, what the significance ofmicroprocessor timing diagrams is, how to interface tomemory (and get the RAS and CAS signals timed right),and so forth. In short, I need help to get me going (withsome assurance) in hardware.

What I have in mind is to learn enough to try to designa microcomputer I have wanted to build for several yearsnow, so I can try my hand at writing the system softwarefor it, and.. .(the  stuff dreams are made of, you know!)

It would be nice to get some help. Of course, for you torun “tutorials” might alienate some of your other subscrib-ers for the same reason I have gotten tired of some of theother computer magazines that seemed to run yet another“Getting started in BASIC” (or assembler, or C, or.. .)

article every 18-24 months.I wonder if the information I am looking for can be

found in the books of Ciarcia’s Circuit Cellar articles, or

whether I should get some other (more theoretical?) booksand try a few projects (like Don Lancaster’s “Cookbooks”perhaps)? Any adviceand direction you can provide wouldbe appreciated.

Richard P. WinslowRiverton, NY

 When C~RCUZT  C ELLAR INK was started, we discussed theidea of presenting  articles for computer novices. We decided thatthere was no way to do that without “watering down” thecontent for our core of readers: experienced engineers and pro-

 grammers. Wedo   print tutorials, but they’re&signed to “teach0ia  dogs  Ned  trick.g and not to give folks an elementaryeducation.

There are many  books that contain the sort of informationyou’re looking@. Ciarcia’s Circuit Cellar, Volumes 1-7; DonLancaster’s Cookbooks;and any number of titles  from Tab Bookscanget  youstarted down the road tomicrocomputerand control-ler design. Good Luck!

A DIVISION OF MING E&P. INC.

1. Exclusive   items at good prices.2. Unique items at better prices.3. Popular items   at the best prices.

I - 8 0 0 - 6 6 9 - 4 4 0 6(ORDER DESK ONLY)

1. Prices are subject to changewithout notice.

2. VISA, MASER CARD and

  Tiny size, only 1” X 1.5”, powered by 12VDC.COD(add $3) accepted.

3. Freight charge adds $5 UPS   4 Mb DRAM, up to 2 minutes recording time.

* 4096 possible codes. 100-200’ line-of-sight distance Ground, $8 UPS Blue, $15 * 16 variable-length messages each w/ direct trigger 

  Small size, 1.25” X 2.75”,  powered by SVDC.* Single channel RF receiver. 977 S. Meridian Ave.

Alhambra, CA 91803

* Same as RI -01, except it’s a multi-channel RF TEL: (818) 281-4065FAX: (818) 576-8748

  8 bit address codes, 4 bit data codes.

RC-01 Combination of TX-88 & RE-01 $29.95

December ‘9WJanuary  ‘9 5

Page 7: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 7/80

PHONE WIRE IAN ONE FOR MODULA-2

I was reading through CIRCUIT CELLAR INK 17 when Iran across “Low-Cost LAN using X-10 Technology” in theConnecTime   section.

There is an excellent base for a low-cost home LANusing the existing telephone wire. Each jack has an IW(inside wire) feeding it. The IW is either a 2-or 3-pair cable.

The phones only require a single pair (red/green), leavingthe yellow/black pair available for a low cost 2-wire LAN.Most homes do not have the second telephone line in-stalled, so all that is required is that the yellow/black pairbe disconnected from the jack used by a telephone. This isrequired since many phones use the yellow/black pair forswitch hook signaling (A and Al leads). I have used thissecond pair for quite some time with no major problems.The average home hasbeen  prewired with five jacks, so theodds are pretty good that there is one near the PC ordesired location at this time.

This letter is about the choice of language for ScottLadd’s column on Practical Algorithms, and responds toMr. Don Lasley’s letter to the editor in &curr CELLAR INK 

407.  Please enter my vote for Modula-2 as the choice foralgorithm exposition.

C is not more powerful than Modula-2-anything,

including bit-twiddling, that can be done in C can be donein Modula-2. Of course, you have to know Modula-2 aswell as you know C in order to be able to do the same thingsequally easily. Mr. I_asley can’t complain that the languagehe hasn’t bothered to learn, is clumsier or harder to usethan the language he’s used extensively.

I have a suggestion to make so that the LAN can beused by more than one device: Transmit the data on asingle wire (yellow) using the last wire (black) as a circuitbusy wire. This way, when you have multiple devicesconnected they will not access the data line at the sametime.

As a principal engineer performing quality control fora major consulting engineering company, I review workby a large number of engineers and analysts. Based on thisexposure, my conclusion is that there is no doubt that,while C is great for quick-and-dirty hacks, nobody, includ-ing the programmer, should expect to go back later andunderstand what was done. Programs written in Pascal,and especially Modula-2, on the other hand, tend to beclearer and better organized, making them easier andfaster to review and verify. They are also more likely toproduce reusable code.

Don HoudekSpring Grove, IL

Stephen R. TroySeverna Park, MD

)G31   controller board assembled without EPROM

C

$129.00

:ontroller  KIT DG31 K: PC board and all components exceptscrew terminals, RAM  and EPROM $70.00

EiPROM   7C 8  CMOS   programmed with TILE firmware(Programmable controller with Real Time Clock) $20.00

EiPROM   7C64 CMOS programmed with DG31M  and disk(IBM format) with monitor program, modulessource code listings and manual $30.00

HIOME  AUTOMATION and SIMPLIFIED SECURITY SYSTEMcomplete project using TILE controller and low costelectronic modules (shipping included) $10.00

TERMS: Skippiq  US/CAnAdr  $6. Ckck  on MONET  ondEn  plrrrr.

Reader Ser v ice 156

P-C-B ARlWORK  MADE EASYCreate Printed Circuit Attworkon your 

IBM or Compatible* MENU DRIVEN* HELP SCREENS*ADVANCED FEATURES* EXTREMELY USER FRIENDLY

*AUTO GROUND PLANES* 1X and 2X PRINTER ARTWORK* 1X  HP LaserJet ARTWORK

*  HP and HI PLOTTER DRIVER optional 49.00

REQUIREMENTS: IBM PC or Compatible, 384K RAM

DOS 3.0or   later. IBM compatible printers.

PCBoards -  layout program 99.00PCRoute -  auto-router  99.00SuperCAD -  schematic pgm. 99.00

D EM O PKG . -  10 .00

Call or write for more informationPCBoards

2110 14th Ave. South, Birmingham, AL 35205

(205) 933-l 122

Reader Ser v ice I1   73

Page 8: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 8/80

HOME AUTOMATIONCATALOG ONFLOPPY DISK 

Home Control Conceptshas released its newest

catalog on diskette. The 1990Home Automation Catalog on Floppy Disk includeshome automation andsecurity equipment, specifica-tions, pricing, explanations,and uses. The catalog alsoincludes information onhome automation, the CEBus(Consumer Electronics Bus)home automation standard,SMART HOUSE, andindustry definitions. Thecatalog is menu driven and

has illustrations of homeautomation and securityequipment. An IBM PC orcompatible computer withgraphics is required.

The unique disketteformat allows for dynamicchanges, so that each catalogdistributed may have themost current information,prices, and new products.Additionally, far moreinformation can be distrib-uted on diskette that can cost-effectively be distributed viapaper mail.

The catalog is availablefrom Home Control Conceptsfor $1.00 (refundable withany product order) or freefrom several computerbulletin boards includingGEnie.

Home Control Concepts

9052Westvale Rd.San Diego, CA 92129(619) 484-0933

Reader Service 500

FRACTAL GRAPHICS SOFTWARE

A drawing program that uses fractal geometry to createcomplex images is available from Cedar Software. Theprogram, “Fractal Grafics,” can be used for graphic design,scientific visualization, and educational illustration as well asdesktop publishing and presentations. Fractal Grafics takes asimple template drawn by the user and automatically contin-ues the pattern. For example, the user draws the trunk andfirst few branches of a tree, and the program will draw therest. A mouse or keyboard can be used to rearrange parts ofany shape without losing texture or detail. The changes canthen be reflected through all levels. The program features anon-line interactive tutorial, point-&click menus, and full colorcontrol.

A 120-page guidebook and over 150 hands-on examplesexplain and illustrate fractal art, science, philosophy, mathe-

matics, history, and literature. Example templates, which canbe modified as required, are included. Chaos theory and theformulas used to create fractals are explained, and a programto draw the famous Mandelbrot and Julia sets is included.

Fractal Grafics works on IBM PC compatibles with 384KRAM and CGA, EGA, or VGA displays. A mouse and mathcoprocessor are optional. PCX file compatibility allows theexchange of images with all major graphics programs. Theprogram sells for $79.00 and includes one free programupdate.

Cedar SoftwareRl Box 5140 l Morrisville,  VT 05661(802) 888-5275

Reader Service 850 1

WIRE-WRAP PROTOTYPE CARD FOR PC/AT

A manuallywrappableprototype card forIBM PC/AT andcompatible com-

puters has beenannounced byCANA  Group.The ProtosystemAT has beendesigned tosimplify prototypedesign and savedebugging time.The boardfeatures wire-wrap pinssoldered in placeon every signal

line, tantalumbypass capacitorson every powerline, and holdsmore that 100 16-pin IC sockets.

The board isdesigned for ease of use and minimization of assembly errors.The signal pins are never closer together than 0.200” (doublethe normal distance). The signal lines are grouped intoaddress, data, and control buses, and each signal pin has alarge, functional name label. The labels are on both sides of theboard for ease of troubleshooting.

The board deals with a number of bugs that plague high-speed circuits by eliminating the conditions that cause them.The hand wiring can be used to reduce the chance of cross talkby using several levels of loose wiring rather than a neatbundle. The power and ground planes are low-inductancepaths to the power pins around the edge of the board thatreduce losses. The large number of locations for power pinseliminate the need for daisychaining and long power leads,thereby reducing voltage drop and noise propagation.

A manual, entitled ‘The Principles of Wire-Wrapping” isincluded with the board. This brochure describes techniques incolor coding of wires, socket ID labels, and test points to makea circuit much easier to test and debug.

The Protosystem AT is available from stock and costs

$149.95.

CANA Group100 Walnut St., Suite 402Peoria, IL 6 1602(800) 747-2262 Reader Service 502

Page 9: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 9/80

NElAPRODUCTNEWSNEWPRODUCTNEWS

PATTERNRECOGNITION BOARD

A pattern recognition board, featuring 24 ‘ITL/DTLdigital I/O lines, is available from Keithley MetraByte. ThePIO-INT is an IBM PC/XT/AT compatible board that has

been designed for use in data acquisition and control applica-tions, and consists of three byte-wide ports provided directlyfrom a standard 8255 PPI.

On-board circuitry monitors two of the three ports and iscapable of generating interrupts on either the change of any bitin the port(s) or when a specific bit combination or pattern ap-pears. With a bit interrupt, a change of any unmasked bit fromeither 0 to 1 or 1 to 0 will generate an interrupt. Changes canbe read from the Status Register, and only those bits that areactivated by the interrupt Mask Registers will generate aninterrupt. With a pattern interrupt, an interrupt is generatedon a given pattern of bits in any port. Only unmasked bits canparticipate in a pattern match interrupt, and they are com-pared with a stored pattern of bits in the PIO-INT’s Pattern

Match Registers.The third port, while not monitored and without inter-

rupt generation capability, can be used as an auxiliary I/Oport, and can be divided into two nybble-wide ports. Eachport can be individually configured as an input or output port.

To prevent spurious interrupts, generation of an interruptis delayed by a two-stage digital filter. The filter is clocked bya programmable discrete decade frequency ranging from 1 Hzto 10 MHz. The effect of the filter is to allow actuation delaysfrom 100-200 ns to 1-2 seconds before interrupt generation.

Filter delays are selectable independently for the two ports.

The PIO-INT is provided with a sample assembly drivercallable from BASIC, together with its source code listing on autility disk. The PIO-INT sells for $399.

Keithley MetraByte440Myles Standish Blvd.Taunton, MA 02780(508) 880-3000Fax: (508) 880-0179 Reader Service 503

EXPRESS CIRCUITS

MANUFACTURERS OF PROTOTYPE PRINTED CIRCUITS FROM YOUR CAD DESIGNS

TURN AROUND TIMES AVAILABLE FROM 24 HRS -  2 WEEKS

Special Support

TANGO. PCB

TANGO SERIES IITANGO PLUS

PROTEL AUTOTRAX

PROTEL EASYTRAX

For:

l OTHER PACKAGES ARENOW BEING ADDED

FULL TIME MODEM

GERBER PHOTO PLOTTING

smARTWORK

HiWIRE-Plus

EE DESIGNER

EE DESIGNER

PADS - PCB

I

III

Express0

Circuits314 Cothren St., P.0. Box 58

Wilkesboro, NC 28697

Quotes:

l-800-426-5396

Phone: (919) 667-2100

Fax: (919) 667-0487

ReaderService  X134

December ‘90 January  ‘9 9

Page 10: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 10/80

NElA/PRODUCTNEWS/V~lM’RODUCTNEWS

DIGITALTROUBLESHOOTINGKITS

Three digital logic testkits which are TTL and

CMOS compatible havebeen announced by GlobalSpecialties. The LTC-6,LTC-7, and LTCJ eachfeature a logic probe, LM-2A 16channel  logicmonitor, DP-1  logic pulser,and SQ-1 tone-ohmmeterpackaged in a rugged plastic carryingcase. An accessory kit, consisting ofinterchangeable probe tips, gro&d  clips, tip adapters, andquick hook cables is also supplied.

The tone-ohmmeter locates bad ICs  and circuit shortswithout unsoldering parts. The DP-1  digital pulser is a pocket-

sized pulse generator used to stimulate logic circuits witheither a single pulse or continuous pulse train. The LM-2Asimultaneously displays the static and dynamic states of 16logic inputs.

Each kit contains a logic probe to find pulses even too fastfor an oscilloscope. The LTC-6 kit contains the LP-1 IO-MHzprobe; the LTC-7 kit contains the LP-3 35-MHz  probe; and theLTC-8 kit contains the LP-5 100-MHz  probe.

The price of the test kits range from $299 to $379.

Global Specialties70 Fulton Terr. l New Haven, CT 06512

 203)  624-3103 l Fax: 203) 468-0060 Reader Service 504

DSP OPERATINGENVIRONMENT

An IBM PC-basedoperating environment,designed to develop or studyDigital Signal Processing(DSP)  algorithms, is availablefrom BittWare ResearchSystems. DSP Headquarters DspHq)  allows an algorithmdesigner to write functions tooperate on a block of dataand it will supply the testdata, handle file and memorymanagement, and generategraphics. DspHq wasdesigned to be an openarchitecture to allow users tointegrate included functions,popular function libraries,and their own routineswritten in “c”  or Pascal.Algorithms pass and sharecommon data structures and

can be calculated by PC ordownloaded to a signalprocessor. DspHq includes a

menu interface, commandinterpreter, batch commandprocessor, file and memorymanagement, and screengraphics with hardcopysupport for dot-matrix, laser,PostScript, and HPGLdevices.

The batch commandlanguage allows users tocreate and simulate an entireDSP system, complete withuser-input, breakpoints, andsingle-step. Source code ex-amples are provided for thepopular “MathPak87”  and“Numerical Recipes in C”analysis routines. Interfacesare currently available formost signal processingboards based on the AT&TDSP32/DSP32C devices, andothers will be available soon.

Other features includecontext-sensitive help, crossreferenced for ease of use;

pull-down menus; detailedparameter setup; up to eightdisplay windows; and color

UNIVERSAL ANALOG

TEST INTERFACEBOARD

A universal analoginterface that is controlled bya single 24bit TT’L  digitalI/O has been announced byLate1 Engineering. The FB-1000 Analog Test InterfaceFamily board is an 8”  x 12”printed circuit board de-signed to provide a conven-ient and flexible interfacebetween a Device Under Test

(DUD  and the test systemcontroller or microcomputer.It features a variety of signalinterface and control func-tions and includes locationsfor 64 relays, two analog

output device support.An introductory version

is available for $250. The fullrelease, with additionalhardware and softwareinterfaces sells for $495.

The demo disk can alsobe downloaded from theDspHq bulletin board at (301)8383205. Modem parametersare 300/1200/2400-N-8-1.The BBSis devoted to DigitalSignal Processing, DspHq,and other related topics.

BittWare Research Systems

400 East Pratt St., 8th FloorBaltimore, MD 21202

(800) 848-0436

Fax: 301) 879-4465

Reader Service 505

multiplexers, eight op-amps,

eight voltage regulators, 16latched digital output lines,and 16 latchable input lines.For custom circuit applica-tions, a breadboard area isprovided around the DUTthat can accommodate up to35 16-pin  DIP components.

The FB-1000 uses a 24-bitcontrol bus, made up of three&bit ports. Several manufac-turers make 24-bit I/O cardsfor the IBM PC and com-patibles, and sample IBM

BASICA  subroutine driversto control the FB-1000 fromtwo of these products areprovided. Any 24-bit digitalI/O controller that is TTLcompatible can be used.

The FB-1000 packageincludes a parts list, sche-matic, board layout, instruc-tion manual, softwaredrivers, sample programs forthe IBM PC and compatiblecomputers, and the FB-1000printed circuit board. Thepackage, in quantities of oneto three, sells for $250,dropping to $150 for quanti-ties of 10 and above.

Late1 EngineeringP.O. Box 391Topsfield, MA 01983 508)  887-9506

Reader Service 506

Page 11: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 11/80

NElM’RODUCTNEWS/VM’PRODUCTbiEWS

ADVANCED STEPPERMOTOR COUNTER/CONTROLLER

A new advancedcounter/controller has all thenecessary commands and fea-tures to do complete motionand I/O control in one small

 package. The I/O Master RC-207 from Semix has a high-speed counter, I/O, and anincreased command set thatfacilitates its use for distrib-uted stepper motor controlvia a computer or as a stand-alone system.

The IlO-kHz  counter and1100 points of memory allowthe RC-207 to do complex

multiple-axis control. Up totwenty I/O Masters can bedaisy-chained with just athree-line cable to a host com- puter located up to 2500 feetaway. Each I/O Master cancontrol two stepper motor drivers alternately and 20inputs/l6 outputs; thus,centralized control and

monitoring of as many as

forty motors can be donefrom one computer. Program-ming can be done in a simplelanguage such as BASIC or C.

computer, except at initial

 programmmg.The RC-207 features 8K bytes of EEPROM and 8K  bytes of SRAM, as well asmany commands to allow the process to be easily manipu-lated and changed. Some of these include: selectable baudrate, echo-back capability,

 jump routines, flag settings,

The RC-207 can beconfigured for stand-alonecontrol as well. By writingthe program into each l/OMaster’s EEPROM, the unitscan be used without a host

 unPnn unI  W W l  Mod u la r d a ta a c q u isition a nd c ontro l fo r yo ur IBM  PC 

Our hardware and software are designed to work together - so ProControl

makes process control MORE simplea nd LESS e xp ensive .

IBM PC Host Ad a p ter  $129.95 l n t e r f o c e s  BM  PC’ s to  P.c = z?+:g bus / / O   m o d u le s  AND prov ides 24 d ig i ta l I/ O  ines.

TM/?-36 Timer Module $69.953 (expa nda b l e to six ) p rog ram ma b l e co un te r channe ls . f n c l u d e s  C a n d BASlC  exam p l es and driver software.

AIfV-124 A/D Module $129.95Four (expandab le to  e igh t ) / Z b i td ig i t a l - t o -ana log c h a n n e b .

Gra p hic a l Instrum ent Library (GIL)CGA Ve rsion FREE w ith an y P f& zz+ c e modu l e .VGA /EGA/ CG A/ Hercu les version ma y be purcha sed w ith or wi thou t source . Ca l, or see our c a f a f o g  fo r pr i c ing .

M o r e l / O m o d u l e s a r e  a v a i l a b l e . C a l l f o r o u r  F R E E c a t a l o g u e t o d a y !  

(404) 352 4788

counters, a timer, and stalldetection. The unit’s compact(2.2” x 4.1” x 1.1”) size andrugged casing, which is noiseand EM1 shielded, allows it to

 be placed in small places near 

mechanical components,reducing complex wiring andthe usual noise generation.Price was not available at

 press time.

Semix, Inc.4160 Technology Dr.Fremont, CA 94538(415) 659-8800Fax: 4 15) 659-8444

Reader Service 507

SrOMPOUTEPROM M NESS

The PROM KING emulates EPROMS, saving both time andmoney during your development cycle. Programmable inseconds via your PC printer port or any computer RS232port, it can emulate most 27xxx  devices.

l 8K-8M bit devices l 8-256 bit downloadsl High speed download: l Easily expandable:

-Universal RS232 -4 EPROMS per unit-PC printer port   -Up  to 8 units

l Menu driven software l  Also p rograms l ikel Battery backup a real EPROM

$599 for 150nS units with 256K bits Ask for pncing  of other options.

Made in USA by

TMXEL k4BS INC.BOX 239*RONKONKOMA.NY*11779

516-737-5147  FAX-51 6-737-0349

December ‘PO/J anuary  ‘9 I 11

Page 12: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 12/80

ONDI-

Part 2 The ON-line

  John Dybo wski 

Device InterfaceSo ftwa re fo r Rem o te PC Contro l 

Having developed the hardware for a flexible remote computer control

system, we will now investigate how the IBM keyboards work, and take a look

at the prototype software for a simple remote control application. Our system

configuration will consist of a computer, ONDI, and a Hayes-compatible mo-

dem; ONDI and the modem will remain powered up at all times.

THE FUNCTIONS OF A REMOTECONTROL DEVICE

We won’t get too fancy but we’lltry to touch on some of the moreimportant elements. To get started wemust have the capability to controland monitor the computer power.Keyboard emulation for both PC/XT-and AT-style keyboards will beneeded. The modem will typically berequired to auto-answer an incomingcall, which we will want to enable ordisable under software control. Thiswill be accomplished serially via theHayes AT command set by either set-ting the modem to answer on the firstring or by issuing the reset commandwhich will return the modem to its

switch-selected settings.To ensure that the modem is al-ways configured to the desired state,we will also monitor DSR and trans-mit the appropriate sequence on atransition of DSR going from off to onwhich would indicate either the con-nection or powering up of the mo-dem. For ease of implementation, themodem’s result codes will be disre-garded and the modem’s CD line willbe used to find the state of carrier.

To simplify the user interface, theoperational state of ONDI will becontrolled by a single three-position

toggle switch which will enable ordisable auto answer, or put the systeminto a local mode of operation. ONDIwill have the capability of being seri-ally accessed either locally or remotely,where remote access will be used forcontrol purposes and local access forconfiguration, check out, and down-loading. Interactive communicationswill be carried out using a commandline format which will handle buff-ered input with echo, and a transpar-ent mode of operation will release thecommunications lines to the modem/computer. An escape sequence will beused to return to the command line.

A timeout facility monitors themodem line for periods of inactivity.Abort times will be set at two minutes

during log on and five minutes fornormal remote operation and will ter-minate the session on expiration.

With the power to access the re-sources of a computer remotely, thereis a potential for problems, so pass-word access protection will also go onour list. Finally we will twiddle someLEDs on ONDI to indicate these vari-ous states and modes of operation.

STATES AND MODES

Having defined the desired fea-tures, it is now possible to outline the

operational environment in whichONDI will operate. ONDI runs in oneof three primary states: idle, local, orremote. When either local or remote,ONDI can function in a transparent orcommand line mode. Command linemode puts the user in direct commu-nication with ONDI. Transparentmode allows direct communicationsbetween the local and remote com-puter. Priority is given to the localinterface so ONDI can transfer directlyfrom remote to local operation if theswitch is thrown to the local position.The following rundown briefly de-scribes the major operational statesand modes that ONDI can assume:

Idle: The idle state is entered onpower-on following system initializa-

tion and is the point of return follow-ing the termination of most other states.ONDI waits here for something betterto do.

Remote state, log-on mode: Thismodeallowstheuserattheremotesiteto access ONDI in order to satisfy thelog-on requirements. If successful,ONDI proceeds to the remote com-mand line mode.

Remote state, command linemode: In this mode the remote com-

puter is in direct communication withONDI and has access to the remotecommand set.

Page 13: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 13/80

Remote state, transparent mode:The computer’s COM port is con-nected to the modem. ONDI monitorsthe modem transmit line. If the escapesequence is detected, control returnsto the remote command line mode.

Remote state, CTTY mode: Likethe transparent mode, except that

ONDI issues the DOS MODE andCITY commands to the local com-puter via simulated keyboard inputprior to entry. On exit ONDI CTlYsback to the console via the COM port.

Local state, command line mode:

mode), and switch to transpar-ent operation.

X-Switch to transparent opera-tion.

Lctext>-Line check, retransmit<text> to the remote computer.

A-Abort, hang up line.

Power-On Reset

K<text>-Send  <text>as   keyboarddata.

P-Display passwordPc”text”>-Set password.P”“-Deletes  the password. The

password is case sensitive.L<text>-Line  check, retransmit

text to the local computer.

X-Switch to transparent operation.

SOFlVVARE STRUCTURE

The code structure is segmentedin a modular fashion such that use-

The local computer is in direct corn-munication withaccess to the local command set.

Local state, transparent

ful pieces can be extracted ormodified for your own use. It

should be evident from the

mode: The computer’s COMport is connected to the mo-

dem. ONDI monitors thecomputer transmit line. Ifthe escape sequence is de-tected, control returns tothe local state/com-mand line mode. This isthe point of entry whenthe mode switch is setto local operation.

sponding to the variousstatesand modes. Also,it should be noted that,for the most part, therequired lower-levelsupport functions

Local Transparent remain consistent aswe traverse the vari-

ous process loops.With the above in

NOW, THECOMMAND SETS

mind, the structureadopted for the main-

Where possible, toreduce the amount of unique com-mand mnemonics, the practice of us-ing the command without an argu-ment is used to return the function’sstatus. In entering the commands,upper or lower case is OK. The remotecommand set is as follows:

H-Display a list of these com-mands on the remote consoledisplay.

S-Power status; returns ON/OFFindicating the computer powerstatus.

S+ -Turn computer power on.Report if computer logic poweris not detected within five sec-onds, delay for boot-up (as pro-grammed via the local commandline mode).

S- -Turn computer power off.K<text>-Send <text>assimulated

keyboard data.C-CTTY to COM port (as selected

via the local command line

The local command set consists of thefollowing:

H-Display a list of these com-mands on the local console dis-

Play*M-Display computer mode: AT

or PC/XT.Ma-Select AT mode.Mx-Select PC/XT mode.B-Display boot delay time.Bnn-Set boot delay time, 0 to 99

seconds. The boot delay time isthe amount of time ONDI waitsafter executing the S+ commandin remote mode. This is to pre-ventaccidentallyinjectingsimu-lated keyboard data before thekeyboard’s power-on transac-tions have been completed.

C-Display selected COM port.Cl-Select COM port 1.C2-Select  COM port 2. This is the

COM port used when the Ccom-mand is processed in remotemode.

line processing iscomposed of two parts: the main(MAIN) application driver, whichhandles the specifics of the moment,and the low-level resource handler(IDLE)  that’s responsible for perform-ing the grunt work.

IDLE is a callable routine that isthe interface between the applicationand the hardware and backgroundinterrupt functions. The functions ofIDLE include monitoring and de-

bouncing the toggle switch and mo-dem CD and DSR signals (returningonly when a change in state occurs),and relaying the SIO-related informa-tion such as receive complete, receivetimeout, receive error, and escapedetect. These events are indicated byreturning result codes to the callingroutine in the accumulator. The bene-fit of this approach is that the applica-tion software becomes much simplerto code and comprehend since thedetails of handling the data input arecentrally processed in a routine that,

December ‘90/ January  ‘9 13

Page 14: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 14/80

Page 15: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 15/80

same regardless of which style key-board we use. The method basicallyconsists of performing a table lookupusing the ASCII character as an index.The table returns either the translatedscan code, a flag that indicates that asecondary lookup must be performedusing the shift table, or a flag that

indicates that the control table mustbe consulted. Once the final scan codeis determined, the sequence is as-sembled and transmitted to the com-puter. For unshifted characters, onlyone scan code is transmitted, but inthe case of shifted or control charac-ters, the scan code must be framedwith a shift or control make code anda shift or control break code as appro-priate. Note the performance degra-dation when transmitting strings of

shifted characters, particularly in theAT emulation routines, since for ev-ery shifted character, three extra bytesmust be transmitted. It will be left asan exercise to the reader to considerhow to keep track of the shift mode sowe won’t have to frameeachand everyshifted character with the shift se-quence. Note that the only break codesthat are transmitted are for the shiftand control keys. Our keyboard emu-lation routines have the capability to

transmit the source string from pro-gram memory or internal data mem-ory. Finally, bear in mind that we’reworking under the assumption thatthe keyboard isinactiveand that we’reoperating from a known state, other-wise we would have to constantlymonitor the keyboard traffic for codessuch as ALT make, shift make, controlmake, and the toggling of caps lock.

SERIAL COMMUNICATIONS

Communications for the systemare fixed at 1200 bps, no parity, andone stop bit. Due to the nature of thediscrete memory areas in the DS2250,the transmitter can be set up to trans-mit from program memory, externaldata memory, or internal data mem-ory. Although the transmitter is fullyinterrupt driven, it is used in a polledmode in this application. The receive

interrupt handler implements thebuffered command line where thebackspace character allows editing of

commands. Received character echo-ing is handled from the receive inter-rupt and may be enabled or disabled.Receive timeout and escape sequencedetectionarehandled withalittle helpfrom the timer interrupt routine.

The escape sequence is defined asat least one second of silence followedby three “minus” characters. The re-ceive abort timer is implemented as asoftwareretriggerableone-shotthatisrearmed every time a character is re-ceived. The receiver signals the fore-ground when a return is received oron buffer overflow indicating eithernormal completion or an error.

SYSTEMTIMEBASE

All system timing is referenced tothe timer interrupt routine that exe-

cutes every 25 milliseconds. In addi-tion to handling the escape sequenceguard time timer and receive abort

Emulates 2764,27126,   27256

Plugs into target ROM socket andconnects to PC parallel port via

modulartelephone cable

 Accepts 32K x 8 SRAM or NV SRAM

Loads Intel Hex, Motorola S,hex, and binary  files

High and low RESET outputs for automatic startup after downloading

Includes all necessary software

Avoid the hasslesof programming

EPROMs

A ROM Emulator can

greatly reduce thetime spent writingand debugging

ROM code

and cables - worksr igktaway

ReaderService Y 172

December ‘ 90 /January  ‘9 15

Page 16: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 16/80

Page 17: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 17/80

FEATUREARTICLE

Chris ck fci

Principles of PC-basedData Acquisition andControl Systems

I could start this article with some sweeping statement like “PC-based data

acquisition and control systems provide the greatest versatility and flexibility,

etc., etc,  but most of you are already sold on that idea. If you’ve spent anytime reading past issues of this magazine then you appreciate how many

different things your PC can do. Instead, I’d like to discuss the basic principlesbehind the application instrumentation used in those articles. In other words,

I want to discuss how your PC is able to interact so effectively with the real world

and what pitfalls you may encounter as you try to control your environment,

Figure 1 -Process DAAC 

System . Phy s i c a l p a r ame -

ten and process c h a r a c -  

terist ics are de rive d from 

pressure (transducer) and 

t e m p e ra t u re ( th e r m o -  

c o up l e ) measu rem en t s  

wh ich are am pl if ied a nd 

dig i t ized a nd then fed toa PC for status monitoringan d d ec ision input. The 

PC then ana lyzes the 

process response, calcu- 

lates error and g enerates 

a series of control se- 

quenc es wh ich are fed 

ba ck to the process fo r 

c ontro l m anipulat ion.

18    ClRCUlT  CELLAR

Pressure VentControl Valve

Containment Vessel Pressure Analog

Multiplexer 

BidirectionalComputer Data Bus

Page 18: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 18/80

We can all appreciate that theworld around us very rarely lendsitself to simple understanding, evalu-ation, or control, especially if we at-tempt our control using a computersystem. Most real-world physical para-meters are analog and require someform of interface to the world of artifi-

cial computation and control.

DATA ACQUISITION AND CONTROL

The basic interfacing moduleswhich are employed in most real-world interactive systems are theanalog-to-digital (A/D) and digital-to-analog (D/A) data converters. TheA/D converter is a circuit which con-verts an analog (continuous) voltageor current into an output digital code.

And conversely, the D/A converterconverts a digital code word into anoutput analog voltage or current. Ofcourse, that’s not all there is to a real-world interface. In reality DAAC sys-tems are created using one or more ofthe following components:

DA/D   and D/A convertersl transducers.sensors*amplifiers

l filters*analog multiplexers*sample-holdsadigital  control sequencersl PC computer controller and

I/O bus.actuators

To see how the above componentscan be combined to create a workablecomputerized feedback control sys-tem, consider the diagram shown in

Figure 1. Here, measurements of“some heating process” within a pres-surized vessel are used to monitorand generate feedback control se-quences which will optimize the de-sired process. The primary inputs tothis DAAC system are the measure-ments of (analog) physical parame-ters such as temperature, pressure,velocity,acceleration,ordisplacement.

To gain an elementary under-standing into the design configura-tion of the needed elements within theDAAC system shown, let’s trace the

OutputOutput CodeS&%S Word   I ,

Quantizer  Error 

Figure 2-Due to the stai r-step nature o f the d igi tizat ion p roce ss, there is alwa ys a sm al l 

am ount of quantkat i on  error assoc iated wi th  the dig i tized signa l .

pressure measurement from the con-tainment vessel’s pressure transducer

through the interface, to the computer.Then we’ll follow the computer’s re-sponse back through the control inter-face, to the actuator located at thepressure vent control valve, wheremodifications in the processes’ statuswill be made.

Let’s assume that the pressure (orforce per unit area) within the con-tainment vessel is measured using astandard pressure transducer. Here,an elastically deformable sensing ele-ment responds to an omnidirectionalfluid/gas pressure. The deformationwithin this element, usually the com-pression of some sort of bellows orconvoluted diaphragm, is then meas-ured and an electrical signal is gener-ated which varies as a function of thatdeformation displacement. This ana-log signal is then fed through anamplifiertoboost theamplitudeofthetransducer output signal to a reason-able level for down-line processing.The typical transducer output usuallyrangesover the microvolt-to-millivolt

level and may be a high-impedancesignal, a differential signal with com-

mon-mode noise, a current output, asignal superimposed on a high volt-age, or a combination of these. It isusually amplified to a range of l-10volts.

Theamplifier output is channeledthrough a low-pass filter which re-duces the undesirable high-frequencycomponents (noise) within the signal.Sometimes the signal is then passedthrough a nonlinear analog functioncircuit which may modify the signalby squaring, multiplying, dividing,doing RMS or log conversion, or lin-earizing it.

The processed signal is introducedto an analog multiplexer which se-quentially switches between a num-ber of different analog input channels.Each input is connected to the outputof the multiplexer for a set time inter-val during which the sample-and-holdmodule receives the signal voltage forsampling while the A/D converterconverts that value into a digital form.This resultant digital word is then

December QO/ Janua r y  ‘9 19

Page 19: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 19/80

AU=FxTa

2 = aperture time

AU =   amplitude uncertainty

gure J -Any analog to digi ta lconve rsion ta kes a f in ite a m ount o f t im e d uring w hich t h b

the A/D process. Typically this con-version is characterized by a nonlin-ear transfer function like that shownin Figure 2. This figure represents thequantizer for an ideal 3-bit systemwith eight output states, like that usedin a 3-bit A/D converter. These eightstates are referenced by a sequence of

binary numbers which range from000to 111 over an analog input range ofO-10 volts.

p u t  signa l ma y cha nge ,The absolute resolution of the

quantizer circuit is specified by thenumber of output states defined inbits, or, in terms of a binary-codedquantizer power, 2*,  where n  is thatnumber of bits. Thus, an &bit quan-tizer has 256 output states and an 24-bit quantizer has 1,677,220   outputstates. Most applications call for a 212,

or 4096, output format.In our example diagram there are

2”-1  analog decision points or thresh-old levels within the transfer function( a t +0.625,   +1.875,   +3.125,   +4.375,+5.625,  +6.875,  and +8.125).  These de-cision points are precisely set halfwaybetween the code word center points(+1.25,  +2.50,  etc.) in order to dividethe analog voltage range into correctquantized values. So, when an analogsignal level is submitted, the quan-

tizer circuit determines what thresh-old level has been obtained and as-signs the binary code correspondingto it. Keep in mind, for anyone outputcode word there exists a small rangeof voltage differential about its centerpoint where an input voltage can beassigned the same code. This rangebetween any two adjacent decision

points is known as theanalog quantization size,quantum Q. For our ex-ample (shown in Figure21, the quantum is Q=l.25V. In general it can be de-termined by dividing thefull-scale analog range bythe number of outputstates. Q therefore repre-sents the smallest analogdifference which can beresolved or differentiatedby the A/D quantizer.

Asawtootherrorfunc-

in ,

dumped onto the DAAC system’sbidirectional data bus for access bythe PC controller.

This, of course, is not the onlyapproach to data acquisition. In anoften-used alternative, the measuredsignal is amplified and converted into

digital form at the transducer: Theoutput is then transmitted to the PCthrough a serial port. However, im-plementation of this technique re-quires that the data be converted toparallel form and then multiplexedonto the data bus.

In the feedback control portion ofthe DAAC interface, for all intentsandpurposes, we do the inverse of theinput data acquisition process. Thecomputer, based on analysis of its

input, determines the necessary out-put control functions required to elicita specified response within the “de-fined process” according to its opera-tional guidelines. These control out-puts are digital in form and must beconverted to analog form to drive theprocess. This conversion is accom-plished by employing a D/A con-verter, usually coupled to astorage buffer which storesthe digital word until thenext update. These buffersare under the control of thesequencer. The output ofthe D/A converter is usedto drive actuators whichdirectly control the variousparameters.

several of these individual functions.But understanding the basic conceptsbehind each of the above describedcomponents is of extreme importancewhen designing and configuring yourDAAC system, or for when you use an“integrated” data acquisition board.

Your original analog data is manipu-lated and altered by these devices. Sohow you quantize, sample and codeyour measured data will in fact deter-mine the quality of your measure-ment results. Here, quantization re-fers to the process of transforming acontinuous analog signal into a set ofdiscrete output states which are thencoded into a discrete digital wordwhich represents each output state,during a specified sampling timeinter-

val.

THEQUANTIZER TRANSFERFUNCTION

Quantizing an input analog sig-nal divides the signal into discretelevels or states whose size or rangedetermine the overall resolution of

output

QUANTIZATION  A NDSAMPLING THEORY 

Many of the commer-cially available A/D and or Figure 4-h order to keep the inputsignalsteady  during the conve r

D/A boards may combine sion, a sample and hold circuit is typically used.tion for the quantizer canbe derived by running the

20   C lRCUlJ  CELLAR INK 

Page 20: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 20/80

input through its entire range whiletaking the difference between theoutput and input. This is the irreduc-ible error that results from the quanti-z&ion  process. It can only be mini-mized by increasing the number ofoutput states (the absolute resolution).Typically, for a given analog input

level, the output will vary anywherefrom 0 to s/2, with the error beingzero only at points with analog valuesthat correspond to the code centerpoints. This variation is defined as thequantization uncertainty or noise. Asa result, the quantizer  output can bethought of as a combination of theanalog in and the Q noise, where thisnoise has a peak-to-peak value of Qand an average of zero. The RMS  valuecan be computed from the triangular

waveshape. It is useful in analysis andis usually Q/3.464.

SAMPLING THEORY 

No process is instantaneous! Likemost things, the A/D converter re-quires a small but significant amount

of time to complete the quantizationand coding steps. This “active” timedepends on several things, such as theoverall resolution, theconversion tech-nique, and the component processingspeed. This aperture time refers to thetime uncertainty or “the time win-dow” during which a measurement is

made. And as such it results in anamplitude uncertainty if the signalchanges during this interval.

To understand this better, con-sider the diagram shown in Figure 3.Here, the input to the A/D converterchanges by  AV, the maximum errordue to the signal change during theconversion time window, T.  The errorin this measurement canbe   estimatedin two ways: as an amplitude error oras a time error, which are related to

each other by:

dt

where dvCt)/dt  is the rate of changewith time of the input signal. If a sinu-soidal input signal is employed, themaximum rate of change occurs at the

zero crossings of the waveform, andthe amplitude of the error becomes,

AV = in  wt)t=o

= GAW

The resultant error as a fraction of thepeak-to-peak full scale is

e =LUL=&a2A

For example, the aperture time re-quired to digitize a IO-kHz  signal to 12bits of resolution can be estimated as,

‘5=  =exf

0.0002441

= 3.14159 x (10.0 x103)

= 7.7x lo-g

that is, 7.7 nanoseconds. With num-bers like these, one begins to under-stand the difficulty converting signalsin the tens of gigahertz range, wheresome of the latest scopes are now em-ployed.

Also affecting the overall aper-ture time is the sample-and-hold time.

ReaderSew ce l59

As kabout other ENVIRONMENT 96Development Tools.

ENV96streamlines your 

design process by allowingyou to bring your idea to

prototype quickly and efficiently.

ENV96 is a plug-in development board for Intel’s 6096/6CC196   microcontroller.ENV96 includes an 8097BH or 60C197KB,   processor support hardware, ashared 64K RAM module, an interface to the PC, a wirewrap   area withdigital and analog power and ground distributed throughout, andwirewrap   pins on the PC Bus and processor pins. Easy to learn Debugsoftware simplifies HWLSW   debugging.

Annapolis Micro Systems, Inc.

 

190 Admiral Cochrane Drive(301)  841-2514

Annapolis, MD 21401FAX: (301) 841-2518

q der Servb1107

Decem ber W/January ‘9 I

Page 21: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 21/80

Page 22: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 22/80

plexer (see Figure 1). While with anD/A converter, it is used as adeglitcher. Here, the device is used tocontinuously track the input signal,then switched into the hold modeonlyat specified times.

THE SAMPLING THEOREM

In most DAAC systems, analogsignalsare sampled on a periodic basis,similar to that demonstrated in Figure5. Here the sinusoidal input signal(5a)   is sampled on a periodic basis, de-termined by a train of sampling pulses(5b)   which represent a fast-actingswitch that connects the signal to thesample-and-hold for a very short pe-riod of time, then disconnects it for theremainderofthesamplingperiod.The

result of this operation is identical tomultiplying theanalogpulsebya trainof sampling delta functions of unityamplitude (see Figure 5~).  The ampli-tude of the original signal is preservedin the modulation of the pulse enve-lope with the amplitude of each pulse(sample) being stored betweensamples within the sample-and-hold.From this, a reasonable reconstruc-tion of the original signal can beachieved (see Figure 5d).

Now the important question mustbe answered: “How much samplingmust I do (what resolution) to retainmost of my input information?”

Obviously, if I sample at a ratewhere little or no change takes placebetween samples, I won’t lose much.Equally obvious is the fact that infor-mation is being lost if there is a largeamount of change in signal amplitudebetween samples. So to get an answer,let’s consider the Sampling Theorem,

which states:“If a continuous, bandwidth-lim-

ited signal contains no frequency com-ponents higher than f,, then the origi-nal signal can be recovered withoutdistortion if it is sampled at  a rate of atleast 2f,  samples per second.”

The best way to understand this isto consider the diagrams in Figure 6.Here, Figure 6a shows the frequencyspectrumof a continuous bandwidth-limited analog signal with frequency

components out to f,.  When the signalis sampled at a rate off,, the modula-

tion process shifts the original spec- If the sampling frequency f, is nottrum out to f,  2f, 3fti   and so on, in high enough, then the part of theaddition to the one at the origin (a spectrum centered around f, will foldpiece of this spectrum is in Figure 6b). over (frequency folding) into the origi-

Figure 7-An inad eq uate sam pling rate c auses an al ias freq uenc y.

Cross-Assemblers fromsO.

Simulators from 100.00

Cross-Disassemblers from$lOO.OO

Developer Packagesfrom 2OO.OO(a   $50.00 Savings)

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

Get It Debugged--FAST

Don’t wait until the hardware is finished. Debug your software with our Simulators.

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

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

ProcessorsIntel 8048 RCA 1802,05 Intel 8051 Intel 8096,196kcMotorola 6800

Hitachi 6301

Motorola 6801 Motorola 68HCll  Fcn~z1&;05

Motorola 6809 MOS Tech 6502Rockwell 65CO2 Intel 8080 85Hitachi HD64180  Mot. 68k,&lO

Zilog 280 NSC 800

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

For Information Or To Order Call:

PseudoCorp716 Thimble Shoals Blvd, Suite E

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

 .   ,__^~   A_-   ,,.TT

December ‘PO/January ‘9 23 

Page 23: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 23/80

Figure 8-The  length of un am pli f ier’s se tMng  t im e d ep end s on how long i t tak es the 

outpu t  o sew /e  info the l im its of the error ba nd .

nal signal spectrum. As a result, thefolded part of the spectrum causesdistortion in the recovered signal.Otherwise, if the sampling rate is in-creased tof,-f, > f,, then the two spec-tra are separated and the original sig-nal can be recovered without distor-tion. Therefore, frequency folding canbe eliminated by either using a suffi-ciently fast sampling rate or by filter-

ing the signal before sampling to limitits bandwidth to fs/2.

Figure 7 demonstrates the effectof an inadequate sampling rate on thesinusoid in Figure 5. If asampling rate less thantwice per cycle is employed,an alias frequency in therecovered signal willresult.However, if, according tothe Sampling Theorem, weusearategreaterthantwicea cycle, the original fre-quency will be preserved.

device that measures a physical pa-rameter (our pressure transducer orthermocouple) and thenamplifiesandfilters it. both  are critical to the sys-tem’s overall performance. The am-plifier may act to boost the signalamplitude, buffer the signal, convert asignal current into a voltage, or extracta differential from common-modenoise. A filter, typically a low-pass

antialiasing filter, is often used toreduce man-made electrical interfer-ence noise, reduce electronic noise,and to limit the bandwidth of the

  j a 314 Ful l __

2

Scale

AMPLIFIERS AND FILTERS

I’m not going to say toomuch about amplifiers andfilters within this article,since most of you have beenrepeatedly exposed to thosedevices. Suffice it to say that

the front end of our DAACsystem (shown in Figure 1)extracts a signal from a

2

1  /~

,

2  2  Ful l __Q   ;’

,

a Scale   ,  ,I.I

,Il 4  Ful l __   ,

Scale.,I

,,

Its importance lies in the fact thatour DAAC system is made up of sev-eral analog operations which must beperformed in a set sequence. As such,each operation must be accuratelysettled before the next operation can

be initiated. For example, a bufferamplifierprecedinganA/Dconvertermust have accurately settled beforethe converter can do its thing. Anexample of this settling time is shownin Figure 8. Here a full-step inputwhich has been submitted to an am-plifier is followed by a small time delayafterwhichtheamplifieroutputslewsor changes its maximum rate result-ing from internal amplifier currentswhich must change internal capaci-

tances. Then, as the amplifier ap-proaches its peak value, it may over-shoot and then reverse and under-shoot the full-scale value before fi-

nally entering and remain-ing within the specifiederror band. As seen within

, Figure 8, this settling timeis measured from the starttime to the final entry intothe specified error band(typically fO.Ol%  to -to.1 %of the full-scale transition).

000 001 010 011 100 101 110 111

Input Code Word

analog signal to less than half thesampling frequency in order to elimi-nate frequency folding.

SETTLING TIME

An important aspect of any dataacquisition system is called the set-

tling time. That is, “the time elapsedfrom the application of a full-scalestep input to a circuit to the time whenthe output has entered and remainedwithin a specified error band aroundits final value.”

ANALOG MULTIPLEXERS

An analog multiplexeris the device which time-shares an A/D converterbetween a number of ana-log input channels. It iscomposed of an array ofparallel switches con-

nected to a common inputline (with only a singlefeedthrough active at one

 

Figure 9-The transfer function of an ideal 3-bit DAC.

Page 24: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 24/80

Page 25: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 25/80

gure 11 --Most A/D and D/A conve r t e r s 

t roduce  some de gree o foffset , gain, and/ 

of nonl inea rity error.

Here, each input code word producesa single discrete analog output value,generally as a voltage. There are 2” dif-ferent values produced including zero,with that output having a one-to-onecorrespondence with the input.

There are many different ap-proaches used for DAC implementa-tion, but most in use are of the paralleltype, where all bits change simultane-ously upon application of an inputcode word. Serial-type converters, onthe other hand, produce an analogoutput only after receiving all digitalinput data in sequential form.

To employ a DAC within ourprocess control application (see Fig-ure 11 , I have chosen to describe a

28 CIRCUIT CELLAR INK

configuration that provides adeglitched analog signal to our feed-back control device actuator (of thepressure valve or heating element).All D/A converters produce outputspikes, or glitches. They are most seri-ous at transitions of l/4,1/2,  and 3/4 of the full scale (fs).  An example of

this is shown in Figure 10. They arecaused by the small time differencesbetween current sources being turnedoff and on within the D/A converter.Take for example the major code tran-sition at half scale from 0111.. .llll  to1000...0000.  Here the MSB (leftmostbit in the converter) current sourcetumson while all othercurrent sourcesare off. As a result, the small differ-ence in switching time causes a nar-row half-scale spike which could causea hiccup in a finely tuned actuator.

To overcome this problem, thedigital input to the DAC is controlledby an input register while the con-verter output is stored on a sample-and-hold. When the digital input isupgraded by the register, the sample-and-hold is switched into the holdmode. After the DAC has changed toits new value with all spikes settledout, the sample-and-hold is thenswitched back into a tracking mode.As a result of this process, the outputchanges smoothly from its previousvalue to the new value.

ERROR FUNCTIONS IN A/D ANDD/A CONVERTERS

Of course, actual A/D and D/Aconverters don’t have the wonderful/ideal transfer functions I’ve describedabove. In reality they contain threedifferent types of operational errors,called offset, gain, and nonlinearityerrors. They are all functions of timeand temperature and they all appearsimultaneously.

Examples of these error functionsare shown in Figure 11. They are de-fined as:

offset error results from transferfunction failure to pass through zero.

ga i n  error is the difference in slopebetween the actual transfer function

anditsidealone.Itisusuallyexpressedas a percent of analog magnitude.nonlinearity  error is defined as the

maximum deviation of the actualtransferfunctionfromanidealstraightline at any point along the function. Itis expressed as a percent of the fullscale or in least-significant bit size. Itassumes that the offset and gainerrorshave been adjusted to zero.

Today, most A/D and D/A con-

verters enable external trimming ofoffset and gain errors, at least at ambi-ent temperature. Nonlinearity error,however, cannot be adjusted out andremains an inherent characteristic ofthe converter.

But remember, be careful whenyou operate a converter over a signifi-cant temperature range. Theeffect dueto this change must be carefully deter-mined. Of key importance is whetherthe device remains monotonic; that is,

whether it has missing codes. This canbe determined by computing the “dif-ferential nonlinearity tempco” speci-fied for the converter. If you assumethat the converter has at least half theleast-significant bit of differential non-linearity error, then the change intemperature resulting in an increaseto 1 can be written as,

*t  = 2-” x lo6

2DLT

where n is the converter resolution inbits and DLT  is the specified differen-tial nonlinearity tempco in parts permillion (ppm) of full-scale range perdegree Celsius. Here, t  is the maxi-mum change in temperature that theconvertercanhandlebeforeitbecomesnon-monotonic.

This suggests that an organizedapproach be undertaken when youdesign your DAAC system. The A/Dand D/A converters are the primarycomponents. so you should draw up achecklist of required characteristicswhich, at minimum, should includethe following key items:

1. converter type2. resolution3. speed4. temperature coefficient

After your choice has been nar-

rowed down by these considerations,you should then determine how yoursystem fits the following:

Page 26: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 26/80

1. analog signal range2. type of coding3. input impedance4. power supply requirements5. digital interface required6. nonlinearity error7. output current drive8. type of start, stop, and status

signals9. size and weight

APPLICATIONS OF DAAC SYSTEMS

Recently there has been markedenthusiasmforusingmicrocomputersfor data acquisition and control. It iscurrently estimated that nearly40%ofall computer applications require someform of analog I/O. And of that, it’sestimated that more than half use a PCin one form or another. Of course, theactual applicationdeterminesboth thetype and number of analog signals in-volved. In most industrial processcontrol or monitoring operations,hundreds of control points are con-tinuously processed. These systemsusually don’t lend themselves to a PC

environment because of the largenumber of data channels and the needfor fast multitasking environments.However, in simpler systems, wherethe number of data channels is lessthanlOO,thePChascomeintoitsown.

This is where the steadily increasingcomputing power of the PC has made

consistent inroads. Systems with feweranalog channels allow having theanalog circuity  located directly on thesame printed circuit board as the I/Ointerface logic. The card is made to

 just drop into any of your 16-bit or 32-bit slots with the analog input comingdirectly from the amplifier or yourtransducer. A multiplexer in front ofthe card enables the PC to handlemultiple channels on the same card.Theresultis thatthisunitcanbetreatedas a standard I/O peripheral usingcanned software drivers. Examples ofdifferent peripheral configurationsthat you can find on the market are:

DAnalog-in  (A/D only) with 8-  to256channel  input capability.

*Expandersforapplicationsneed-ing extra analog channels.

*Analog-out (D/A only) with 4-to 64-channel output capability.

l Analog-out expander boards formultichannel analog out capability.

l CombinationA/D/Aunitswith8 to 64 analog I/O channels.

To be honest, there are other con-figurations, but you get the point.

There is a whole realm of real PC-oriented application DAAC systemcomponents available. The availabil-ity of hardware and associated driversoftware has made the “desktop” PCa necessary part of the well-equippedlab or shop floor.+@

Chris Garcia  has a Ph.D. in experimentalnuclear physics and is currently working as astaffphysicist at a national lab. He has exten-sive experience in computer modeling of ex-

 perimental systems, image processing, andartificial intelligence. Chris is also a principalin Tardis Systems.

IRS403 Very Useful404 Moderately Useful405 Not Useful

illips-8xc552 basedMicrocontroller Board

Hardware: 

. 8~~552   CPU

l wire wrap area withuncommitted DIN 41612connector 

l RS232 interface-9 way

(AT) or 25 way (XT)connector 

l Single 5 volt supplyl Power fail detect

l Processor contains:

I’C,8 channel 10 bit ADC2 channel PWM16 extra l/O   lines over 

Appl icat ion areas: 

l real time controll Data Acquisitionl software/development

evaluation Production

Software: 

l Powerful Monitor/

Debugger PROM includedl BASIC, Forth, Assembler,

Monitor (optional)

8031 

Multi function

timer/counter withcapture and compare

l Standard 8031 peripheralsI/O serial port, timers,ram, etc.

 495P0FM 603-469-3.530  l 603-469-3232

qBinary Technology, Inc.  av  wze a  P 0. Em  67 e  Meriden.  NH   03770   WEE3

L

PC-Based Logic Analyzers

Sophisticated Logic Analysisa’, Unsophisticated Prices

ID160 (50  MHz) for $695*ID161 (100 MHz) for $895

*SO MHz or 100 MHz Sampling l 8K Trace Buffer l 32-channelOperation *Multi-Level Triggering *State Pass Countingl Event Timer/Counter l Performance Histograms l HardcopyFutput   *Disassembles popular E-bit micros *and much more

30 Day Money Back Guarantee

INNOTEC DESIGN, INC.6910 Oslo Circle, Suite 207Buena Park, CA 90621Tel: 714-522-1469 FAX:714-527-1812

30   CIRCUIJ  CELLAR INK

Reader Service I

Page 27: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 27/80

Page 28: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 28/80

FEATUREARTICLE

 LV

TimMcDonough& Bruce Web b 

An Interface for PortableBattery-Backed RAM

I ou can’t take it with you.”Not so long ago, the adage about

wealth and death held with equalvalidity for portable or remote datagatheringapplications. Portableunitslacked the power to support floppydisk drives, and networks are simplynot feasible in every situation. Fortu-nately, engineers have provided sev-eral possible solutions to the dataportability problem in recent months.One solution gaining acceptance isthe “data card”-a credit card-sizeddevice containing battery-backedRAM.

Credit card-styleRAM   cards haverecently appeared in such consumerproducts as video games and evenpersonal computers such as the AtariPortfolio pocket computer. Theseapplications typically use a mask-pro-grammed ROM card or a similar one-time-programmable ROM card, butthe RAM cards are also available inEEPROM and battery-backed SRAMversions that make them ideal forstoring and transporting infor-ma   ti nn

Using the M itsub ish i BEE Ca rd  fo r Nonvolatile Data Storage

The SRAM version of the BEE cardwe used has 32K of 250-ns  CMOSstatic RAM (Mitsubishi part no.0256SRMSP25).   Power consumptionis 200 milliwatts maximum at 5 voltsand the package has a rated operatingtemperature of 060°C. Each cardmeasures 54 mm wide by 86 mm longand is approximately 2.3 mm thick.The card includes a holder for a thin,circularlithiumbattery(typeCR-2016)that  provides power to retain the cardsdata any time external power is notsupplied. Mitsubishi rates battery lifeat 4 years when operated at 25°C. Awrite-protect switch, located on theend of the card, can be used to protectdatafrombeingaccidentallyoverwrit-

ten if desired.A 32K BEE card was chosen for

several reasons. First, using the BEEcard as a mass storage device is verystraightforward. It can be read

other RAM device in the computer’smemory map. There are no specialdisk drive interfaces to build and nodisk BIOS to write as there would behad we incorporated a disk drive. Se-lecting the32Ksizeallowed  us to place

some conventional EPROM andSRAM on the board and still addressthe BEE card within the 8031’s 64Kaddressspace withoutaddingany sortof a bank switching scheme.

The second reason for using theBEE card is it has no moving partssuch as drive motors that generateheat, collect dirt, and make noise, orheads to go out of alignment. Since theBEE card is all solid-state, battery-backed SRAM, it has none of theseshortcomings. Most of the flexibilityof toting around a floppy disk is re-tained, although in our case not quiteas much data storage is available.

from and written to   Photo 1 -The D a t a l o g R  I allow s the _...  fheuse

wi thou t 

available RAM cardstorage capacitiesrange from 8K bytesto 1 megabyte of stor-age.

Recently, we designeda basic general-purposesingle-board computer, theDatalog-R I (pronounced “datalogger,one”;seePhoto  l), that  couldbe used for simple process-controlfunctions and would also providenonvolatile, removable storage. Wechose to incorporate a 32K-byte  “BEEcard” from Mitsubishi Plastics in ourdesign.

32   C /RClJ /T  CELLAR INK 

Page 29: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 29/80

8031 TO THE RESCUE

A schematic of our design isshown in Figure 1. The size of the fin-ished board, without the BEE cardinserted,is4.5”by6.0”.  A34-pinheaderprovides access to ports 1 and 3 of the8031 as well as providing access to the

5-volt DC power bus and ground con-nections. Additional connections areprovided for an RS-232-compatibleserial communications port and anexternal reset switch for the 8031.

Aside from the use of the BEEcard, the system is a fairly conven-tional 8031-based   single-board com-puter that should be quite familiar toC~~curr  C~LAR   INK readers. A 74LS138address decoder provides selection of8K memory devices at OOOOH, 2OOOH

40OOH,   and 6000H. Jumper blocks onthe *CE  line of each 2%pin  socket lettheuserselectthebaseaddressofeachpackage depending on individualneeds.

Two gates of a 74LSO0 NANDpackage are used in conjunction with

the 8031’s *PSEN  and +RD  signals toderive a three-wire bus that can beused to configure on-board memoryin one of three ways. The jumpersallow each 8K device to be designatedas RAM or EPROM like you might ex-pect. A third position, “BOTH,” causesthe 8031’s Program and Data memory

spaces to be overlapped within a given8K  block. This option is provided toallow compatibility with certain ver-sions of Forth and other high-levellanguages that require a single, com-bined memory space for proper op-eration.

A jumper is also provided on pin31 of the CPU to enable or disable theinternal ROM found in some 8051family microcontrollers. This makes i tpossible to use mask-programmed

8031 microcontroller derivatives suchas the Micromint 8OC52-BASIC  CPUor the Intel 8052AH-BASIC  CPU.

A third gate in the 74LSO0 pack-age is used to generate a *BCS (BEECard Select) signal from address line15 of the CPU. Since the BEE card

serves as a mass storage device in thissystem, the RAM/ROM/BOTH op-tions are not jumper selectable.

Other connections to the BEE cardare similar to any other memory de-vice. *WR, *RD,   high-order addresslines,anddemultiplexeddataandlow-order address lines are all run to the

special 32-contact socket where theBEE card itself is inserted.

The printed circuit board for theDatalog-R I includes space for a 5-voltDC regulator to make it simple to runthe data logging system from an exter-nal 12-volt   power source. Twelve voltsDC is readily available in vehicles andis easily obtained in out-of-the-waylocations where instrumentation andsensing equipment are often poweredby photovoltaic arrays that charge

secondary storage batteries.

MOVING THE DATA

Although perhaps not typical of alogging device, we chose to equip ourdesign with an RS-232-compatible

f

,- *-   T0 RO I’

DATA BUS

.Figure 1a-  The Datalog -R I c onsists of a b asic 803  ci rcui t with a simp le expa nsion head er.

Decembe r ‘90/January ‘9 33 

Page 30: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 30/80

communications port. The port isimplemented using the 8031’s built-inUARTand  a Maxim MAX232 to main-tain single-voltage power supplyoperation. An 11.0592-MHz  crystalallows no-hassle programming ofstandard data rates from 1200 through9600 bps.

A serial port makes sense in thisapplication for a couple of reasons.First, and most important, it allows aDatalog-R board with appropriatefirmware to be used as an inexpensiveBEE card reader back at the lab so theuser can move the collected data toanother computer for analysis andfurther processing. Second, we recog-nized that there is a lot of scientificinstrumentation equipped with com-munications ports that the original

manufacturer assumed would beconnected directly to a host computer.By using a Datalog-R as a sort of “minihost” that polls the equipment forinformation and stores it in the BEEcard, it is possible to use the equip-ment in a remote location withouthaving to dedicate a PC or an expen-sive laptop computer to data collec-

tion when the total volume of data issmall.

IN THE FIELD

Using the Datalog-R is quitesimple. Although we have insertedand removed the RAM card from anoperating system many times, it isadvisable to have the power off when-ever swapping cards. This avoids thepossibility of inserting or removingthe card while it is being accessed bythe 8031 and perhaps corrupting thedata or damaging the card.

The BEE card is inserted in theDatalog-R with the legends and theelectrical contacts facing up. Once acard is inserted, power is applied tothe computer and the system is reset.

In most cases customers have devel-oped their final applications to beginrunning immediately after reset, re-quiring no further operator interven-tion.

A 32K BEE card holds a lot of dataif you choose your storage algorithmcorrectly. In a typical temperatureloggingapplication, a thermistor-type

  R-535 Prototyping Board with R-Ware

A Comolete   Svstem for Developing Embedded ControlApplicitions   a

Board includes: power supply, 80535processor (  enhanced 8052 with 3timers plus watchdog timer and 12interrupt. sources at 4 programmablepriority levels), up to 128 k on-boardmemory, Eprom burner, RS-232 serialport at 9600 Baud, 28 digital I/Olines, 8 analog input lines, 2-l/8”  by6-l/2”  breadboard with 8 pushbuttons,

8 to9

gle switches, 16 LEDs,  2 numericdisp ays.

R-Ware includes: ROM resident monitor program and PC-based t i ;egr&fmenudriven softwareassembly, PC-to-board communication:download and debug.

Plus user’s manual and controlexperiments with example software.

Prices start at $395.-

RIGEL   CORPORATION

P.O. Box 90040Gainesville, FL 32607(904) 373-4629

34   ClRClJfJ  CELL4 R INK Reader Service X

probe might be sampled four timesper hour and its 8-bit value storedalong with the time and date to theBEE card. Even without doing anyclever programming to compress theinformation, data stored in a formatsuch as YYMMDDHHMMcdatabyte> would allow for an entiremonth’s (31 days) worth of data to becollected before the BEE card neededto be changed. Throw out the year andthe month, or write them only once as“header” information whenever thesystem is powered up and the storagetime can easily be stretched to fourty-eight days!

Our approach with this designwas to build a system that was appro-priate for smaller, simple applications.It has helped us solve some unique

problems and we’ve gained valuableexperience regarding the use of “RAMcard” technology along the way.+

We would like to thank Claire Bienen at Mitsubishilnternationalforhelpingout  withtechnical information, support, and of course theBEE cards used in OUY  original prototype.

 Many thanksalsogo to Carl Baxter   of Businessand Technical Consultants for his real-worldtesting of several early prototypes.

TimMcDonough and Bruce Webb are princi-

 pals in Cottage Resources Corporation.

Sources

Mitsubishi International, Inc.520 Madison AvenueNew York, NY 10022

An assembled and tested Datalog-RI (less the 32K BEE card) is available

for $179.95 (plus $3.00 S&H perorder). 32K BEE cards are availablefor$57.95  each when purchased withthe Datalog-R I.

Cottage Resources Corporation1405 Stevenson Dr., Ste 3-672Springfield, IL 62703(217) 529-7679

IRS406 Very Useful407 Moderately Useful408 Not Useful

Page 31: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 31/80

Page 32: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 32/80

  FEATURE  ARTICLESteve Ciarcla

&  u t  Brown

Using theMotorolaMC68HCllA Ve ne ra b le History a nd a Cer fa in  Futu re 

I come from the school that saysall computers are equal, some just runa little faster than others. Providedthat the price is not the overridingissue (such as 8088 chips suddenlybeing regularly priced at 39q each), I

generally choose a processor for myprojects based on ease of use and easeof explanation. In point of fact, how-ever, most of my projects treat the mi-crocontroller as a ge-neric device. I may statetheprocessortypebut1use high-level lan-guages so that the codeis transportable and notprocessor specific.

For me, development tools and low-costhigh-level languagesupport take prece-dence over issues likebrand loyalty. As mostof you already know, Idon’t like to programany more than I have to:I usually use a control-lerboardwithan8OC52-BASIC processor that

can be directly pro-grammed in BASIC.Many of my applica-tions-oriented projects

  8W32KRAM/EPROM

Figure 1 -Funcfiona/  block  diag ram of the RTC-HC I 1.

have beengreatlyexpeditedbyincorporatingoff-the-shelf BCC52 and RTC52 control-lers rather than reinventing the wheeleach time.

microcontroller chips very different. Using the 68HCllA1, we wereWhile the RTC52 generally meets all able to put functions like parallel I/O,my programming objectives and can battery-backed RAM, EPROM,be expanded to include lots of I/O, EEPROM, watchdog timer, battery-multiple boards cannot always be backed clock/calendar, serial ports,accommodated in every application. I and an A/D converter in a low-cost

still see the need for a more highly   3.5”~ 4.5” form factor. Combined withintegrated very low power single- high-level languages, cross-assem-board microcontroller for future proj- blers, and a monitor, this RTC-HCllects. board offersa   formidable platform for

many fut&e   CircuitCellar projects.

MC68HCll AlMicrocontroller 

ND Converter 

you in on the specificso f th e RTC-HCllboard architecture, at-tributes, and memorymap. Finally, with helpfrom Burt, I’ll address

RTC StackingExpansion Bus

While I’ll be the first to say that acomputer is a computer, I temper thatassertion with a little reality. When itcomes down to fitting a variety of

specific control functions on a fewsquare inches of PC board, integrationdensity and on-chip attributes make

Of course, we haveto start some place, andI can’t just drop anRTC-HCll  into someproject without detail-ing the design of it for

you beforehand. Afteryou familiarize your-self with the 68HCllfrom the sidebar,  I’ll fill

At first I considered using the newSignetics 8031-based   super chips andporting BASIC-52 to them, but I wasadvised that it would be an ordeal andthat there were many incompatibili-ties. Instead, thanks to a vocal groupof Circuit Cellar BBSers  who offeredopinions, I ended up selecting the Mo-torola 68HCll. The 68HCllAl chip

(see sidebar)   is a wonderfully func-tional microcontroller which offersconsiderable on-chip attributes.

some software, devel-

opment tools, andpro-gramming  examplesfor the RTC-HCll.

THE BASICS

The RTC-HCll   is a single-board,g-bit  computer/controller based onthe Motorola MC68HCllAl MCU.Like the 8031- and V25-based   designspreviously presented in the pages ofCIRCXT  CELLAR INK, [Editor’s Note:

See “Creating a Network-Based Embed-ded Controller,” CIRCUIT  CELLAR INK 8;

and “PC Programming Comes to Embed-

36   C lRCUlT C ELLAR NK

Page 33: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 33/80

ded Control,” C IRCUIT C EL LAR INK 27.1

the RTC-HCll  uses the same dualvertical-stacking I/O expansion bus. Itook advantage of the 68HCllAl  tobuild the following features onto theboard:

*Motorola MC68HCllAl  MCU

running at 8.00 MHz*Up to 21 bits of TTL-level  I/O (8bits are shared with ADC)aAsynchronous   serial port; eitherfull-duplex RS-232 or half-duplexRS-485Gynchronousserialport  withdata

transfer rate of up to 1 MHzl 8-channel, 8-bit   A/D converter0512  bytes of EEPROM*Battery-backed real-time clock/calendar

‘Up to 64K of on-board RAM/EPROM, 32K bytes of battery-backed RAM

*Five-volt-only operation*Small  3.5” x 4.5” form factor*Compatible with RTC-series I/Oexpansion boards

RTC-HC 11 HARDWARE

AnRTC-HCl  1 computer/control-ler board is composed of the three

distinct hardware subsystems shownin Figure 1. These include the MCUitself and its associated I/O and resetcircuitry; external RAM, EPROM, andmemory address decoding; and theon-board real-time clock/calendarwith battery backup and write-pro-tect circuitry.

At the heart of the RTC-HCllboard lies a PLCC-packaged Motor-ola MC68HCllAl   HCMOS microcon-troller unit (MCU).  This is a high-

speed, low-power, fully static MCUdesign featuring over half a dozensophisticated on-chip peripherals. Infact, all of the on-board I/O deviceswith the exception of the real-timeclock arelocated within the MCU, andan RTC-HCll board can be strippeddowntojusttwochips(the68HCllAland the MAX232)  and still be able torun small assembly language pro-grams.

All of the MCU’s   subsystems can

be accessed by a program executingfrom anywhere in the processor’s

Figure 2-7he block diagram for the MC68HC   MCU show s a host of o n-boa rd de vice s.

address space and while the MCU isin any of four different operatingmodes. (See the sidebar   and Figure 2on MCU operating modes for a moredetailed discussion.) Included on theprocessor itself are a 16bit  timer sub-system with programmable prescalerand S-bit pulse accumulator; a stan-dard NRZ asynchronous serial inter-face; a high-speed synchronous serial

interface; an eight-channel g-bit A/Dconverter; 512 bytes of EEPROM; 256bytes of static RAM; and “ComputerOperating Properly” (COP) and clockmonitor watchdog timers.

In addition, there are seventeenhardware interrupts and one softwareinterrupt with all on-chip interruptsources being maskable. Two externalinpu ts,IRQ (*INTll and XIRQ (*INTO)are provided for interfacing to otherdevices with the IRQ input being pro-

grammable for either edge- or level-sensitive operation.

Software features include low-power STOP and WAIT modes whichcan be exited by internal or externalinterrupts and a special “wake-up”feature for using the asynchronousserial interface in networked systems.Double accumulators and index reg-isters along with a full complement ofbit manipulation and branch instruc-tions are provided. Six different ad-

dressing modes allow for code opti-mization in all situations.

INTERNAL AND EXTERNAL MEMORY 

Up to 64K of external memory canbeusedontheRTC-HCllboard.Thereare two sockets (U8  and U9),  whichcan each accept an 8K or 32K staticRAM or EPROM. A Dallas Semicon-ductor DS1210 power fail/batterybackup chip converts one of the exter-nal memory sockets into nonvolatile

memory for data logging or programdevelopment purposes. In a typicalRTC-HC11 system (shown schemati-cally in Figure 3), U8 will containEPROM and U9 will contain RAM.

The 68HCll  MCU contains 256bytes of internal RAM located at ad-dresses $0000 through $0100. Thismemory region is also referred to as“page zero” RAM. Typically, a pro-gram will place data which needs tobe frequently accessed in this area.

There are also several machine lan-guage instructions which operateexclusively on data in this area. TheAl-version MCU also contains 512bytes of nonvolatile EEPROM mem-ory. Each byte may be individuallyaccessed and the entire memory arraycan easily be bulk erased. By default,the EEPROM is located at addresses$B600   through $B7FF. This can bechanged by reprogramming a con-figuration register.

An 8K or 32K static memory chipmay be inserted into U9 to provide

December ‘ 9a /January  ‘9 37

Page 34: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 34/80

 Ire  Ja--The  first half  of the RTC-HCl   1 schematic shows the processor, bus buffers, I/O decoding, and serial interfaces.

programs with additional memory.

The U9 socket is decoded in the rangeof $0000 to $7FFF.  Reads or writes tothis area are disabled by the MCUduring any access to an on-chip stor-age location. Access is also disabledfor addresses $7COO to 7FFF by theU7 PAL (see Figure 4)   if the I/O select

 jumper for theon-boardreal-timeclockis installed. The ROM monitor (BUF-FALO 3.4) does not require the use ofexternal RAM. Several iumpers  mustbe set to indicate the sizeof the installed chip andto enable the batterybackupand write-protectcircuitry.

comes somewhat compli-

OKI = IA15   ‘ A 1 4 ‘ A 1 3 ‘ A l 2 ‘ A l l   *  A l0 l BDIOcated  with the 68HCll

C S R A M = /Al5   l /OKI having over sixty con-X 8 0 0 0 = A l 5 ‘ IA14 l IA13 l /Al2 l SEL8 l EX A O O O = A l 5 ‘ /A14 *  A l 3 l IA12 ‘SELA l E

figuration registers, the

X C 0 0 0 = A l 5 l  A l 4 l IA13 l /Al2 *  SELC l Edetails of which are be-

C S R O M = A l 5 *  IX8000 l IXAOOO   l /XC000 yond the scope of thisD S = E article. (TofullyutilizeallR D = RW l E the fea tures of theW R = IRW   l E

68HCl1,  I recommendFigure I-Use o f a PAL greatly  red uce s the num be r of discrete g ate s on  obtaining a copy of eithert he boa rd . t h e “68HCll  Program-

The U8  socket is de-coded at addresses $8000to.$FFFF. During normal

RTC-HCll   operatingmodes, the chip insertedinto this socket will con-

38   C lRCUlT CELLAR INK

tain executable code and the MCUwill fetch its reset vector from loca-tions $FFFE and $FFFF. In some situ-ations, it may be desirable to install alow-power static RAM in U8   andconfigure the battery backup jumpersto continuously maintain its contents.

GETTING IN (AND OUT)

Since the 68HCll   processor con-tains several on-chip peripheral sub-

systems, most of the external I/O linesare shared with at least one othersubsystem. For example, any or all ofthe eight A/D converter inputs canalso be used as TTL inputs. Thus, anapplication which required only fourchannels of A/D could use the re-maining four channels as TTL input.

This flexibility allows for allocation ofon-chip resources with a minimumamount of waste. As a result, configu-ration of each on-chip subsystem be-

Page 35: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 35/80

Page 36: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 36/80

tgure  JD-  Ine second nal t o r the <‘ IC-HC  I I  schematic includes the external memory, real-t ime clock/calendar, andpowe r  supervisor c i rc u i t ry .

Position and/or Velocitv

8 -Axis Prog rammable Motion mtrol l r

ReoderSewceX 75

State-of-the-art Digital Multifunction Controller can be configured in minutesusing “off-the-shelf” components

DCX motherboard contains intelligence/ memory/firmware and 8 sockets for “plug-in” Modules

1 to 8 “plug-in” DC Servo, Stepper or Special Purpose Control Modules canbe mixed/matched on same DCX board

Install in any PC/XT/AT compatible, or use “stand-alone” with RS232and/or IEEE-488 interface Modules

High level interface libraries in ”  C”  and ”  BASIC,” with examples and sourcecode, included

Precision Micro ControlC O R P O R A T I O N

3555 Aero Court, San Diego, CA 92123FAX (619) 565-l 166 (619) 565-l 500

SERIAL OPTIONS

A standard asynchronous serialport with selectable baud rate, parity,character length, and stop bits is pro-vided as an on-chip peripheral sub-system. This subsystem is externallyinterfaced through both a MAX232RS-232 driver (U5)  with true positiveand negative voltage levels, and anSN75176 RS-485 driver (U6)   capableof driving up to 6000 meters of 24AWG, 2-conductor cable. Both inter-

face chips are always enabled withPort D bit 2 controlling the direction ofdata flow on the RS485 interface. Alogic one (1)  on Port D, bit 2 places theRS485 interface driver into transmitmode. Another jumper terminates theRS-485 transceiver with a 100-ohmresistor.

Access to the serial port throughBASIC-l 1 is accomplished simply byusingBASIC’s~~1~~and  INPUT state-ments since this is the default console

port for the BASIC interpreter.A four-wire (In, Out, Clock, Se-

lect), full-duplex high-speed synchro-

40 CIRCUIT CELLAR INK 

Page 37: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 37/80

Page 38: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 38/80

Page 39: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 39/80

Page 40: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 40/80

Page 41: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 41/80

Page 42: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 42/80

Page 43: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 43/80

Page 44: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 44/80

Page 45: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 45/80

FEATUREARTICLEMarkus A. levy 

t . lash memory (in general) is capturing market share from other memory tech-

nologies. It is replacing EPROMs that were traditionally used for code storage

because, along with equivalent nonvolatility, it also allows in-system updates. Bat-

tery-backed SRAMs that once were used for data acquisition, parameter storage,

and even solid-state disks are now targets for the inherently nonvolatile and lower-cost flash memory devices. Many notebook computer OEMs conc lude that low

power, light weight, and reliability are most easily obtained with a completely solid-

state machine, Flash memory has achieved a density ramp from 256K bits to 2

megabits in two years, Combined with a special flash file system from Microsoft, flash

memory can even replace the mechanical disk drive.

Designing withFlash Memory

 s  The re a New Alterna t ive to  EPROM a nd SRAM? 

With the design described in thisarticle, you have a platform demon-strating flash memory’s functionality

and flexibility. Applications rangefrom data acquisition through an I/Oport, to a DOS-compatible, solid-statedisk. But first, a few essentials.

EPROM AND BEYOND

Derived from an EPROM processbase, Intel’s ETOX-II flash memorytechnology has similar nonvolatility,reliability, and array densities. In fact,the flash memory cell is identical to

the EPROM structure, except for thethinner gate (tunnel) oxide. This iswhere the similarities end. The thin-ner gate oxide enables flash memoryto be erased and reprogrammed in-circuit, typically 100,000 times. Thename “flash” is derived from its one-second chip-level erase and microsec-ond-level byte-write times versus theslower, millisecond-level byte-writetimes for conventional EEPROMs.

Flash memory devices have acommand register architecture thatprovidesamicroprocessor-compatible

50    ClRCU/T CELLAR INK

write interface. Erase, program, veri-fications, and other operations areinitiated by issuing the proper com-

mand to the flash memory device.Twelve volts must be applied on Vfor the command register to respondto writes and execute the operation.The 12V   requirement doubles as anadded security feature for data integ-rity. If you are familiar with othermemory subsystems, designing withflash memory is as simple as any othertechnology.

In addition to discrete compo-nents, Intel offers flash memory inSIMM and IC memory card formats.This design will use these modules, soI’ve included some pertinent infor-mation. The512K-bytex  16 Intel FlashSIMM (SM28FOOlAX)  is based on an80-pin JEDEC standard that accom-modates density upgrades and pres-ence detect (a hard-wired ID that indi-cates SIMM density and speed). Theeight l-megabit flashmemory  deviceson this module are paired up as highand low bytes. They  are selected usingthe SIMM’s write enable high and low(*WEH  and *WEL)   signals.

Intel’s IC memory card adheres tothe Personal Computer Memory CardInternational Association (PCMCIA)

standard. This standard specifiesphysical, electrical, information struc-ture, and data format characteristicsof the card. Most impressive is thesize, measuring 85.6 mm x 54.0 mm x

3.3 mm. Its 68-pin interface includes26 address lines used to directly ad-dress 64 megabytes. All buffering andchip-level decoding is containedwithin the card, greatly simplifyingthe board-level design. Intel’s flashmemory card is available with oneand four megabytes. These cards willcontinue to grow in density, becom-ing more and more competitive asdisk drive replacements.

MEMORY METHODS

Three fundamental addressingmethods can be implemented wheninterfacing a flash memory array to asystem bus: linear, I/O, and paged.Eachmethodhasitsbenefitsanddraw-backs. A linearly addressed memoryarray is mapped directly into the sys-

Page 46: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 46/80

tern’s memory space and allows thehighest performance. However, thememory array would be insufficien tlysmall in systems having limitedmemory space, as with the 8086. Butthis method is practical in an 80386 (or 

other 32-bit processor) family systemwith a large memory space available.An I/O-mapped memory array

uses one address-an I/O port-totransfer data. This method requiresthe least amount of system memoryspace but also yields the lowest per-formance.

A page-mapped memory systemis a hybrid of these two approaches. Itallowsaverylargememoryarray witha minimal system interface. A page is

a moveable   window into the totalmemory array. It selectively opens

different portionsof thearray  by writ-ing a page number to the decodingcircuitry. This page ranges in size from8K to64K  bytes. Analogous to a cache,a larger page size requires less fre-quent switching. Although switching

 pages represents a performance deg-radation, this can provide the optimal balance between performance andmemory space availability within thesystem.

Our design is based on this page-mapped technique. A 64K-byte   pagesize reduces the decoding circuitry.The PC/AT has been chosen as theexecution platform, but with minor modifications to the control signals,any microprocessor environment can

 be used. Before beginning this design,it would be helpful to reacquaint

SystemBUS

 AddressI I

Data

l/O  Control

 

-   DecodePresence Detect

Vpp Enable

VPPGenerator 

VPP

IntelFlash

Memory

 ArrayandXceivers

Transceiver Select

Figure 1 --The subsystem s in a f lash m em ory boa rd de sign include m em ory dec od e. I/O .

a n d a 12 V  gene ra to r.

yourself with the basics of the AT I/Ochannel bus.

The subsystems within this de-sign (Figure 1)  are the memory decodecircuitry, I/O and its associated de-code logic, and a 12V   generator for 

Vrr. The Intel flash memory resides infour SIMMs. The board handles anupgrade path to 16M  bytes, based on4M-byte   SIMMs.

ADDRESS DECODING

Flash memory addresses can bedecoded in one of two ways: row-column and conventional decodingusing separate chip enables. The row-column approach of Figure 2is appro-

 priate if you are motivated to reduce board traces. In row-column decod-ing, rows are Output Enables POE),Write Lows (*WRL),  and Write Highs(*WRH);   and columns are Chip En-a b l e s (+CE).  A l t h o u g h t h eSM28FOOlAX  uses only four chipenables, eight are  provided since four-megabyte SIMMs could consist of six-teen 2-megabit flash memory devices.

Page selection, discussed in moredetail later, is accomplished by

writing the page number through anB-bit I/O port to a latch. This willallow access to 256 64K-byte   pages.Page signals, PO-P2, are directly con-nected to A15-A17   on each SIMM.They decode pages on the devicelevel. The row-column signals are de-rived by decoding page signals P3-P7.

They enable components on theSIMMs.

The row-column approach, how-ever, suffers from simultaneous selec-

Dece mb er ‘PO/January ‘9 51

Page 47: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 47/80

SAVE Developmentand Debugging lime

of EmbeddedMicroprocessor Systems!

l INTROL-C Cross-Compilersl INTROL-Mcdula-2 C ross-

Compilersl INTROL Relocating Macro

Cross-Assemblers

COMPILER PACKAGES INCLUDE:Compiler l Assembler l Linkerl Runtime  libran/.  includinga multi-tasking executive l

Support utilities l Full year’smaintenance

 TARGETS SUPPORTED:6301/03.6801/03~  6809.68HC ll l 68000/08/10/12  l

68020/030/881/  851 .32000/32/81/82

AVAILABLE FOR FOLLOWINGHOSTS: VAX and MicroVAX;

Apollo; SUN; Hewlett-Packard;Macintosh; Gould Power-Node; IBM-PC, XT, AT, andcompatibles

INTROL CROSS-DMLOPMENTSYSTEMS are proven, acceptedand will save  you time, money,and effort with your development. All INTROL products arebacked by full,meaningful,technical suppo~

CALL or WRITEfor facts NOW!

t.

  TROC O RPO RATIO N

9220 W. Howard Avenue

Mihuaukee, WI 53220

4141327-7171   FAX: 4141327-7734

Quality Software Since 1979

Figure 2-Row-column ad dressing c an b e used to reduc e b oa rd t rac es.

SMEMFt

SMEMWW

gure 3-Using  sep arate c hip e nab les trad es off boa rd c om plexity for lowpower usage.

TO  SIMM0SOCKET

TO SIMM1

SOCKET

TO  SIMM2

SOCKET

TO   SIMM3

SOCKET

BHEX

A” ~~~~  ENABLE

WRLO-3 and WRHO-3

Figure 4-A simp le b uf fer ing schem e is used to c onn ec t the m em ory to the system bu s.

74x245 6

WI--TO SIMM0

TO SIMM2

Reader Service   lM

C lRC lJlT C ELLAR INK 

Page 48: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 48/80

Page 49: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 49/80

Page 50: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 50/80

Page 51: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 51/80

Figure O--The  flash erase algorithm.

eight flash devices simultaneously.Turning VPP off when not in use con-

serves power, but this capacitancevalue requires approximately 100 ms

56   CIRCUIJ  CELLAR INK

to fully charge to 12 V. Reducing theoutput capacitance value and limitingthe number of flash memory compo-nents accessed simultaneously de-creases the ramp time. The diode,MUR120, prevents inductor currentabsorption from the charged outputcapacitor. During system power-up,spurious noise may generate writeswhich are actually the sequence offlash memory commands that initiateerasure or programming. DisablingV,,  until voltages stabilize providespower-up protection. The MotorolaMC34064P   is an undervoltage sens-ing circuit that begins functioningwhen Va : is above 1 volt. Between 1and 4.6 volts, the MC34064P’s   *RESEToutput or AT systemRESET  clears the74x74. While the 74x74 remains cleared

(or *Q  = l), the 2N3904  is on, the VCinput of the LT1072 is 0 volts, and theVOLTAGE SWITCH (VSW)  output isoff. Writing a one to the VPP   enablelatch forces *Q   low, turning off thetransistor. This puts the VC input at 5V, and VSW output generates 12 V.

You do not need the circuitry justdescribed if your system’s 12-V sup-ply meets the VPP  specifications. How-ever, because software may acciden-tally (or coincidentally) generate a

valid flash memory command to aflash memory address, install a switchtoturnoffv   whennotinuse.Alow-resistance&T (Motorola MTlXP05)performs this duty.

The possibility of spurious writesto the flash memory devices duringpower-up still exists. Again, the sameundervoltage sensor (MC34064) solvesthis problem. The *RESET output be-comes the 74x138 decoder’s active-high enable. This controls the chip or

write enables for the flash memorydevices (Figure 8).

A FEW ADDITIONAL POINTERS

Ground *MEMCS16   so the PC/AT recognizes your board with a 16bit bus width. The original designoperated in both 8- and 16-bit  sys-tems. This flexibility is accomplishedwith additional decoding that multi-plexesthehighdatabusonto thelower

data bus. Again, the IC memory cardautomatically conforms to either bus

width because the extra decoding ishandled internally.

As with any circuit design, it isimportant to follow good design prin-ciples. For example: decouple powersupplies with 0.1~lt.F   capacitors be-tween Va: and Vss  of every device; andshortboardtraceshelpminimizenoise.

SOFlWARE

Hardwarewithoutsoftwareislikea computer without a processor. There-fore, understanding program anderase algorithms is the first step to-wards functional flash memory. Re-call from our earlier discussion thatoperations on flash memory are soft-ware controlled using the internalcommand register architecture. I haveincluded the complete algorithms(Figures 9 and 10). [Ed i fo r ’s  Note: 

Softwarefor this articleis availableon theCircuit Cellar BBSand  SoftwareOn  Disk 18. Seepage92 for downloadingand or-dering information.1 After working theIntel flash memory hotline, I wouldlike to discuss the common mistakes.

The best piece of advice that I cangive is please follow the algorithms.Many people unsuccessfully try theirown custom versions. There are no

cutting comers. Starting with the ba-sics,letmeelaborateafewpointsaboutthe algorithms:

1)  Flash is programmed to a bi-nary zero by adding charge to thetransistor’s floating gate. Contrarily,charge removal erases the cell to abinary one. During the erase opera-tion, the device is “flashed” as chargeis simultaneously and equally pulledoff the floating gate of every memorycell. The device must be prepro-

grammed to all zeros before erasureso an already erased cell is not furtherdepleted of charge.

2)  Prior to writing any command,switch on VPP and allow ample ramptime for proper operation. DroppingVPP below 7.5 volts from within anyoperation, places thedevice in the readmode. Similarly, abort an operationby issuing two consecutive resetcommands (FFH) followed by the readcommand @OH).

3) Closely observe delay times toachieve the highest performance and

Page 52: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 52/80

Figure IO--The  f lash prog ram ming a lgo- 

r i thm.

reliability. Use the ST1   instruction inthe software drivers to avoid systeminterrupts during these delays.Execute CLI once the correspondingverify command is issued.

4) The verify operation internallycreates marginal conditions to ensureaccurate and reliable results. The 6-usslew time delay following the verifycommand allows the margin voltages

to settle. In the verify mode, pro-grammed data is guaranteed to be

“permanent” whenitmatches thedatabeing programmed.

USING YOUR PAGE MEMORY BOARD AS A DATA RECORDER

There is a nearly endless list ofdata recording applications, includ-

ing digital imaging, digital photogra-phy, point-of-sale terminals, patientmonitors, and flight recorders. Thepage memory board is appropriatefor many data recording applicationswhereanI/Oportof thePC/ATaccu-mulates data.

The programming algorithmdemonstrates the byte programmingcapability of flash memory. In otherwords, once the device is erased, bytesreprogram randomly. In some record-

ing applications, data is received inpackets, A pointer determines whereto begin programming the next freelocation within the flash memory.

Interleaving increases write per-formance by using the idle time dur-ing the lo-u.s  program delay. Ad-dresses are offset such that each suc-cessive data byte gets written in dif-ferent devices, looping back in time toissue the verify command. Readingthe data back would be done in a

similar fashion.Word-wise, or parallel, program-ming of two devices provides anadditional means of increasing writeperformance. Note that flash memorydevicesmayprogramatdifferentrates.Therefore, the original algorithm mustbe modified during the verify opera-tion. If only one byte of the word hasverified, the program command anddata are sent again to the unverifiedbyte. Mask the command sent to the

device that verified to maintain word-wise programming. A mask is thesubstitution of a reset command forthe program and verify commands.That way, the programmed bytes donot get further programmed on sub-sequent pulses.

The page memory board willperform these software techniques.However, first write the software thatdetermines the location and capacityof the board. First, scan the I/O space

for the board’s identifier. The locationof the first identifier byte is also the

8031 In-CircuitEmulationOur emulator provides most features

of an 8031 in-Circuit-Emulator at asignificantly lower price. It assists in

integration, debug, and test phases of development. Commands include:

disassembly, trace, breakpoint,alter register/memory, and load Intel

Hex file. 199

8051 SimulationThe 8051 SIM   software package

speeds the development of 8051family programs by allowingexecution and debug without a

target system. The 8051 SlMulatoris a screen oriented, menu

command driven program doublingas a great learning tool. 99.

8031/51  SingleBoard Compher

A fast and inexpensive way toimplement an embedded controller.8031/32  processor, 8+  parallel I/O,

up to 2 RS232 serial ports, +5  voltoperation. The development boardoption allows simple debugging of 8031/51   family programs. ggea

PrototypingSystem

The IPC-52 development systemallows you, the designer, to

concentrate on Application SpecificCircuitry only, because the 8052,

RAM EPROM, and l/O sections areburlt-in  and fully functional. The

prototyping bread-board isintegrated into the system - save

days of development time. $220

Call us for your customproduct needs.

Other products available:

MyGAL  -  GAL Programmer $199FORTH Card -  FORTH developmentcard for STD Bus $279 (OEM-$1 99)

(619) 566-l 892

ReaderService   138December 9O / J anua r y  ‘9 57

Page 53: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 53/80

Page 54: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 54/80

Page 55: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 55/80

Screen coordinates start with Row 1 and Column 1 in the upper left column.The effect of coordinates outside valid screen boundaries is undefined.

Cursor Control

ESC[r;cH Move cursor to specified row and column

ESC[r;cf ditto, this is a synonym

ESC[nA Move cursor up n rows, stop at top row

ESC[nB Move cursor down n rows, stop at bottom row

ESC[nC Move cursor right n columns, stop at right column

ESC[nD Move cursor left n columns, stop at left column

ESC[s Save cursor location

ESC[u Restore cursor location

ESC[2J Erase display and move cursor to upper left

ESC[K Erase line from cursor to right edge

Display Attribute Control

Once set, an attribute applies until it is changed. Some

codes  set multiple display attributes.

ESC[xm Set display attribute to x

ESC[x;ym (You can set several attributes at once)

The most useful “x”   parameters are:

0 Cancel all attributes (return to white on black)

1 Bold or bright

2 Dim or normal

5 Blink (only on displays that support blinking!)1  Reverse video (black chars on white background)

30-37 Set foreground color

40-47 Set background color

Color codes are:30/40 black

31/41 red

32/42 green

33/43 yellow

34/44 blue

35/45 magenta

36/46 cyan

37/4-l white

Figure I It m? ANSI COntfOl seq uenc es al low a rem ote dev i c e  to c ontrol the c ursor loc at ion a nd display c olors on a loca l terminal emulator. The ESC  symbol de signa tes the Escape character, A SC ll c od e 27 dec ima l o r 16  hex.   There  a re no sp a c es in the seq uenc es, and the last letter must b e c ap italized as show n.

rewrite the whole smash from the topevery single time. Something Must Be

Done!

ANSI ESCAPEES

Fortunately, the American Na-tional Standards Institute (ANSI) hasdefined a set of cursor, color, andscreen control codes that are (loosely)implemented in the PC world. Figure1 shows the most useful codes; whilethe LCD can’t display colors, it shouldat least gracefully ignore those codes.Most PC terminal emulators have an“ANSI BBS” mode in their bag of tricks,

62   C lRC Ull  CELIARINK

so you can probably use these codeswith no trouble.

Notice that these control se-quences start withan  escape character(1B  hex, 27 decimal, yclept ASCII 271,hence their common name of “ANSIEscape Sequences.” A left-hand squarebracket follows the ESC, which identi-fies this group of commands. Somecommands have one or more numericparameters and all end with an upper-

or lower-case letter (and the case issignificant!).

For example, the sequence to setthe cursor to row 2, column 3 lookslike ESC   2 ; 3H”. The sequence

"ESC 1; 3 3 ; 4 lm” changes the colorof allsubsequent characters to brightyellow on a red background, at leaston a color display. (Remeber that ESCrepresents the escape character.) Thenumbers are simple ASCII, not binarycodes: the color-change sequence isten characters long, not eight.

An ANSI driver intercepts allcharacters going to the display. Itpasses through all “normal” charac-ters unchanged, but interprets theANSI control sequences and takeswhatever action is appropriate; thecontrol sequences are not displayedon the screen. Under DOS the ANSIconsole driver is a separate chunk ofsoftware installed as a device driver,while under OS/2 you get ANSI con-trols “free” with every session.

Although you could write spa-ghetti to decipher the sequences, Fig-ure 2 shows a state diagram that maymake more sense and certainly re-sults in better code. When each char-acter arrives, the action you takedepends on which state you’re in: Ifthe character doesn’t match any of theactions for the current state, you reseteverything and send the character tothe LCD display. Remember that thestates themselves don’t do anything:

they justremember”whereyou were”until the next character comes in.

The state machine driver code istoo bulky to fit here, but there is oneinteresting aspect that bears mention-ing. Most state machines you’ll seeare based on a table of “current stateversus input character” that deter-mines which routine gets control.Because the ANSI sequences have afairly restricted syntax, I figured outhow to trigger the code based on ei-

thera specific  character (the equal sign)or a general class of character (anydigit). Take a look at ANSI . A5 1 forthis column to get the details; it maysimplify some of your own code.

The driver stores all characters ina buffer, so the action routines trig-gered by the final letter can validatetheir parameters. Because the Set Cur-sor Position and Display Attributesequences have several numeric para-meters separated by semicolons, Iincluded a “semicolon detector” ac-tion to extract each preceding number

Page 56: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 56/80

Figure 2-This sta te m ac h ine de co de s the ANSI co ntrol seq uen c es shown in Figure 1.The f i na l le t te r in ea ch seq uenc e d ete r- mines the func tion.

from the buffer into a numeric array.

When the terminating letter arrives,the decoder action routine can accessthe saved parameters from the array.

A side benefit of buffering all thecharacters comes when the ANSIdriver receives a defective sequence.Rather than just ditching the charac-ters, the driver dumps the buffer tothe LCD panel so you can see whatwent wrong. This simplifies debug-ging, and also permits programs todisplay “bare” escape characters

(which show up as a left arrow). Notall ANSI drivers support this func-tion, so you can’t depend on it!

The CDEMOANS programexercisesthe ANSI driver by sending a series oftest patterns to both the console andLCD. The two displays should match,save that your color monitor will havecolored characters for some sequences.[Editor’s Note: Software for this articleis available on the Circuit Cellar BBS andSoftware On Disk 28.  See page 92 for 

downloading and ordering information.1Photos 1 and 2 show how a faked

r

status display looks on both displays;while the PC console is more attrac-tive, the LCD panel gets the job done.

If you look closely at those pho-tos, though, you’ll see somethingsuspicious: where did those decimalpoints come from?

FRACTIONAL VALUES

Integer arithmetic is good enoughfor nearly all microcontroller applica-tions, but sometimes you really needfractions. For example, a stepper motormight move 7.5 degrees per step anddrive a slider 0.05 inches each time.You could pick tenth-degree units inone case and lo-mil steps in the other,but Wouldn’t It Be Nice If you didn’thave to write special arithmetic and

display routines for each situation?The obvious solution is to usefloating-point numbers. The catch isthat floating-point arithmetic is ex-pensive in terms of both code size andexecution speed. Microcontrollersdon’t have numeric coprocessors  (bydefinition, I think), so all calculationsmust be done in software (or, if youplease, firmware). The canonical“Hello, world!” occupies 5903 bytesusing the Avocet fixed-point library;

the floating-point version requires16008 bytes and doesn’t include anyfloating-point operations!

To put this in perspective, theFirmware Furnace routines don’t use printf ) orthefloating-pointlibrar-

ies. As a result, the keypad, LCD,clock,NVRAM, and C utility routines pre-sented so far weigh in at about 8Kbytes. There are some good reasonswhy I’m not enthusiastic about float-ing-point arithmetic.. .

iiiiiiii.ffffffff  i ht fraction bits

I eight integer bits

Numbers are represented in two’scomplement form:

0.0 = 00 00 0.0039 = 00 011.0 = 01 00 -0.0039 = FF FF

-1.0 = FF 00 127.9961 = 7F FF0.5 = 00 80 -128.0 = 80 00

-0.5 = FF 80

Figure J-The  fixed-point numeric format

used in the Firmwa re Furnac e projec t a l- low s for numbe rs be twe en - 128 and 128.

w ith a resolution of 0.39%. Ea c h num b er oc cup ies two b ytes.

FAST COMPLETE 

ACCURATE 

PRAM  TEST DIPS  - SlMMs  - SIPS

RAMSTARIns RESOLUTION 

 ACCESS SPEED VERIFICATION80 ns. thru  180 ns. (Std.) $249.0

45 ns. thru 110 ns. (Fast) $349.014MEG Option  Add $ 89.0’

 AUTO-LOOPContinuous Test 6.25 MBitsisec

DAPTERS:SIMM/SIPADAPTER $189.01

Tests 64K, 256K,  1 M & 4M Devices8 or 9 Bit versions.

NTX ADAPTER $149.0

Tests 64 Pin Dual-EdgeLasetwriter Type SIMM’s

4 X ADAPTER $ 89.C

Tests 64K & 256K By 4 Bit Devices

 AC ADAPTERRegulated +5V @  1 Amp.

$ 18.r 

FREE RAMFACTS

DRAM NEWSLETTER 

COMPUTERDOCTORS

9204-B Baltimore Boulevard

College Park, Maryland 20740

dADE   IN U.S.A.

>derSetice l23

December W/January ‘9 63

Page 57: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 57/80

Page 58: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 58/80

Photo P--Thesame  displayash  Photo looksmuc h n iceron  a full-c olo r CRT, but isn’ t q uite 

as conve n ient.

implementation) to hold the interme-diate results and product. Extracting

Figure 4c   shows how the dividend is

the result is a simple matter of shiftingaligned to the high end of a four-byte

the product eight bits to the right andunsigned long int and the divisor shifted into the middle of another.

returning the low-order two bytes.Division, being the inverse of 

This produces the result directly in the

multiplication, requires more setup.lower two bytes of the quotient. Anunshifted divisor would put the result

in the middle of the quotient, thusneeding a shift after the division.

In both routines, I calculate thesigns separately and perform the longarithmetic on unsigned quantities toavoid obscure problems with C’s signextension and bit shifting logic. I’m

 pretty sure the code can be tuned up!

Whatever you do, test your code atthe ugly boundary conditions: Ithought I had this stuff working quitea few times before it reached thiscondition.

Displaying a fixed-point number involves two steps because the inte-ger and fraction parts must be con-verted separately. The former is easyenough; s e e ConShowInt   i nCONSOLE. ~5  for details. Convert-ing the fraction to ASCII is ordinarilya tedious operation involving longdivision and considerable hocus-po-cus. Listing2 showsa  shortcut: entriesin a table relate fraction bit locationsand the corresponding packed BCDequivalent, accurate to four decimal

 places.The code in Listing 2 tests each bit

 position and accumulates a BCD total

IBM Surplus. 8 wire.4 windings. 7V @ 350 mA1.8’ (200 steps per rev.)

DC. res. 20 ohm ea. 25 oz. in,torque. Works great on 5vdc. W/Data

 l  by OMRON. DPDT10 A. cont. 150 ohm co1x1.5x.75 inch. $2.95 e

 2  by P&B. SPST-N.O.

30 A. cont. 160 ohm coil

High Voltage I  Very Dangerous.11OMFD 450VAXlAL . . . . . . . . . . . . . $1.99800 MFD 450V CAN . . . . . . . . . . . . . . $4.95

5100 MFD 350V CAN . . . . . $6.95 ALL NEW. NAME BRANDS

5534 (DIP) . . . . . . . . $0.99MC3403 (DIP) $0.49TL084 (DIP) . . . . . . . . . . . $0.99RC4558 (DIP) . . . . . . $0.494136 (DIP) . . . . . . . . . . . . . . $0.69

LM339(DIP)   . . . $0 .4975491 (DIP) . . . . . . . . . . . . . . $0.49

Reader Service lGO

Decembe r W/Janua ry  ‘9 65

Page 59: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 59/80

Page 60: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 60/80

Page 61: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 61/80

Page 62: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 62/80

Magnetic Levitation:An Example inClosed-Loop Control

FROMTHE

BENCHJeff  achiochi 

How to  Defy  Gruvify  Wifhouf  th e  Use  of  Black Magic

I Y

1 ve always had an urge tobe a magician. While other kidswere watching Mighty Mouse onSaturday mornings, I’d be tunedinto Mark Wilson performingimpossible feats of prestidigita-tion.

One of the more common il-lusions is the levitation of ob-

 jects. The magician or illusionistwill cause an object to literallyrise or float without any visualmeans of support. Solid hoops orrings are passed around the ob-

 ject to confirm the reality of thesituation. Even though we knowthere is logically some unseenmeans of support, we allow our-selves to be hoodwinked simplyfor entertainment purposes. Suc-cessful magicians are most profi-cient at disguising their secrets.

NO VISIBLE MEANS OF SUPPORT

If you’ve been in any gift/novelty store recently, youmay have seen one of the “floating orb” novelties. This isa simple, freestanding frame in which an object, usually asphere, is held visually unsupported in midair. Quite astunning illusion!

Upon closer examination, you’ll discover that mag-netism is the key to this example of parlor trickery. Amagnetic field is generated by an electromagnet hidden inthe top of the frame and attracts the sphere upward. Aninfrared transmitter/receiver pair is mounted across theframe about one inch below the top. As the orb is gentlylifted into the IR beam’s path, the signal strength is re-duced at the IR receiver. When the linear output of the IRreceiver drops to about 2.5 volts, an electromagnet isswitched on. As the IR reception is further reduced by thesphere rising toward the electromagnet,   the voltage to thecoil is also reduced. This reduces the magnetic field andgravity begins to win. When the sphere drops, the receivedIR increases which strengthens the   magnetic field. An

equilibrium is reached where magnetic attraction exactlycounters gravity somewhere within the IR  beam’s path.

OPEN VERSUS CLOSED LOOP

Any control process can operate in an open- or closed-loop fashion. However, the term “open loop” is an oxymo-ron. As the word “loop” suggests, it is made up of acontinuous path, whereas “open” suggests a noncontinu-ous path. Open-loop control is simply an action withoutany knowledge of the result, like turning on the porch lightwithout looking out the window to see if it actually wenton. On the other hand, closed-loop control adds some kindof verification that the control has had some effect on thetask. One peek out the window confirms the result. Eitherthe light did in fact go on, or it was on and you turned it off.Possibly, it is burned out or, even worse, another slip ofpaper gets added to your job jar. So, you can see thatclosed-loop feedback can not only show the process isoperating correctly, but, just asimportantly, what has to bedone to correct any errors in the output.

Decembe r ‘90/January  ‘9 7  1

Page 63: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 63/80

Page 64: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 64/80

Page 65: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 65/80

where Ki 

Figure 3-An integral mo de outp u t cha nge s faste r fo r la rger ra te s 

of e rror inp ut a nd d rives the o utp ut a t a slow er ra te a s the e rror 

inpu t a pp roa che s zero .

where:P = output

K, = gain constant

dEP 

dtrate of change of error

PO = output with no error rate

ADDING THE PROPER INGREDIENTS

Most industrial applications which use closed-loopcontrol make use of a combination of controller modes.Thisisaccomplished by combining the proportional modewith either the integral or the derivative or both. The PI(proportional-integral) mode eliminates the offset errornormally associated with the proportional mode. The I’D(proportional-derivative) mode is used to handle fastprocess load changes. While the PID mode can handlevirtually all process conditions, it is the most complex.

Process control does not necessarily mean computercontrol. This is obvious in the simplicity of our home

heating systems. Once other parameters enter into thepicture, however, things change. Nightly temperaturesetbacks, different temperatures in each room, interfacingfor external control (e.g., hand-held infrared) make controlimpossible for a simple mechanical thermostat. Microcon-trollers give us the ability to change algorithms easilythrough software, which really beats getting out the oldsoldering iron and attacking the hardware to alter the

Model 250 for Algorithm Development,

Data Acquisition, Instrumentation, Audio.

l TMS320C25 DSP at 10 MIPS.

l Up to 192 Kwords RAM.

l Multi-Channel Analog IO - 25OK Samples/ x.l Development Software, including Assembler &

Debugger.l Applications Software includes FFT. Signal

Display, Data Acquisition &Waveform Editor.

l No Gap Sampling to/from Disk at Very HighRates.

l Supports Multiboard & Standalone (EPROM)

Operation.l From S109.5.  Other DSP Products Available.

DALANCO SPY89Westland  AvenueRochester, N.Y. 14618

(716) 473-3610  _

ReoderServicet 8

Page 66: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 66/80

V = Kd (where Kd  = R2x C)

Figure 4-7he ou tp u t o f a d er iva t i ve m od e c on t ro lle r is d r iven b y 

how fast the e rror inp ut is c ha ng ing.

offset, gain, integral, or derivative parameters every timewe want to adjust the system.

APPLYING THE MAGIC OF MICROPROCESSORCONTROL

Process control with a simple input and output doesn’trequire a microcontroller. However, using a simple proc-ess allows one to easily grasp the basics and the advan-tagesof using this approach on a more cost-effective basis.

With a small amount of signal processing, the position(error input) of the process load (ball) can be transferred toa microcontroller through an analog-to-digital converter,providing an error signal. The output control uses a digi-tal-to-analog converter to vary the voltage of the electro-magnet. The hardware selected for this project includestheRTC52andRTCIO.[Editor’s  Note:See  “From theBench”

in the April/May ‘89 issue of CIRCUIT C ELLAR INK ( 8)  for adescription of the RTC52 and RTCIO boards.1 Both an A/Dand a D/A converter are included on the RTCIO board.

Figure 5 shows the test setup which is fairly simple toconstruct. A hefty electromagnet’s field is directed by asteel bar added to the top pole. This bar is bent down ateach end creating flux lines which tend to pass through thesphere being levitated. An IR transmitter and receiver areplaced below the electromagnet within the magnetic’slimit of attraction. The analog circuitry to interface the IRinput and solenoid driver is wired on a prototyping board.

The hardware stays the same no matter what algo-

rithm software we use. Because the process load will bechanging rapidly, I’ve chosen the combination propor-

Graphics Gemsedited by 

Andrew S. Glassner This handbook provides practi-

cal solutions to graphics problems,and every graphics programmer will find it an essential tool insaving time and energy in their daily programming activities.

August 1990, 833 pp., $49.95 

ISBN: O-12-286165-5

Curves and Surfacesfor Computer AidedGeometric Design

A Practical GuideSECOND EDITION

Gerald Farin

1990,444 pp 39.95/ISBN:   O-12-249051-7

The Desktop FractalDesign SystemMichael F. Bamsley

Includes The Desktop Fractal   DesignHandbook and one floppy disk.

IBM Version: The system requires anIBM, or compatible, PC with a graphics

 board (EGA or VGA) and 640K memory.

1989, 39.95/ISBN:   o-12-079063-7

Macintosh version: The system runson Macintosh Plus, the Macintosh SEseries, and the Macintosh II family of computers, with a megabyte of memory.Color graphics is not required. No mathcoprocessor is necessary. The softwarewill work with version 6.0 or higher of the Macintosh operating system.

August 1990, $39.95ISBN: O-12-0790645

Fractals EverywhereMichael F. Bamsley

1988,394 pp., 39,95/ISBN:   O-12-079062-9

An Introductionto Ray Tracingedited by 

Andrew S. Glassner 

1989,327 pp., 49.95/ISBN:   O-12-286160-4

Order from your local bookseller or directly from

ACADhCPRESS

CALL TOLL FREE

l-800-321 -5068Harcourt   Brace Jovanovich,   Publishers Quote this reference number for 

Book Marketing Department HO120 free postage and handling on1250 Sixth Avenue, San Diego, CA 92101 your prepaid order 10120

Prlcess”b,ecttochangewltho”tnotlce   01990byAcademlcPress.Inc  AllRlghtSRBSBrYsd  TWSS--IDIP

Reader Service Xl01

Decem ber ‘PO/ January ‘9 I 75

Page 67: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 67/80

Page 68: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 68/80

Page 69: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 69/80

SILICON

Goodbye CRT, Hello LCDUPDATE

Tom unff l

I can’t remember for sure, but I think my first experi- THE GOOD, BAD, AND UGLY ence with an LCD (Liquid Crystal Display) was during thedigital watch craze of the mid-‘70s. Everybody tried to get As mentioned, the original and still claim-to-fame forin the business-the boom attracted unlikely entrants the LCD is low power consumption. A brief explanation ofincluding Intel where I worked (the idea was to sell chips LCD basics will show why.with wrist bands). Needless to say, that episode isn’t dis-

cussed in mixed company.

The liquid crystal phenomenon actually was discov-

ered over 100 years ago but the concept laid dormant untilthe ‘6Os, when revitalized research finally gave us our ’70sLCD watches and calculators.

Anyway, my first digital watch had a seven-segment-type LED display. The only problem was that due to highpowerconsumption,theLEDdisplaycouldn’tbeleftonallthe time.Instead, the watch had a tiny button to turn on thedisplay only when necessary.

Figure 1 shows the organization of a simple TN(Twisted Nematic)  “reflective” LCD. Naturally, the key

Of course, the concept was anergonomic nightmare. For instance,working the watch while talking onthe phone meant either switchingthe phone into the shoulder/ear-

 jam position or executing a maneu-

ver something akin to punchingyourself in the nose. Checking thetime while driving a car was also anexciting proposition, leading to theinsight that it’s better to be late foran appointment rather than neverarriving (at least in one piece) at all.

h  Glass

for LCDs is the “liquid crystal”  ma-terial-a proteingoo. Likeacrystal,the material has the property of“turning” light in a certain direc-tion. Like a liquid, the orientation ofthe crystal is “fluid”; in particular,the orientation can be changed by

theapplicationofanelectronicfield.

  Rear Polarizer

  Reflector

To make a display, the liquidcrystal is sandwiched between agrid of electrodesand sheetsof   glass.The other key are two polarizers(front and back) which are oriented90 degrees out of phase. Polarizers

Enter the LCD, a technologywhich, thanks to “reflecting” rather   1 I

than “emitting” light, consumed solittle power that the display couldremain enabled at all times. Since it

  tive   LCD. -

 have the property of only passinglight which is “aligned’ with the

Figure 1 -The orga nizat ion o f a simp le TN r e f l ec -

polarizer. Perhaps you once triedthis experiment during   the heydayof “polarized” sunglasses. Take two

relied on ambient light, the LCD watches still needed ahigh-power lighting system (and the dam button) for usein the dark. In practice, there was usually enough daylight(or even moonlight) so that button-fumbling was kept to aminimum.

From humble wrist watch beginnings the LCD hasslowly but surely improved and flourished. Now, LCDtechnology has reached the point that big changes indisplays and associated products are on the horizon.

In fact, it can be argued that the historical mainstaydisplay, the CRT, is threatened by the emerging LCD tech-nology. Sure, it won’t happen overnight, but read on and

 judge for yourself to what degree the LCD puts the CRT atrisk of extinction.

lenses and put them on top of each other. Now, lookthrough the pair as you twist them relative to each other.Sure enough, more or less light passes as the alignmentbetween the two lenses is changed.

Finally, behind it all is a reflector panel. Remember,the simplest LCDs   rely on ambient light.

So, light enters the first polarizer and is aligned in onedirection. Next, the aligned light enters the liquid crystaland is either “twisted” or not depending on whether thecrystal isenergized  or not. Light that is twisted by the crys-tal can successfully pass through the second polarizer(which is twisted relative to the first polarizer) to thereflec-

tor and ultimately back to your eager eyes. On the otherhand, light which doesn’t get twisted by the crystal is

Decem ber W/January ‘9 1 79

Page 70: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 70/80

blocked by the second polarizer andthus not reflected.

Low-power operation is a re-sult of the fact that theliquid crystalrequires little power to retain orien-tation and, like a CRT, need only be“refreshed” periodically. Using arow/column addressing scheme,

only a fraction of the panel’s “pix-els” (as few as l/100  or l/200)  areenergized at any point in time. Thus,the basic “good” of LCDs  is thatpower consumption is tiny-typi-callyO.O25-1   Wdependingonpanelsize. Contrast this to the 75 W or sofor a typical CRT.

backlight technologiesareavailablewhich offer various tradeoffs forlight level and color, size, durabil-ity, and power consumption. Themajor contenders are EL (electrolu-minescent) and FL (fluorescent)lighting schemes. EL is best for low-end applications due to reduced

thickness, weight, and power con-sumption while, at the cost of wors-  Rear Polarizer ening these three factors, FL gener-ates a brighter full-spectrum light.f FL Backlight Another pair of related prob-lems is limited contrast and view-ing angle; both are byproducts of

I I losses and variabilities in the light’stwists and turns. Basic TN LCDs

Figure z-m8  double SUP81  h&ted  nematicdisplay ad ds another l ayer  of l lquld  c rystal.

may have contrast ratios as low as4:l   (read “light black characters on

The only intrinsic ‘bad” forLCDs  is that the liquid crystal, likeany other liquid, acts up whenexposed to temperature extremes. Most panels are speci-

fied to operate in a range of 0_5O”C,  but some are limitedto even a narrower range (e.g., 1040°C).   For thenonmetricout there, suffice it to say you shouldn’t expect your LCDwidget to work in a snowstorm or a heat wave.

The basic ‘TN reflective” LCD described so far (thetypical calculator/watch-type display) does suffer from avariety of “ugly” problems. Most basic is the reliance onambient light. The solution is “backlighting.” A variety of

a dark gray background”-in other words, don’t lose your

eyedoctor’sphonenumber).Furthermore,  theusefulview-ing angle may be as little as 30-35 degrees. If you’ve evertried to share an LCD display with another person (show-ing them something on the screen for example), you knowit only works if both of you are real good friends. Unlessyou butt heads, one of you will see mush!

The solutions that have emerged for contrast/viewingangle problems are variations of the “Super Twist” theme.

Includes linker, librarian, and cross-reference utility

Generates full source-level debugginginformation

 Automatically bank switches programgreater than 64K using MMU

Linker allows code placement at bothphysical & logical addresses

Outputs binary, Intel Hex and Extended

Intel Hex filesCompatible with M80, SLR, 2500AD,  and

 Avocet Assemblers

Built-in MAKE facility supports depen-dency file checks

FREE demo disk available

Compatible C-Compilers available soon!

If you’re ready for a fast, full-featured, affordable product,

give us a call. You’ll be pleasantly surprised.

So~ooLs  INC.8770 Manahan Drive

Ellicott  City, MD 21043

301-750-3733

301-750-2OO Fax/BBS

Lisa D’Ambrosia49 Walpole Street

Norwood,  MA 02062(617)   769-8950

Fax: (617)   769-8982

Barbara Best569 River Road

Fair Haven, NJ 07704(201)   741-7744

Fax: (201) 741-6823

Christa   Collins7640 Farragut Street

Hollywood, FL 33024

(305) 966-3939Fax: (305) 985-8457

Nanette Traetow242 East Ogden Avenue,

Suite AHinsdale, IL 60521(708)   789-3080

Fax: (708)   789-3082

Barbara Jones&  Shelley Rainey3303 Harbor Blvd.,

Suite G-l 1Costa Mesa, CA 92626

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

80   ClRCUl7 CELlA  R INK Reader Service IS6

Page 71: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 71/80

Page 72: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 72/80

Page 73: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 73/80

Page 74: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 74/80

Page 75: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 75/80

CONNEC-TIME

Conduc ted by  

Ken Davidson 

Exc e rp ts from the  C irc uit Ce lla r BBS 

The Circuit Cellar BBS300/  1200/2400 bps

24 hours/7 days a week(203)  871-1988

Four Incoming LinesVernon, Connecticut

These are busy times on the Circuit Cellar BBS. In thisissue, we’ll be covering discussions about state machines,modem usage in other countries, and a nifty TV antennanow on the market. Let’s start off with a subject near anddear to those just starting ouf in engineering: school.

Msg :31195From: ROBERTO PUON To: ALL EEs

I’ve had electronics as a hobby for around four years. Most of what I know I have learned either by trial and error or from TheCircuit Cellar. Right now I am a junior in college and I am an EEmajor. I’ve not taken but one (digital) electronics course. I reallyenjoy electronics, and if my job is going to be as fun as my hobbyhas been, work is going to be a party!

I have one question for all of you Electrical Engineers which youmight have asked yourselves when you were in college: Howmuch of the math that you studied in college do really use in thefield?

Msg :31211From: JAMES D STEWART To: ROBERTO PUON

As a non-degreed engineer, who worked his way up from fixingmissiles in the Army in 1970 to project leader presently, I wouldguess very little. Ohm’s law and basic math skills are all I’ve ever 

used. You could probably argue that they are all that I have. Theone place that I have been stuck in the past is trying to understandalgorithms used with digital signal processors. It hasn’t been aserious problem yet, and my contingency plan is to hire a tutor asneeded when I start to work with them seriously. The Universityof California at Berkeley is next door and there are lots of mathgiants willing to work cheap.

I think the amount of math that you need is greatly dependentupon the type of engineering that you are doing. Most engineersdoing microprocessor development do very little math. If youwork in communications, process control, or signal processing,you will need more higher math. I feel that if I had had moremath, perhaps I would be better able to visualize problems andfind quicker solutions.

Msg 81279

From: KEN DAVIDSON To: ROBERTO PUON

That sums it up pretty well. When I was going through school, I

kept saying, “But that’s not the way it works in the *real* world.”Strictly speaking, with digital electronics you rarely worry about

 poles and zeros and Norton equivalents, but it’s absolutelynecessary (in my opinion) to have a solid background in that stuff 

 just so you know why things work the way they do. Much of thetheory and math doesn’t directly apply to real-world engineer-ing, but you often have to keep it mind when deciding on designtolerances and what you can and can’t get away with.

I have a friend that I graduated with who is working on cordless phones at AT&T. His digital experience is pretty weak, but he’san ace analog designer. He uses a lot of the math and theory everyday that I’ve been exposed to in the past, but was happy to put

 behind me. I was just talking with him this weekend and he wassaying something I agree with: you don’t go to engineeringschool to learn about what chips are out there or the best way tolay out a PC board. You go to school to learn the basics of thedesign process and to learn how to learn.

The best thing that can happen to you when you graduate is to be paired with a 20-year veteran. He’ll be able to teach you thingsyou never dreamed of in school, but with the proper  background,you’ll be prepared to understand why things work the way theydo and how to do things the “right” way. There is absolutely noway you’ll be able to come straight out of school and design acircuit that works, is cost effective, and is easy to manufacture

(unless you’ve had hobby or summer experience, but even thenyou’ll probably need some help). Hell, we weren’t even taughthow to solder while in school.

Just keep plowing through it and telling yourself you’ll be a better person for doing it. ;-)

Msg :31280From: STEVE CIARCIA

I are an engineer too. :-)

To: ROBERTO I’UON

How much math you use is really dependent upon the job. If youare assigned to design radar antennas and don’t know math you

Page 76: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 76/80

are in big trouble and soon out of that job. Just using off-the-shelfICs   in noncritical control designs, with the manufacturer’s specsunder one elbow, is not particularly math intensive.

In my opinion, you cannot be a good engineer without knowinga good deal of math. This math could be broad ranging, includingphysics and chemistry, and not necessarily just narrow hard-headed stuff for designing your own ICs.  A good engineer (EE)will know what Fourier transforms are, but 20 years after study-

ing them he might not know how to solve them by hand. A goodEE will instead know immediately where to find a book on thesubject, a math egg-head to do it for him, or a computer programthat will do it. If all else fails, he can hope that he’s been on the joblong enough to have enough seniority to reassign the task to thenew kid on the block and go back to his tough management job(managing the coffee and doughnut fund).

Engineering is 90% intelligent gut reaction and 10% mathemati-cal analysis. The only problem you’ve got as a young engineer isthat the majority of old geezers on the project will be winging itby then on politics and reputation and the new guy with have todo the work. In that case you better know some math.

Don’t get me started on this. If you are in school, then learn some-thing. If you really shouldn’t be an engineer, don’t find it out onthe job.

Msg z31295

From: ED NISLEY To: ROBERTO PUON

The single most fundamental mathematical operation you’ll everlearn is long division...and I was taught this long after I gradu-ated, so you can save some time.

What you do when you’re starting work on a problem is take twocritical parameters and divide one into the other. If the ratiodoesn’t make sense, the project is usually in serious trouble.When you do this sort of thing in your head you develop areputation for Great Wizardry.

Unfortunately, in order to know which two numbers to divideand when the result makes sense requires a solid background inthe math you’ll get in college. For example, you need to knowhow fast is do-able, how strong is something about “that thick,”and how heavy is something about “that big”. . . which you getfrom knowing physical and electrical properties.

I took the dreaded Fields & Waves courses in the Physics ratherthan the EE department because I really gummed up my sched-ule (took a semester off killing calves at a medical research center,but that’s another story). The EEs   learned about transmissionlines, klystrons, and stuff like that. In the physics classes, we didthe really grim math (I knew I was in good company when thePhysics major in the back row asked ‘What’s a tensor?” after thefirst lecture.. .)  the hard way. But, while I can’t do any of that stuffany more, I have a reasonable appreciation for why you buildhigh-frequency stuff the way you do.

No, you’ll not need much of what you learn, but everybody usesa different portion. The value of your education is what youknow when you’ve forgotten everything you learned inclass.. .  think about it.

Afl too often, we get stuck in the mindset  that for u  digitalcircuit to doany  useful work, a processor must be included.

 Many times, though, a simple state machine may do thetrick using less board space and at a much lower cost (interms of both actual hardware and design time).

Msg :31396

From: DAVID M. WILLIAMS, SR. To: ALL USERS

Does anyone have or know where I can obtain plans for a digitalcypherlock. I have a twelve-key keypad and need something forthe kids to use to activate the garage door opener. I had a unitmade by 3M but a lightning strike took it out and it’s to hard toget parts for the board. Seems 3M had some chips tailored madeand no one including 3M or Harris, who made the chips, hasreplacements. If you know of some plans, I would appreciatesome info.

Msgk3 566From: BOB PADDOCK To: DAVID M. WILLIAMS, SR.

Well, if your keypad is a 2-of-7 or 2-of-8   type and not themultiplexed type (I was just about to send a message to Ed, aboutthe overlooked virtues of the 2-of-x keyboards) you can make asimple electronic lock.What you need is a 2-of-x keyboard, a 27(C)512  EPROM, a74(HC)273   8-bit edge-clocked latch, and a 74(HC)l4   which isused for reset and a slow oscillator. Feed the outputs of theEPROM into the inputs of the 273, feed the outputs of the 273 intoAO-A7 of the EPROM. Connect your keyboard to A8-Al5  Usethe 14 to make  an oscillator and reset for the 273. Connect D7 fromthe EPROM to one of the 14’s inverters, and use that to drive a2N2222  or equivalent that will in turn drive a relay.

What you have just built is a state machine, where the 273represents the current state, with the keypad supplying the nextstate information.

What you put in the EPROM will determine what the thing does.For example, with 256   states you could have use a 128digitnumber to turn the output on, witlh   128digit number to turn theoutput off (a bit unrealistic for us grown-ups to remember, butthe kids can handle it :-) ).   Another way to program it is for 32 4-

digit “on” commands, with 32 4-digit “off” commands, and soon. Just depends on how you want it to work.

These EPROM state machines are the thing to use where cost isan overriding factor in a design; at least until the Creeping-Features-Creature shows its ugly head and you need the flexibil-ity of a CPU.

Msgk3 577From: DAVID M. WILLIAMS, SR. To: BOB PADDOCK

Thanks for the suggestion. I just got an EPROM burner lastmonth. I’11 look this over and see if I can put one together. My padis the 3 x 4 type, pressure film that supplies a ground (or power)through the key.

December ‘ 90 /January  ‘9 89 

Page 77: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 77/80

Page 78: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 78/80

Msg :31442

From: GEORGE MASON To: ALL USERS

Does anyone know of a source that I can look up info on TVantennas? A friend of mine is living in an area where there are nocableTV  lines run. Recent small talk has brought up a rumor thata company has developed an antenna which sets inside your window and is sort of like a mini satellite dish. Ever heard of this?This dish sounds more appealing than a huge roof-top antenna.

Any help would be appreciated.

Msg :31450From: STEVE SAMPSON To: RICHARD MITCHELL

I’ve seen the ads. If it’s the same one I saw I never had such a goodlaugh in my life! The thing you need to know is that VHF andUHF dish antennas are not as effective as beams. The little dishthat you set in the window is for decoration only. It works no

 better than a set of rabbit ears. If rabbit ears will suffice, and youwant to look like a yuppie with a mini-dish, then by all means.

Otherwise, you can go two routes: buy a beam antenna cut to theexact frequency wanted, or buy some wide-band beams such asthose sold by Radio Shack. Depending on the distance andterrain, nothing may help. I wouldn’t plan on reception over ahundred miles. Where do you get these things? In big cities.There’s usually an antenna specialist company. I don’t have agood answer there. UHF dish antennas are becoming popular 

 but these area couple of feet wide, and the “programming” is notworth the reception.

MsgX:31530

From: ED NISLEY To: =EVE   SAMPSON

My buddy Dave Long (who had 37 antique TVs at the height of his craziness [and you should hear -that_  story]) built a 5-foot

 parabolic mesh dish and mounted it on (one) of his antennamasts. He’s in Poughkeepsie and gets tolerable reception fromPhiladelphia, 150 miles away as the crow flies. On the other hand,he picked his house by reading the Dutchess County topo maps,

finding the highest points, then checking for a house with a basement big enough for a rifle range. Found one, too.. .

He also built (of mesh and fiberglass resin) a 6-meter power-steerable satellite dish back in the days when this was the cuttingedge and LNAs  were so expensive your eyes fell out. He mountedthat one on footings that look like a civil engineering final exam;

 pity the next owner who really wants a lawn at that spot.

Msg :30905

From: FRANCIS DUNLOP To: ALL USERS

I have written a keyboard interrupt handler that intercepts scancodes, reassigns some of them, and so on. It works fine except Idon’t know how to turn on/off the keyboard lights (Num Lock,Caps Lock, Scroll Lock). Is there some command that you send tothe keyboard to do this? I have noticed that if you toggle bits atmemory address (40:17)  or thereabouts and then let DOS havecontrol of the keyboard, the lights go on and off. However, for my

Circuit Cellar INK gift subscriptions are avail-able for the technologically inquisitive peopleon your gift list. You don’t have to fumble withwrapping paper or fight the holiday crowds,

 just give us a call. We’ll make sure your luckyrecipient has a full one- (or two-) yearsubscription to Circuit Cellar INK, along with agii?i card announcing the giver’s name andstarting issue.

 To make sure your gift card arrives before

the holidays,

CAtt  (203) 875~2199

before IDEcEmbER   15, 1990.   A

CIRCUIT CELLAR INK

THE GIFT OF

n Table based absolute macro cross-assemblerusing the manufacturer’s assemblymnemonics.

n Includes manual and MS-DOS assembler diskwith tables for ALL of the following processors:

1802 64180   6801 8048  TM S320   8

377cQ 6502 6805 805  TM S340   Z80

50140 6.5816   6809 8085  TM S370   Zl8

7500 COP400 6811 8086   TMS7000 2280

SUPER8 COP800 68000 8096   TMS9900   MORE...

n Users can create tables for other processorsor ask us, we have many more!

n Generates listing, symbol table and binary,Intel, and Motorola hexcode.

w Free worldwide airmail shipping & handling.

US$199.00   CDNS239.00

UNIVERSAL CROSS-ASSEMBLERS .

P.O. Box 6156   B BB

Saint John, N.B.,

 2L  4R6   Canada  Voice/Fax: (506)847-0681T E C H N O L O G Y

ReaderServi ceP195

December ‘9 Januaw   ‘9 J  

Page 79: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 79/80

Page 80: Circuit.cellar.018.Dec.1990 Jan.1991

8/13/2019 Circuit.cellar.018.Dec.1990 Jan.1991

http://slidepdf.com/reader/full/circuitcellar018dec1990-jan1991 80/80

STEVE’SOWNINK Steve Cicmia

The Whole Job

I finally did it. After several happy years using an80286-based   clone computer, I joined the 1990s and in-stalled an 80386 fire-breather on my desk. I suppose that Ishould be feeling pretty excited about the whole affair, butthe transition focused my attention on a subject thatshouldn’t come up any more. As I went through software

installation on all of the various programs I’ve come todepend on, it became painfully obvious that some pro-grams were guided by the hand of a marketing staff andsome by the hand of an engineer. I have a definite prefer-ence for one type, and I think you’ll be surprised to hearwhich one.. .

I’ll start by describing two installation procedures. Itdoesn’t really matter which program I’m talking about,because there are scores of packages that use each method.What does matter a great deal is the attitude each methodexhibits toward the user.

In the first installation, I turn to the manual section

titled “Getting Started.” Following the directions and il-lustrations, I insert Disk l in drive A, type “Install.”Menus, windows, animated palm trees, and pop-up in-structions guide me through all 27 screens and 7 disksworth of installation. When I’m through, a new subdirec-tory tree has been created, and I can use the manual as aguide to check on the contents of my AUTOEXEC . BAT andCONFIG.SYS f 3

In the second installation, I turn to the manual andwonder if a section has been left out. Finally, I find someinstallationinstructionsinAppendix4.6.A.Theysay”Copycontents of program disks to hard disk. Set FILES= andHANDLES= for maximum performance.” Oh boy. I copy allof the disks into a subdirectory I created, type the programname, hit ENTER, and...nothing. Checking the program

program, on the other hand, had a team leader with a BSCSor BSEE. They figured that anyone who used their soft-ware ought to know their way around a computer, so theydecided not to “waste time” on making things pretty (andinefficient). Have you guessed which program I wouldrecommend to other engineers? Just in case there’s some

doubt, let me clear things up-the marketing approach isthe way to go.

Too many technical professionals feel that their jobends when the testing is finished. I’m convinced, though,that working hardware (or software) is only part of the job.Getting to working hardware or software may, in fact, bethe easier part of the total. The rest of the job is making thatproduct easy for a customer to use. Documentation, helpfiles, user interface (with or without “graphical” in front),and packaging are all crucial parts of a good professionalproduct. All too often, they’re parts that are left to under-trained people struggling to make a deadline that the

technical professional ignored. It’s a shame that the as-pects of a product that play the majority role in forming acustomer’s impression of the package receive the leastattention from the engineers.

Writing isn’t easy. Programming pop-up windowstakes time that could be devoted to optimizing thelast   10%of the program. Indexing a manual isn’t nearly as muchfun as designing a fast frame-grabber board. In spite of allthese facts, the “human interface” is an important part ofthe job; too important to be left to people who didn’t havea hand in the development of the hardware and software.

I’vealwaysbelieved that theengineer should write themanual, but the struggles with upgrading my computermade me go back and look at the manuals we’ve written.In many cases there is definite room for improvement. I’m