circuit.cellar.008.apr may.1989

63

Upload: dario-iglesias

Post on 22-Jan-2016

60 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Circuit.cellar.008.Apr May.1989
Page 2: Circuit.cellar.008.Apr May.1989

Ctrl

The Whole StoryEDITORk ’ N K

S oftware is one of the major issues we wrestle with here at Circuit Cellar INK. On the one hand, our readers lookto us for practical hardware solutions and innovative control techniques. There are several other himagazines where readers can turn if their interests center on code rather than solder. Given that wea

h-qualityave to be

discriminating in our selection of articles, why not focus solely on hardware?On the other hand, our subtitle reads The Computer Applications ]ournal, not The Computer and Controller Hardware

Journal. We havein functional appP

romised practical, complete solutions, not black-box instructions. Since our readers are interestedications, shouldn’t we provide them with all the pieces required to build those applications?

When you look at our table of contents for this issue, you’ll see articles on software. Yes, hardware is what makesus unique, but it’s not enough. Programmable microcontrollers and complex designs have become so common thateven the most diehard hardware engineers must recognize the importance of software.

It’s become fashionable to talk about how huge the programs running on embedded controllers and otherapplications have become. This is used as a way of saying that software is the sole force driving the development ofcomputer applications. I’m not sure that I believe all the numbers being thrown about, but I do see signs of a growingpartnership between “engineers” and “programmers.” Until recently, it was fashionable for hardware designers todisparage the work of programmers, and vice versa. Now, cooperation is common. What’s more, hardware andsoftware engineers are learning one another’s disciplines, and finding that it makes their own work more creative andproductive.

Circuit Cellar INK is dedicated to helpingrammer. If we can teach you more about tR

you become a better computer applications designer, engineer, or pro-e discipline you know least, we’re well on our way.

Speaking of Trends.. ~

When you get as many pressreleasesas we do hereat Circuit Cellar INK, you can, if you squint just right, see trendsstart to develop. One of the trends that seems to be picking up steam is the use of microprocessors rather than micro-controllers in embedded and control applications. Members of the 8088 and 68000 families are showing up in placesthat, until recently, were reserved for 8052s and 6809s. What’s up?

For starters, it’s easy to see that hardware engineers aren’t the ones driving this trend. After all, who wants to haveto work extra glue, memory, and I/O circuitry into a design if you don’t have to? It’s not as though controllers aren’tpowerful enough. Controllers like the Intel 80960 are, arguably, more potent than anything the company offers onthe microprocessor side. That argument aside, most control and embedded applications just don’t need the wide datapath, huge address space, and 25+ MHz clock speed of the latest microprocessors.

No, the driving reason for this trend can be found back about four paragraphs. Programmers and engineers whohave to write the software for applications are getting more vocal about the need for better programming tools. Ingeneral, if you have an IBM PC on your desk,

iiou

system. If you have a 68000-based desktop mathave the basis for a high-powered 8088 software development

ine, you’re only so far from developing software for a 68000 controlproject. The fact is, software development time is now more valuable than mere hardware. This explains theappearance of PC-clones on just about every bus; a 4” x 6” card with 80386,l meg of memory, and VGA built-in; and68000 UNIX single-board computers. I don’t expect to see microcontrollers and their development tools disappearany time soon. Indications are that 8-bit microcontrollers will be the major portion of the market for years to come.But where microcontrollers were the only solutions available, now you can pick from a wide variety of platforms basedon the many criteria (including financial and time) of a given project.

Time Marches Cz

Those with eagle eyes might have noticed than we jumped from the January/February date of Issue #7 to theApril/Maydateof thisissue. Isthisasignofcorporatememoryloss,orapersonalvendettaagainstMarch? It’sneither.It is, instead, the easiest way we could find of making the monthson the cover and the real schedule match. You shouldnotice no change in the way you’ve been getting Circuit Cellar INK.

Curtis Franklin, Jr.Editor-in-Chief

April/May I 989 1

Page 3: Circuit.cellar.008.Apr May.1989

FOUNDER/EDITORIAL DIRECTORSteve Ciarcia

PUBLISHERDaniel Rodrigues

EDITOR-in-CHIEFCurtis Franklin, Jr.

ASSOCIATEPUBLISHERJohn Hayes

ENGINEERING STAFFKen DavidsonJeff BachiochiEdward Nisle y

CONTRIBUTINGEDITORThomas Cantrell

CONSULTINGEDITORSMark DahmkeLarry loeb

CIRCULATIONCOORDINATORRose Mansella

CIRCULATIONCONSULTANTGregory Spiizfaden

PRODUCTIONMANAGERTricia Dziedzinski

BUSINESSMANAGERJeannetfe Walters

STAFF RESEARCHERS

NortheastEric AlbertWilliam Curie wRichard SawyerRobert Seek

MidwestJon Elsonlim McDonough

West CoastFrank KuechmannMark Voorhees

Cover Illustrationby Robert Tinney

cl22

cl30

Switching Power SuppliesEfficient Power for Embedded Control Systemsby Steve Ciarcia

When you downsize the controller, thepower supply has to shrink, too. Steve looksat the “black art‘ of designing efficient,clean power supplies in compact formfactors.

Product Reviews-The Next GenerationCircuit Cellar INK sells out and enjoys if!Supercharged Worry MunchersCircuit Cellar INK looks at four diverse applications solutio

Writing A Real-Time Operating System-Part 2Memory Management and Applications for the HD64180by Jack Ganssle

Jack Ganssle discusses working with theHD64180’s internal MMU and tips on writing appli-cations in the conclusion of this two-part article.

Editor’s INKThe Whole Storyby Curtis Franklin, Jr.

Reader’s INK--Leffers fo the Editor 5

Visible INK--Levers to the INK Research Staff 20

From the BenchCreating a Network-based Embedded Controllerby Jeff Bachiochi

46

2 C//?CU/T CEL LA I? INK

1

Page 4: Circuit.cellar.008.Apr May.1989

THE COMPUTER APPLICATIONS JOURNAL

ImageWise/PC-The DigitizingContinues- Part 3Topping it off with Softwareby Ed Nisley

Although solder is the favorite programmingtool of many engineers, software is the gluethat holds ImageWise/PC together, as thisthree-part series concludes, Ed Nisley de-scribes the software that makes this PC-BUSdigitizer possilbe.

rROL 1 I N T E R R U P T 1

I:pu

PORTh 6 - 7

1521 HD647180X-A New 8-Bit Microcontroller- Embedded Controllers Get Respect

by Tom Cantrell

While the state-of-the-art marches toward 32 bits, a-bitmicrocontrollers keep gelling more powerful. TheHD647180X is the latest integrated controller built on thefoundation of the proven Z80.

Firmware Furnace

Advertiser’s Index

The True Secrets of Working with LCDsby Ed Nisley

56

65

ConnecTime - Excerpts from the Circuit Cellar BBSConducted by Ken Davidson

67

Steve’s Own INKSmile When You Call Me Thatby Steve Ciarcia

72

April/May I989 3

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

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

Circuit Cellar INKmakes no warranties andassumes no responsibilityor IiabilitY of any kind forerrors in these programs orschematics or for the con-sequences of any sucherrors. Furthermore, be-cause of the possible vari-ation in the quality andcondition of materialsandworkmanship of reader-assembled projects, Cir-cuit Cellar INK disclaimsany responsiblity for thesafe and proper functionof reader-assembled proj-ects based upon or fromplans, descriptions, or in-formation published inCircuit Cellar INK.

CIRCUIT CELLAR INK(ISSN 0896-8985) is pub-lished bimonthly by CircuitCellar Incorporoted4ParkStreet.Suite2O.Vernon.CT06066 (203 ) 875-275 1.Second-class postagepaid at Vernon, CT andadditional offices. One-vear (6 issues) subscription;ate U.S.A. and posse&ionsS14.95.CanadoS17.95.all&her dountries $26.95.. Allsubscription orders pay-able in U.S. funds only, viainternational postalmoney order or checkdrawn on U.S. bank. Dl-rect subscription orders toCircuit Cellar INK,Subscrip-tions, P.O. Box 2099, Ma-hopac, NY 10541 or call(203) 875-2 199.

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

Entire contents copy-right 1988 by Circuit CellarIncorporated. All rights re-served. Reproduction ofthis publication in wholeor in part without writtenconsent from Circuit Cel-lar Inc. is prohibited.

Page 5: Circuit.cellar.008.Apr May.1989

CM

READER’S ’ N K Letters to the Editor

I had a few comments on the article on multitasking(“Writing a Real-Time Operating System”) and the discus-sion on control networks (“ConnecTime”) which appearedin issue #7of Circuit Cellar INK. As part of my own multi-tasking system (wearing many hats in a small company),I do hardware and software design, write our manuals,and do a monthly article for Radio World Newspaper (atechnical newspaper for radio broadcast stations).

Multitasking

The multitasking system discussed in the article looksquite complete, and complicated. We’ve been using asimpler system on 6802-based systems. Hardware inter-rupts are used just for I/O buffering (rather than taskswitching). The interrupt-driven I/O buffering (usingcircular buffers) allows us to send or receive blocks of I/Ofrom different devices or users. The system uses round-robin task switching with no priorities. Every task waitsits turn. A task switch is initiated whenever the currenttask runs out of work. This is generally I/Orelated. Eitherthe task is waiting for input and the input buffer is empty,or it has output and the output buffer is full. On exit, eachtask resets its “program counter” to the point where the de-cision was made that caused the exit. If there is a particu-larly processor-intensive task that we do not want to hogthe system, it can be broken into parts. On exit, the taskprogram counter is set to where the task is to continue. In6800 assembly, the task manager looks like this:

TASKLOOP: JSR TASK0 ;Go do task 0JSR TASK1 ;Go do task 1JSR TASK2 ;Go do task 2JSR TASK3 ;Go do task 3BRA TASKLCCP ;Go do it all again

We set up an area of RAM to hold the “program counters”:

TASKOPC: DS 2TASKlPC: DS 2TASK2PC: DS 2

TASK3PC: DS 2

, -Set aside 2 bytes of;RAM for task 0 PC

Task entry looks like this:

TASKO: LDX TASKOPC;Get our program counterJMP 0,X ; and go to it

Task exit looks like this:

TASKOF: LDASJSR

EQLDXSTXRTS

TASKOG:

x0 -Specify buffer 0BDFFULLiGo see if it's fullTASKOG ;Cont routine if not full#TASKOF;Point where come backTASKOPC;Store as PC for this task

; and exit;Buffer not full, so output

LDABXO ; Specify buffer 0LDAA Xl ;Geta bellJSR PUTBUF ; and put it in buffer 0

On entry to task 0, we pick up the program counter forthis task, then start executing at that point (in the example,TASKOF). We redo the test that caused the task exit(checking to see if buffer 0 is full). If it’s still full, we set upour task program counter for next time. If it!s not full, wecontinue with the task (here outputting a bell character).

The key to this approach is that whenever a task needsto wait, it goes on to another task. When each other task iscarried as far as it can go (without waiting), we come backaround to see if this task is ready for action.

This approach uses only the standard hardware stack.There are not separate stacks for each task. Note, however,that this complicates the use of local variables. Since manyhigh-level languages keep the local variables on the stack(throwing them out on procedure exit), the stack wouldquickly get confused. The simplest approach to this prob-lem is to just use global variables that are always allocated.Each task needs its own set of variables. If each task isrunning the same program (thus having the same variablerequirements), each variable could become an array thatspecifies which task the variable is used by. To savememory, an array called Stack (Task) could be set up.Temporary variables could be stored on this “high-level-language” stack that is dedicated to this task. Since theyare no longer needed, the stack pointer would be moved todelete them. This “high-level-language” stack allowsreuse of memory for temporary variables.

Of course, one purpose of the hardware stack is keep-ing track of subroutine return addresses. If a task gets

Apr/l/May I989 5

Page 6: Circuit.cellar.008.Apr May.1989

three subroutine calls deep and then exits, all those returnaddresses are still on the stack. The stack will very quicklybecome confused again. For simplicity, all task exitswould have to be from the “main-line” code. This can beaccomplished byeithercheckingforanexit-causingcondi-tion prior to calling the procedures (see if the buffer is fullprior to calling Buf Put) or having a flag (ProcFail) thatis set if the procedure failed and needs to be run again (andcleared if the procedure did not fail). When we get back tothe main-line code, we continue if ~rocFai1 is false. IfProcFai.1 is true, we set up our task program counter torepeat the procedure next time, then exit this task.

Networking

In ConnecTime, there was quite a discussion of net-work protocols. I had a few comments (again, based onsystems we manufacture).

Mark Lampkin gave a suggested data packet format.His simple format did not contain a return address or errorchecking (he’s gotten no errors). His packet consisted of:

STX, Address, Command, Packet Length, data bytes, ETX

I’d suggest the following format:

Hex AA, Hex 55, ToAddress, FromAddress, PacketLength,data bytes, CheckSum

The AA55 hex is a beginning-of-message flag. Weneed to have a flag that will never occur in our data. Syn-chronous protocols do this by sending more than themaximum number of allowed 1 bits in a row in a character.To prevent a data byte from having too many Is in a row,they use “bit stuffing” to stuff a 0 in the character after themaximum number of Is. On the receiving end, after themaximum allowed number of Is is received, the following“stuffed” 0 is removed, restoring the data to original.

In asynchronous communications, we cannot stuffmore bits in a character (although some protocols send abreak as a begin-of-message flag, which is detected at thereceiver as a framing error). What we’ve done is “bytestuffing,” quite similar to bit stuffing. If the data containsan AA hex, we stuff a 00 after it on transmission andremove it on reception. This guarantees that the flag(AA55 hex) will never occur in the data string. By the way,AA55 hex is used since it is an alternating pattern of OS andIs, then the reverse pattern. Both Mark Lampkin’s proto-col and mine include the ToAddress. I’ve included aFromAddress to allow theother device to respond (whetherwith an acknowledgement or with requested data). Markincluded a “command byte.” I believe this doesnot belongin the header, but should instead be in the data bytes areaof the message. This allows for multibyte commands andmakes even “noncommand” data packets the same. Ifneeded, the first byte of the data bytes section could be a“packet type” byte, which determines how the remainderof the packet is to be interpreted. As Mark, I then left room

6 C/KU/T CELLAR INK

for the data. I followed this with a checksum byte, whichis the sum of all bytes in the message (excluding the AA55hex flag, but including the addresses, byte count, anddata). Another approach is to use the 2’s complement ofthe sum as the checksum. The receiver then adds up all thebytes in the message, including the checksum. If the resultis 0, the message is good.

Mark had an ETX byte to mark the end of the message.Since the message already includes a packet length byte,we already know where the end of the message is, makingETX unnecessary.

Contention Avoidance

Mark’s system used a fiber-optic ring, where it is notpossible to get contention (multiple devices transmittingon the same medium simultaneously). Each fiber link hasonly one transmitter and one receiver, so a “token passing”protocol does not appear necessary. Any device wantingto send a message may transmit it at any time. The nextdevice in the ring receives that message. If its addressmatches the ToAddress of the message, it acts on themessage. If the address does not match, it passes thecomplete message on to the next device in the ring. Even-tually, the message should find a home.

Note that this ring could be expanded to a multibran-ched tree or matrix where each device has several links toseveral other devices. Received messages that are not forthis device are passed on to other devices through any oneof several output ports. The decision as to which port touse canbe based on a table held in that device. The routinginformation could also be included in the message header.The device originating the message would include severalbytes of ToAddress. For the destination site to answer, itis necessary to include several bytes for the FromAddress.

If there really were a possibility of contention (a bustopology where more than one device can transmit on thesame medium simultaneously), a contention-avoidancesystem is desirable (though not required). If each devicetransmits at random times and the system loading is low,there is a good possibility the message would get through.

The next approach to contention avoidance would beto “look before you leap.” Listen for someone else trans-mitting before you bring up your carrier. This eliminatessome contention, but there is a possibility of several sitesholding off until a carrier drops, then having them all comeup at once. To avoid this problem, a delay can be intro-duced after detecting carrier drop and before bringing upcarrier. If this delay is fixed (and different1 for each site, apriority system is established. The site with the shortestdelay gets in first. If a random delay is used, all sites haveequal access.

Token Passing

In token passing, a “permission-to-transmit” token ispassed from device to device in the system. When a devicereceives the token, it transmits any messages it is holding,

Page 7: Circuit.cellar.008.Apr May.1989

then transmits the token to the next device in the system.There is danger, however, of the token getting lost, due toa transmission error. When this occurs, the system mustdetect it and generate a new token.

Absence-of-Data Token Passing

In one of our systems, we’ve used “absence-of-datatoken passing.” Each device in the system includes a timerthat is set to a “sitedelay”on reception of a valid data byte.If the timer reaches 0 before a valid byte is received, a “sitecounter” is incremented and the site delay timer is set backto the initial site delay. This continues until the highest sitenumber in the system is reached. After that, the sitecounter is reset. When the site counter is incremented,each device in the system checks to see if the site counternow matches its site number (“it’s now my turn to talk”).If so, carrier is brought up and FE hex characters are sentfor site delay and act as a ‘leader.”

Once the “leader” is complete, we transmit all the datapackets that are held in the transmit buffer (with no moreleader). When the transmit buffer is empty, we leave thecarrier idle for a couple character times to allow the lastbyte to get through, then drop the carrier. A SiteDelayafter the last valid byte, all sites increment their SiteCoun-ters, enabling the next site in the system. If any site doesnot haveanydata tosend,itleavesitscarrieroff,automati-tally passing the “permission-to-transmit” token to the

next site in the system. In addition, each time a site receivesavalidmessage,itsetsitssitecounter tomatch theFromAd-dress of the received packet. This resynchronizes all sitesin the system. This “absence-of-data” token-passing sys-tem is really just like a standard token-passing systemexcept for the form of the token. Further, no site mustregenerate a lost token, since the token is the lack of datarather than the presence of a certain data sequence. It’shard to lose something that was never there!

Conclusions

There are lots of different ways of handling networks.Right now, I like the absence-of-data token passing for bussystems and the routed matrix for nonbus systems. Therouted matrix has some additional delay due to messageretransmission, but this retransmission removes noise andtiming inaccuracies from messages, resulting in bettersystem performance. The routed matrix also has a higherthroughput since the medium connecting two devices orsites is only carrying traffic that needs to go between thosesites. In a bus system, all media in the system carries all thetraffic. The routed matrix can be carrying several mes-sages simultaneously over various portions of the me-dium. The bus can only carry one message at a time.

Harold HallikainenSan Luis Obispo, CA

Still BlastROMs?

ieDevelo andtest RBM cotin minutes without leaving ywyTkeyboard - with The ROMulatop.

ROMulator most fneed not be system

’ \ _ l o c a t e d neer and Mats 1

zE?%k be68Oi0, etc.’

Source code forhost software isincluded

Ask us about faster (than 150ns)ROMulators and custom cables formost non-27xxx ROM sizes.

FOR MORE INFORMATION, PLEASE CALL OR WRITE

Gmmmar

-E ELI Gremsnar Engine, hc3314 Morse RoadColumbus, Ohio 43231614/471-1113

VIsh .n* MurcrCud hccspre*D**er I”q”me* we,comc In Pacific and Mountain tmezones:

415/595-2252

GIVE A NEW DIMENSION TO PERSONAL COMPUTING .The amung V&e Master Key Systemadds recognition to iust about any program 01 apphcation Voice command up to 2% keyboard macroshorn wilhm CAD. desktop publishing. word prccessmg, spread sheet, 01 game programs. FullyTSR and occupies less than MK. Instant response time and high recognlbon accuracy Voice recoQnl_tion to&box utilittes are Included A genulnc pmductlvlty #n*nc#r!

SPEECH RECORDING SOFTWARE Dlgtlally record your own speech. sound. 01 music to put intoYOU, own sottware oloorann Software ofov~des samolino fate vat~abonr. araohlcs-based edlbna. and

ter Key Syrtsm conststs 01 P plug-m card,durable lhghtwelghl microphone headset. sohware. and manual Card Ills any available slol Exiernalports consist 01 m~c Inputs and volume controlled output sockets Hlph qoallty throughout. uly and

ONLY $149.95 ONLY $89.95 FOR TANDY lm, StJ-TL MOOELSSOFTWARE ONLY-REOUIAES TANDY BRAND

COMPLETE ELECTRET MICROPHONE.

ORDER HOTLINE: (SW) 342-17Il Monday-Friday. SAM to 5 PM Pacihc TtmeVisa/MasterCard. company checks. money orders. CODS (with proor approval) accepted Personalcheckssubject to 3 week shipping delay. Specify computer type and disk format (3%” 0~ 5%“) whenordering. Add $5 shipping charge lot delivery m USA and Canada Forelgn tnquirles contact Covox lotC 8 F ouotes 30 DAY MONEY BACK GUARANTEE IF NOT COMPLETELY SATISFIED. ONEY E A R ~~ARRANTY ON H A RD W AR E .

CALL OR WRITE FOR FREE PRODUCT CATALOG

Circle No. 120 on Reader Service Card Circle No. 113 on Reader Service Card

Page 8: Circuit.cellar.008.Apr May.1989

Switching Power SuppliesEfficient Power for Embedded Control Systemsby Steve Ciarcia

With all the emphasis on em-bedded controllers and proc-ess control in the pages of

Circuit Cellar INK, it was only a mat-ter of time before I felt obligated toaddress the power requirements ofsuch systems. After all, it hardly makessense to build the world’s most effi-cient micro-miniature controller onlyto have it powered by the world’smost inefficient, grossly oversized, Ne-anderthal-technology power supply.At least, that’s the way my logic went.Little did I realize what masochism Iwas inviting.

The Circuit Cellar has a variety ofcontrol systems. There is such a maze,in fact, that I’m even beginning toneed a road map to figure out whereeverything is going. To alleviate someof the confusion and provide a sub-stantial development base for futureexpansion, I will be converting muchof my system to an RS-485 net withmany locally intelligent data acquisi-tion and control nodes. Rather thanstringing a wire 200 feet out to thegarage to monitor a switch closure, Iwill simply connect it to the garagecontroller node with the dozen or soother I/O contacts and its status willbe transmitted with everything else.(This whole system will be describedin Circuit Cellar INK in the comingmonths.)

Not only does this cut down onwiring (you wouldn’f believe how muchwire there is around this place already!)but it allows control changes to bedone in a more orderly fashion. At thevery least I’ll have less aggravationtracing shorter wires. Most of the newsystem will consist of 8031- and 8052-

based dedicated controllers. [Editor’sNote: For details on the RTC31 andRTC52 controllers, see “From the Bench”beginning on page46.1 SO what’s maso-chistic about this? Everything.

At the same time I decided to re-vamp the control system I thought Iwould take a more comprehensiveapproach toward power control anddistribution. My present system hasseparate AC power supplies in each ofits control areas. While I do havecostly AC UPS power-backup unitsoncritical computercontrolelements,the system is still susceptible to con-trol errors when individual locallypowered sensors lose power (usuallyfalse negative because they are nolonger operable). Of course, there arevarious methods of redundancy andmonitoring that I could incorporate tocorrect these problems, but it seemedlike too much bother considering thefrequency of such events. Neverthe-less, I determined I’d fix thisconditionif I ever redesigned the system.

Instead of 115VAC power for thenew controllers, I intend to run every-thing on +12 volts. Like commercialalarm systems that run battery powereven to the remote sensors, my newsystem could be entirely battery oper-ated in the event of an AC powerfailure. One AC-line 1Zvolt powersupply with a constantly charged 12-volt gel-cell (or car battery for thatmatter) could serve as an uninter-ruptable power source for the entiresystem. The same power supply de-sign could also be applied to a singleembedded control system to provideUPS operation.

Running things from 12 volts is

Photo l- 78SObased design us-ing traditional techniques.

nothing new. This application, how-ever, presents some very special de-sign considerations. Individual netcontrollers will have a variety of tasks.Some will be simple contact closure ortemperature monitors. Others willhave more elaborate configurationswith event printers, modems, anddisplays. Even some form of dataloggingfharddisk) couldbeincluded.

From the outset I had to be awareof both power conversion efficiency

uOUT < “IN

a) “Buck” Step-down Converter

DI=

‘IN - VI

Ql

1 i

Q “OUT

C l

T 7

“OUT ’ “IN

b) “Boost” Step-up Converter

Figure 1 -Traditional DC-to-DCconverter designs.

10 Cli?CU/T ClwAR INK

Page 9: Circuit.cellar.008.Apr May.1989

Photo 2- LT 7070-based flybackconverter.

and power consumption. Rather thantailor a custom supply for each node,I decided to build a general-purposeconverter with three output voltages(+5V, +lZV, and -12V) that couldsupply high currents where neededyet still have a low quiescent currentwhen less consumption was required.

Unfortunately, getting from hereto there is more easy to understand asa task than an accomplishment. SinceI have built many low-current (less

“,N oL%+o - UOUT

“ O U T - -“IN

c) “Buck/Boost’ Polarity-InvertingConverter

I’N Dl

6

i

01

“OUT-Nlr

YN

T

Since we have to start someplace,understandingthedifferencebetweenplain-vanilla series-pass regulatorsand switching regulators provides agood introduction. I’m sure someonehas already asked why we don’t justregulate the 12V common down to 5Vthrough a three-terminal regulator.

d) ‘Flyback’ Transformer-Coupled Series Pass vs. Switching Regula-Converter tors

than 100 mA) converters in previousprojects, I perceived this as a weekendproject where I merely extrapolatedand expanded on basic design theory.Now, after successfully doing it, I cantell you that while the theory indeedholds true, the proof is more elusive.

General-Purpose Design Objective

My design objective was to builda DC-to-DC converter that could beused as a general-purpose 12V-pow-ered UPS for embedded systems. Itsmodest specification would be: +5V at1.5 amps, +12V at 0.5 amp, and -12V at0.25 amp. Its efficiency should let thebattery last a reasonable time. Moreimportantly, it should be efficientenough so that the current require-ments of the 12V common supply arenot excessive when powering mul-tiple converters.

This article documents the pro-gression of events leading to a finalpower supply configuration. At thesame time it answers basic questionson switching regulator-based DC-to-DC converter design. For the record,I don’t claim to be an authority on thissubject. This project is presented as acollection of tested circuits with use-ful observations because, in my expe-rience, successful high-current DC-to-DC converter designs have more to dowith layout technique and analogblack magic than anything as tangibleas component specifications or sche-matics. While my final converterexceeds the design objectives and isrelatively easy to build, successfulduplication of it will have a lot to dowith your ability to hold the magicwand properly.

Since the advent of the three-ter-minal voltage regulator, it seems that

everyone has become a power supplyexpert. No longer are ten pages of cal-culations required to produce a de-sign for even a modest power supply.

Three-terminal regulators like theLM317 are so easy to use that few ex-perimenters stop to consider how in-efficient they are. Consider for ex-ample, using an LM317 to power oneof the controller nodes above. Giventhe maximum level of the common in-put voltage Win) for a 5-volt 1.5~ampoutput, 11 volts would be droppedacross the regulator (in actuality, Vinwill vary between 1OV and 17V de-pending upon whether it is operatingonly from the battery or from an AC-powered charger and power supply).Power is dissipated by the regulatorin an amount equivalent to the differ-encebetween theregulator’sinputandoutput voltages multiplied by thecurrent through it.

The LM317 and similar linearregulatorssuchas the 7805 and LM340are all called series dissipative regula-tors. They function in a linear mode,simulating a variable resistance be-tween the input voltage source andthe load. The regulator maintains aconstant output voltage by dissipat-ing the excess power as heat. Unfortu-nately, as we see in this example, itconsumes 16.5 watts producing thedesired 7.5-watt output (31% effi-ciency).

In most applications the ease ofuse and relative low cost of linear se-ries regulators far outweigh the inher-ent lack of efficiency. The linear seriesregulator is well-suited for medium-current applications or applicationswith a small input/output voltagedifferential. When electricity isn’tsupplied by a battery and costs onlyten cents per kilowatt-hour, it’s hardto get concerned about losing 16.5watts.

Why Use a Switching Regulator?

Power supply efficiency usuallyisn’t important unless size, heat dissi-pation, or total powerconsumption islimited. Since the common powersource for our network controllers is abattery (when the AC power fails), wehave to be more careful about how

April/May 1989 11

Page 10: Circuit.cellar.008.Apr May.1989

much energy is converted for usefulwork and how much is thrown awayas heat.

Efficiency is really the name of thegame. In a series dissipative regula-tor, conversion efficiency is directlyrelated to the input/output voltagedifferential. As thedifferencebetweenthe two voltages increases, efficiencydecreases.

It would be far better if the regula-tor consumed no power and if all thepower were channeled to the load. Ofcourse, perfect conversion efficiencyis impossible, but the inherent fault inusing series dissipative regulators isthe linear operating mode of the se-ries-pass transistor. If the transistor isused as a switch (in saturated opera-tion) rather than as a variable resistor(in linear model the pass transistorconsumes very little power. (This isnot a new discovery.)

A regulator constructed to oper-ate in this manner is called a seriesswitching regulator. The same series-pass transistor switches between cut-off and saturation at a high frequency,producingasquare waveofamplitudeVin. This waveform is then filteredthrough a low-pass LC (inductance/capacitance) filter, producing an aver-age DC output voltage (Vout) propor-tional to the pulse width and fre-quency. The efficiency of such a regu-lator is generally independent of theinput/output voltagedifferential andcan approach 95% in good designs.

Switchingregulatorscomeinvari-ous circuit configurations, a few ofwhich are the flyback, buck, boost,and buck-boost types. Also, unlikethe typical three-terminal dissipativeregulator, the switching regulator canbe directly configured to operate inany of three modes: step down, stepup, or polarity inverting.

Switching-Regulator Basics

Figures la through Id outline thethree common modes of switching-regulator operation. Basically, theswitchingregulatorconsistsofapowersource which supplies a voltage Vin, a“switch” Ql, and an LC filter. Theway the components are connecteddetermines the output mode.

gure Z-The 78S4U IS a popular vanot3le-trequency-type switcningregulofor.

Buck Regulator

In the step-down buck regulatorin Figure la, the basic circuit opera-tion is to close transistor switch Ql fora time Ton, and then open it for timeToff. The total, Ton + Tofl, is called theswitching period 7’. Neglecting thesaturation voltage of Ql (Vsaf) and thediode(Vdiode), thevoltageat theinputto the inductor is +Vin during the timeTon and zero during Tofi (These othervoltage drops would be included incalculations that choose actual com-ponents.)

When Ql is closed, a step increasein voltage is applied to the inductorcoil, which has the value L. However,current flowing through an inductorcannot change instantaneously; in-stead it increases linearly according tothefactorUdi/&J, buildingamagneticfield. This reduces any instantaneouscurrent changeseenby theload. WhenQl opens, the magnetic field in theinductor decays linearly, supplyingpower to the load. The current path iscompleted through the forward-bi-ased flyback diode Dl. As you can seemathematically, the output voltage ofa buck converter is always less that itsinput:

Duty Cycle (DC 1 = TonTon+Toff

Vout = Vin x DC

In this type of switching regula-tor, the inductor and capacitor form alow-pass filter. High-frequency pulsesare applied to the input, and an aver-aged DC level comes out. The peak-to-peak ripple voltage is a function ofthe switching period T and the valuesof the inductance L and capacitance C.As the frequency of operation is in-creased, the voltage ripple is reduced,but the supply becomes less efficient.

Boost Regulator

Figure lbillustratesthecircuitcon-figuration of the basic step-up boostregulator. In this type of regulator,closing Ql during Ton charges the

CO ORIM GEWI E

ZIP Software now allowsboth the original serialDTOl and ImageWise/PC to digitize and dis-play full-colorpictures onan IBM PC with VGA.

See page 44for more details,

12 ClRCUlT CELLAR INK

Page 11: Circuit.cellar.008.Apr May.1989

inductor. When Ql is opened, theinductor discharges through Dl intothe load. The output voltage is:

Vout = Vin Note that the magnitude of Voutl - D C can be either greater or less than Vin.

Current drawn from the input isdelivered in pulses to the output loadat significantly higher currents thanthe average load current. Both Ql andDl must be sized to handle these in-creased currents. You’ll also note fromthe equation that in all cases, Vout isgreater than Vim

Flyback Regulator

A final configuration worthy ofinterest is theflybackconverter, shownin Figure Id. Flyback regulators use atransformer, as opposed to a simplechoke, to convert Vin to Vout. DuringTon, energy builds up in the core dueto increasing current in the primarywinding. At this time diode Dl isBuck-Boost Regulator

given by:

Vout = -Vin x (DC /l-DC 1

Figure lc shows a polarity-invert-reversebiased. WhenQl opensduringTofi, the total stored energy is trans-

.I otin lw

UIN 0I@-17u

T T

UOUT+5u

1 Ql 1 TIP42A 1 2N4398 1.2K

lout 1 1.5A 1 3.5A I

Figure 3-A 7.5amp, 5-volt buck regulator using the 78S40.

ing buck-boost switching regulator.As in the other cases, closing Qlcharges the inductor during Ton.When Ql is opened during To/$ thereis a “kickback” voltage produced bythe inductor as it discharges. Thiseffectoccurselsewhere, too. For years,many of you have probably beenputting reverse-biased diodes acrossrelay coils, perhaps without thinkingabout it. The purpose of the diode is todampen the high-voltage spike pro-duced after a pulse is applied to theinductive relay coil. In a switchingpower supply, rather than short outthe voltage, diode Dl directs thisopposite-polarity voltage to the load.Buck-boost regulators have an output

ferred to the secondary winding andcurrent is delivered to the load. Theprimary-to-secondary turns ratio (IV)affects Vout and should be set for op-timum power transfer:

Vout = Vin x N x (DC/l-DC)

The greatest advantage of flybackregulators is that they can have anoutput voltage that is higher or lowerthan theinputvoltageandcanincludemultiple windings on the transformersecondary to create other isolatedvoltages. Unfortunately, all this doesnot come without a price. Flybackconverters have higher ripple currentsdue to the high energies which must

be stored in the form of DC current inthe windings compared to using pureAC waveforms.

Variable- vs. Fixed-FrequencyRegulation

Generally speaking, in all fourcases, the output voltage Vout is regu-lated by controlling the ratio of Ton/T,which can be altered in a number ofways depending upon the controlmethod. Two of the more commonapproaches are variable pulse width(pulse-width modulation) and vari-able frequency. In a pulse-width-modulated switching regulator, theswitching period T is fixed and the“on” time Ton varied. Conversely, ina variable-frequency regulator, Ton isfixed and the “off” time Toffis varied.

Thevariable-frequency switchingregulator is generally easier to designand build since the magnetic flux de-veloped in the inductor coil duringthe fixed on-time determines theamount of power deliverable to theload. This eases the design of the in-ductor because the inductor’s operat-ing region within its characteristiccurve is precisely defined. Operatingfrequency, which increases propor-tionally withtheload,ismostlyafunc-tion of the inductance L, capacitanceC, and voltages Vin and Vout.

The fixed-frequency pulse-width-modulated switching regulator variesthe duty cycle to change the averagepower delivered to the load. Thismethod is particularly advantageousfor systems employing transformer-coupled output stages and is oftenused in commercial switching sup-plies with multiple outputs. It is morecomplex and uses more componentsthan variable-frequency supplies, buttheadvantagesoutweightheextracostin high-current applications.

Typical operating frequencies ofswitching regulators range from 10 to50 kHz. However, there are sometradeoffs. High frequencies reducethe ripple voltage at a price of de-creased efficiency and increased radi-ated electrical noise. If the frequencyis lowered, greater efficiency and lesselectrical noise will result, but largercoils and capacitors are needed. Also,

April/May 1989 13

Page 12: Circuit.cellar.008.Apr May.1989
Page 13: Circuit.cellar.008.Apr May.1989

inductor and capacitor are required to connected to a fixed 1.3V referencemake a highly efficient switching voltage. If the output voltage ex-power supply. (The internal Darling- ceeds the reference, the regulator willton-configured transistor switch and begin to skip Ton cycles until thediode of the 78S40 are capable of voltage lowers. Changing the out-handling 1.5 amps at 40 volts, but an put voltage setpoint in a buck con-external transistor and diode are verter is simply a matter of changing

TIP32IN5288 10=ui

YR - - 0 UOUTMILLERl 4622 -12u e20mn

Figure 5-A buck-boost design using the 78S40 generates - 72V from aIO- 7 7V input.

VIN9-IlU

MILLER l 5506 MILLER r5502158 UH SR504 I0 UH-- bd - s=iii 0

‘.c+78840

E 3

CT GNO C-d %I

12 il 10

TIP32

UOUT+12u 81.5fl

Figure 6-Again using a 78S40, a boostfrom a 9- 7 7 V input.

design is used to generate + 72V

needed here because of the increased the resistor divider between thiscurrents involved in this design.) comparator and the output.

S-Volt Buck Regulator

Figure 3 outlines a 1.5-amp, 5-voltbuck regulator using the 78S40. Oper-ating frequency is set by the capacitorat pin 12 (usually between 0.01 and0.001 l.t.F). Vin is connected throughthe current-sensing resistor to the tran-sistor switch, and at Ton it charges theinductor. During Toffi the diode con-ducts and the energy in the inductor istransferred to the load. The voltage atthe load is fed back to a comparator.The other side of the comparator is

The current-sensing resistors areintended to protect the switching tran-sistor and diode rather than the load.The 78S40 will stop functioning whenthe voltage between sense points (pins13 and 14Jexceeds0.33volts. Fora 1.5-amp buck regulator, the peak currentis typically 3 amps and a O.l-ohmresistor (or two 0.22-ohm resistors inparallel) is used.

As you might have guessed, themost important elements in switchingregulators are the transistor and thediode. For the same inductor value,this regulator configuration can have

higher or lower output current de-pending upon the speed and currentratings of these devices. Switchingregulators use special Schottky Bar-rier Rectifiers specifically for their lowforward-voltage drop (0.3-0.6 voltstypically) and high speed. Using aTIP42A(6-amp) transistor and lN5822(3-amp) Schottky diode, I was able toobtain a 1.5-amp output current for aVin range of 9-17 volts. By changingthe transistor to a 2N4398 (30-amp)and the diode to an SB840 or SR802 (8-amp), the output current could be in-creased to 3.5 amps (the current-sens-ing resistance was lowered to 0.033ohms to handle the higher currents).

Figure 4 outlines the mathematicsinvolved in making buck, boost, andbuck-boost converters with the 78S40switching regulator. For themost partI used these calculations to form thefundamental basis of the end resultwith a certain sprinkling of empiricalmodification. Because the input volt-age Win ranges from 10 to 17 volts) isnot a constant, there is actually a rangeof component values which are alloptimum at a specific combination ofVin and load current. The final com-ponent values are compromise selec-tions derived by building the circuitand testing it.

An important fact about the buckconverter also pertains to boost, buck-boost, and other configurations. Tra-ditional switching regulators are elec-trically very noisy. Switching tran-sients can be coupled throughout apower supply either inductively be-tween adjacent components or directlythrough inadequate or misroutedgrounding. Grounding in a switchingpower supply, like EM1 reduction, isone of those black magic areas.

Much of the noise generated con-sists of lOO-200-ns spikes which occurwhen transistor Ql is either turned onor off. It is not unusual to see 3-voltspikes (at about 30 kHz) on a 5-voltoutput line if you aren’t careful! Even-tually, you will discover that if you re-move the 12” ground extension jumperfrom the scope probe,and use just theshort pigtail ground across the loadthat the noise is actually less than avolt. That’s better, but not great.

In most cases, switching regula-

April/May I989 15

Page 14: Circuit.cellar.008.Apr May.1989

tor designs are greatly improved bypost-regulator filtering. Capacitorsalone, regardless of their size, usuallydon’t eliminate these high-frequencyspikes. Instead, an LC filter consistingof a 7-lO+H choke and a 10004700-PF capaci tor works well in most cases.Be advised that these aren’t just anyold inductors. Typical low-costmolded inductors are only rated at afew hundred milliamps. Since we aretalking amperes here, make sure thatthe filter components will handle thecurrent. The 9-amp Miller chokes thatI used reduced the electrical noise toabout 200 mV peak-to-peak.

Negative 12-Volt Buck-Boost Regu-lator

Creating -12 volts using the 78S40switching regulator is described sche-

VU SHITCH OUT4 5

: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ................................................................. ___,..._____,,____.____ /

16V

2;FB ;

- - 0.15V

matically in Figure 5. The major dif-ference between it and the straight

Figure 7-The LT7070 integrated switching regulator is often used in

buck regulator is that the inductorf,Yback co,.,verter desjgns

and diode are now in the reverse ated by the collapsing magnetic field feedback, current limiting, and LCpositions. The inductor is charged in the inductor is directed through the output filtering are handled much asduring Ton again, but this time during7’ofithe negative-polarity EMFgener-

Schottky diode to the output capaci- before except this circuit is designedtor and load. Regulation set-point to supply only about 200 mA.

Y o u rMove.

MODEL PCSS-81 OCTAL SERLhLCO~NICATi~N C O - P R - R* 8 Co-processor driven RS232 channel&card

* StOS Enhancement Software included.* Elfmtnates host processor overhead.* 32.204SKByte buffer memory.l May be used standalone in custom appl.

) HIGH PERFORMANCE

MODEL PCSS-SX MULTD’ORTSERIAL ROARD

MODEL 9000 {EHE)PROMMPU PROGRAMMER

l Fastest programmer on the mafket.l Quick&Intelligent programming

atgorithms.* Supports megabit eproms.l Programs largest variety of chips.

l 8 RS232 ports par card (opt. 4 port).l Alf 8 ports WO% DOS compatible,* 32 ports may be added to a PG.l Uptionat RS422 to 4WO ft.

* Interrupt driven EGOS Enhancement Software included,

Iflntelligence~ VematMy, High Performance andTime Savingproducts are what you’re looking for,

) TIME SAVING make that move to&y and let GTEP put one, two,

\ MODEL ROMX-2XLthree or allfour of tkeseproducts to workfor you!

_;; _IIEPROM EMULATOR

Remember, other development products areI available, -CAL&I!

l Emulates 2716-27010 eproms.l 256K to 1024K memory available.

* Battery backed up, auto emulate on power-up. DEVELOPMENT HARDWARE &SOFTWARE

* Low-cost, pays for itself on first project.P.O. Box mo; Bay St. LOui8. MS sszl-2310 U.S.A.

l Free 19.2K Serial Communications Software_OROER TOLL FREE lg002ii&OTEK (4@36f SAX: 1.Bf~1-4S7.0~6

MS b Tachnic~ suppoft 1.601487-fMm

16 CIRCUIT CELLAR INKCircle No. 12 1 on Reader Service Card

Page 15: Circuit.cellar.008.Apr May.1989

12-Volt Regulator: Boost or Buck?

When I got to the 12-volt section ofthe power supply, the configurationwas not as straightforward as theothersections. In fact, it was almost easierto contemplate going back to a low-dropout S-terminal series-pass regu-lator than to build what seemed to berequired here. The trouble with pro-ducing12voltsfromalOV-17Vsourceis that it can’t easily be done with asingle-stage design. Let me explain.

Using a buck-converter design wecan produce 12 volts from an appliedvoltage of approximately 13V to 45V(theupper limit of the 78S40). Similar-ily, using a boost-converter design wecan produce 12 volts from an appliedvoltage of approximately 5V to 12V (atypical12-voltoutputboost-convertercircuit is illustrated in Figure 6). Un-fortunately, since our input supplyvoltage can range from 1OV to 17V, noone circuit adequately fits the bill.

Just for the sake of experimenta-tion, I did build a buck-buck-boostcompound regulator just to see if theresults were worth the effort. Using acircuit similar to Figure 3, I made a 3.5-amp, S-volt output buck regulator.Then, with a circuit similar to Figure 5,Iconfiguredan8-volt-to-12-voltboostregulator. Surprisingly, the com-pound configuration worked, but itseemedlessefficient than1 would haveliked and it produced more electricalnoise than theothercircuits; undoubt-edly because of greater PC board realestate and radiating components.

The results of my empirical cut-ting-and-pasting are in Photo 1.

A Flyback Regulator to the Rescue

As the others around the officehere can verify, I had considered for-getting this whole project idea becauseI hadn’t arrived at a “neat,” cost-effec-tivesolution to theproblem. ThePhoto1 prototype, while workable, washardly some thing I cared to make morethan one of. It was at that point that Icame across the Linear TechnologyCorporation LT1070 integratedswitching regulator and its suggesteduse in flyback converter designs.

The LT1070, block diagrammedin Figure 7, is a fixed-frequency cur-rent-mode switching regulator. Itoperates from 3V to 60V and can beused to produce the same buck, boost,and buck-boost circuits previouslydescribed as well as a flyback con-verter. The major advantage of theLT1070, unlike the 78S40 used at thiscurrent, is that both a 5-amp transistorswitch and a 0.02-ohm current-sens-ing resistor are internal to the LT1070chip. This not only reduces heatsinkand board space requirements but alsoeliminates theradiatednoisefromcon-nections between these components.The shorter the wires in a switchingregulator design the less electricalnoise.

The flyback converter circuit isvery straightforward: The LT1070closestheswitchontheprimarywind-ing causing the transformer core to

store energy in its magnetic field. Aresistor-capacitor-diode “snubber”network isinserted across the primaryto reduce switching transients. Nocurrent flows in the secondary wind-ings because the diodes are reverse-biased at this time. When the switch isturned off, the magnetic field collapsesand induces a voltage into the secon-dary windings. Given the reverse-polarity of the collapsing field, the di-odes become forward-biased and theenergy is transferred to the outputs.(Note: It is important not to confusethis flyback pulse transformer with asinusoidal AC transformer half-waveconverter design. In all cases the sec-ondary windings use Schottky diodesand the energy is transferred in square-wave pulses, much the same way asthe previously described buck con-verters. Use of “standard” siliconrectifiers will cause excessive powerdissipation and low output voltage.)

The PE-65108 pulse transformerhas two primary and three secondarywindings. Given the turns ratio, thiscircuit can work at either 6 volts witha parallel-wired primary, or at 12 voltswithaseries-wiredprimaryasshown.There are three secondary windings.Two can be used for 12-volt outputswhile the third is designed for 5 volts.

The system regulation is con-trolled by feedback from the 5-voltsupply section. The 5-volt secondaryoutput usesa resistor divider networkto compare the 5-volt output to a 1.24-volt reference in the LT1070. If theoutput voltagestarts todrop, thepulse

USN+12u

l PE-65108INS822

0 UOUT+12u 8.733

SB840 OR 662 -12u 8.2%

0 UOUT

+_3200 VFD +su 62.M

Figure a- The final LTl070-based design uses fewer components than the equivalent 78S4Gbased design.

April/May 1989 17

Page 16: Circuit.cellar.008.Apr May.1989

18 ClRCUlT CELLAR INK

RS-232CINTERFACE ANDMONITORINGEQUIPMENTCATALOG

WRITE or CALL for YOUR FREE B&BELECTRONICS CATALOG TODAY!Pages and pages of photographs and illustrated,descriptive text for B&B’s complete line of RS-232converters, RS-422 converters, current loop con-verters, adapters, break-out boxes, data switches,data splitters, short haul modems, surge protec-tors, and much, much more. Most products meetFCC15J.

Your RS-232 needs for quality, service and com-petitive prices will be more than met by B&B ELECTRONICS. Manufacturer to you; no middleman!

Money-backguarantee!Same-dayshipment!One-year warranty on products! Technical supoti isread& available.

Terms: ha, MC, cash aders pxkpaid. P.O.’ s tan q&led ratedlrms accepad. IL reiden& add 6 i/4% sales tax.

0 RUSH MY NEW FREE CATALOG

NameCompanyStreetCity State-zip-

B&B elertrwnirf5MANUFICTURING COMPAN”4032C Baker Road l P.O. 1040

Ottawa, IL 61350Phone: 81 S-434-0846

:ircle No. 105 on Readers Service Cart

width-modulated switching regula-tor just lengthens Ton a bit for eachcycle to compensate and vice versa.

With the 5-volt secondary regu-lating properly (and not overloaded)approximately 14V-16V is induced ineach 12-volt secondary winding. Apair of special low-dropout-voltagethree-terminal linear regulators areused to create a regulated 12-voltoutput. LM2940-12 l-amp, low-dropout regulators require only 0.6 voltsacross them (Vout-Vin) instead of the3 volts typical of 7805-type devices.The LM2940-12 is only available as apositive voltage regulator, but withisolated windings,each secondary canbe configured as an isolated 1Zvoltoutput. One is simply inverted toappear as a negative 12-volt output.

The Proof is in the Pudding

One final concemisradiated EMI.To minimize this electrical noise andinductive pickup, the divider resis-tors and the components between pin1 and pin 3 should be mounted veryclose to the LT1070. A single-pointgrounding system should be em-ployed with the wires routed for leastradiation (black magic again). All threesecondary outputs have post-regula-torLCfilterstoeliminatespikes. You’llnote that the divider feedback net-work is connected on the “quiet“ sideof the LC filter so that output noisedoes not unduly influence regulatorstability.

This flyback regulator seemed towork quite well and noise was gener-ally less that 200 mV peak-to-peak onany output on my prototype. I wouldexpect it to improve on a productionPC board. With a 12-volt input I wasable to obtain 2.5 amps at +5 volts, 0.75amp at +12 volts, and about 0.25 ampat -12 volts. If I raised the input volt-age to 17 volts, more output currentwas available from all three outputsproportionally. Conversely, at a giveninput voltage, the 5-volt output cur-rent could be raised if the 1Zvolt out-put currents were lowered and viceversa. There seemed to be a minimum5-volt current necessary for regula-tion, however, and a lOO-ohm resistorwas added to make sure it was always

there (and should be removed in afixed-use application).

As the input voltage was loweredto 10 volts, the available output cur-rent wasalsoreduced. Conservatively,it was still 1.5 amps at +5V and a 100mA at +12V. I tested this to the ex-treme and found that the board stillregulated down to about a 6.5-volt in-put (of course if I ever had to dependon that, I’d probably have worseprob-lems elsewhere). If you use this de-sign for currents lower that I speci-fied, then you may want to use analternativeregulator. BoththeLT1071and LT1072 have lower current rat-ings and costs.

The completed power supply cir-cuit, shown in Figure 8 and Photo 2,used considerably fewer componentsand less board space than the previ-ous three designs to produce the samerelative power output.

Ll

Sources

J.W. MillerDivision Bell Industries19070 Reyes Ave.Rancho Dominguez, CA 90224(2 13) 537-5200linear Technology1630 McCarthy Blvd.Milpitas. CA 95035(408) 432-l 900

Pulse Engineering, Inc.P.O. Box 122357250 Convoy CourtSan Diego, CA 92112(619) 268-2400

IRS201 Very Useful202 Moderately Useful203 Not Useful

Circuit Cellar BooksCircuit Cellar INK writers often refer to previousCiarcia’s Circuit Cellar articles. These past articlesare available in book form from Circuit Cellar Inc., 4Park St., Suite 12, Vernon, CT 06066.

Ciarcia’s Circuit Cellar Volume I covers artides inBYTE from September 1977through November 1978.Volume II covers December 1978 through June1980. Volume Ill covers Juiy 1980 through Decem-ber 1981, Volume IV covers January 1982 throughJune 1983. Volume V covers July 1983 throughDecember 1984. Volume VI covers January 1985through June 1986.

Page 17: Circuit.cellar.008.Apr May.1989

Ctrl

‘ls’ BLE ’ N KLetters to the INK Research Staff

#Answers Clear and SimpZeI

Tell me Why

I want to thank you again for the fine work you aredoing to disseminate electronic leading-edge technologyand encouraging us to look deeply into this field and itsmushrooming future.

I have a few questions for you:1. Concerning HAL-4, why are the signals to IC8

(74HC373) scrambled on input and then descrambled onoutput?

2. The original schematics show the IC4 (8255) CShooked over into IC7 (74LS138), which supposedly is notthere until the full system is defined. The same situationexists for IC5. Why is this? How should it be hooked up?

3. At a previous job, I worked on a parallel processingsystem which had three CPUs running in parallel, andused a memory scheme which included “shared” RAM,which could be accessed as read/write by any or all of theCPUs, as well as “private” RAM which could only beaccessed by its associated CPU. I was wondering how onewould go about setting up a circuit layout so as to be ableto do this with microprocessors.

4. I am having a bit of difficulty finding information asto what to do to establish a CMOS/TTL interface. Can yougive me some hints here?

5. Where can one get information as to what sort ofcurrent demands different devices will incur, so as to beable to total up a system’s power usage?

6. What is a good way of interrogating a battery-sup-plied power setup so as to detect a “battery low” condi-tion?

Allan R. SummersPasadena, TX

Dear Allan,

Thanks for the kind words on OUT projects! We t y to strikea balance between “leading edge” and “practical” projects;letters like yours tell us that we are on the right track.

The scrambled lines on Hal’s ZC8 make sense if you look atthe printed circuit board. Assigning the bits in that order madethe tracesfit on a double-sided board! Since this depends on fheparticular board, you’ll find differenf layouts on all the projects;ve y often we leave the choice of bits up to the guy who does thePC board bayou f.

That schemafic showing the combinafions of 8031 systemswas essentially correct, but you have to take the colored back-

There were a few minor errors in the schematics; if you’re

grounds with a grain of salt. Basically, some of the gates neededfor various “subsysfems” wound up in the wrong colors simply

particularly interested in the details you should sign onto the

because gerrymandering in all the peninsulas and tributaries

Circuit Cellar BBS and get fhe latest information.

would huve complicated things a little too much. What it boilsdown fo is that, if a circuit looks like it needs a connection, if does!

The trick to having both local and shared memory is that youmust have buffers and gates to provide separate dafa paths foreach CPU, with separate address logic on both sides. If you takealookaf thelmageWiseschematics,you’llseehow fhevideodafabus (going fo Ihe ADC and DAC chips) is separated from the8031 data bus (going to the EPROM and address latch). Tracedown the addresses though the mu1 tiplexers to see how the 8031can bedoingsomefhingwhilefheZUMsarehandlingvideodafa.

There are several ways to convert from CMOS to TTL,rangingfrom ZCs dedicated to the job all fhe way down to baling-wire circuits you build on thefly. If depends on how many linesyou need to convert and how many units you‘re building;a one-ofi project can use circuitry that makes no sense in a realproduction unit.

Rather than give you the answer, we’ll describe the process.There are two conditions you have to cover: a CMOS low levelmust draw enough currenf from the 7TL gate to ensure that it“sees” a zero, while a CMOS high level must supply enoughcurrenfforthe7TLbackleakagefoshuf offthegafe. Therequisitecurrents and voltages differ for the various flavors of TTL andCMOS logic, as well as for individual gates within each family,so there are no hard-and-fast rules.

One rule of thumb is that you should nor have a singlegatedriving both CMOS and TTL loads; stick with one or the ofher.This simplifies building the converters because you don’t have foworry about the effects of drawing nonstandard currents fromthegafe on the rest of the system.

The data books that give you enough informafion to buildlevel converters also tell you about the maximum and averagecurrent requirements for the complete chip. Mail order partssources usually advertise the National and TZ data books; take alookat the Digi-Keyand Jameco catalogs for thespecifics. Makesure you gef the Application Nofes books, too, because they havelofs of recommendafions and hints for handy circuits.

As you might expect, defecting a low-battery conditionrequires an analog-to-digital converter. Forfunately, you onlyneed one bit, so it isn’t too hard to build, sincesomething likean

20 CKCUT CELLAR INK

Page 18: Circuit.cellar.008.Apr May.1989

LM313 comparator that compares a referenceagainst the batteryvoltage fills the bill. When the battery falls below the referencevoltage, the EM312 output changes state (either high to low orlow to high, depending on your circuit y) and your CPUsfarfssaving things.

The frickis that you’vegof to beable to correlate the batteryvoltage with remaining charge. Thevolfagevaries with ambienttemperature, as does the available charge, so this isn’t quite assimpleas if sounds. Wedon’f recall fheparf numberofiand, butwe think National Semiconductor makes a battery-voltagemonitor IC that handles some of thegrisly details. Once you getfhedafa books you can fakea walkthrough the “building blocks”section and find something useful.

You cangef rapid answers to questions like these by signingonto the Circuit Cellar BBS. There are a bunch of reallycompetent folks hanging out there who can probably answer anyquestion you can dream up. Best of all, the whole group cansuggest approaches you haven’t thought of and describe all thedetails based on real experience.

A Problem of Power

I have a car restoration shop. My problem is that myCAD system (AT clone running at 10 MHz) sends outbeeps and stops when we use our plasma cutter, which hasno HF to start its arc.

Our telephone system, a genuine Bell setup, lights upall six buttons and won’t ring when our HF piggyback arcstabilizer runs when we’re using the heliarc welder.

Is the fix as simple as adding ground wires? Or shouldI build a screen room around the welder/cutter?

How about this as a project for your magazine-YZlean Power in an Ugly World”?

Robert J. SchumannKansas City, MO

Dear Robert,

Every now and again wegef a letter that reminds us of justhow odd things get out in the real world.. .

The hash in your AT and phone system is probably comingthrough the power lines. If could be radiated (we bet you don’thave any background music playing while you’re welding, doyou?), but we think the place to start is with the line cords.

Any electric arc will generate energy across the entireelectromagnetic spectrum, quite literallyfrom DC to daylight infhecaseofa welder. Nafurallyenough,fhemorepowerinfhearc,the more power shows up as interference. What you need is afilter foremovefheobjecfionablefrequencies whileleffingfhearcburn normally. From our experience with EMI (electromagneticinferferencejgenerafed bycompufersysfems,aferrifefilferis theway to go.

Ferrite filters are made up ofafinely divided iron compoundwith a high resistance to electrical current. A current-carryingwire passing through a ferrite slug induces a current in the

ferrite, but theferrite’s resistancedissipates fheenergyveywell.The resistance increases withfrequency, so fheslugforms a quiteeffective low-pass filter.

One catch is that the ferrite slug must be able to handle theinduced current without saturating. In the case of your weldersand cutters, that’s going to fake a pretty big chunk! Rather thanpaying real money for this project, fake a trip to the local junkyard and scavenge the yokes from a couple of TVsefs-the older,the better. If you’ve never rummaged around in a TV bt$ore,what you’re looking for is the deflection hardware around theneck of the picture tube. Along with all the coils is a big hunk ofblackferrite, which is just what you want. You may have to breakthe tube fogef the yokeoff, but that’s why you do this trick in thejunk yard instead of Sears.

Do be careful, though, because the implosion resultingfromshattering thepicture tube can blow glass all over the neighbor-hood. Wear a face shield and gloves. The safest method is to putthe neck of the tube in a plastic bag and rap if with a screwdriver.This presumes, of course, that the junk yard has no furtherinterest in the tube!

With a few yokes in hand, simply string the power linesthrough them. If the power lines go directly to a junction box onthe wall, run the cables on the secondary side through the yokes.The key point is that the ferrite slug should form a continuouspath around the current carrying wire, with one wire per yoke.Don’t bother wrapping the wire around the yoke, because one“turn” is enough; more turns simply builds a step-down trans-former with a single-turn shorted seconda y.

You should see an immediate improvement, but if not, f ymoving the yokes closer to the workpiece. Because fhearcs are thesource of the hash, the less wire carrying the current, the lessinterference will be induced elsewhere in your building.

As an alternative, fy puffing a yoke or two on the powerlines leading to the AT and phone system. After all, if doesn’tmatter where you filter the hash out as long as if doesn’t get tothecircuit y. You will have fofilferall of fhepower lines leadingto the AT; don’t forget the printer and modem!

We’ve been thinking of doing an article on RFI control andyour letter has pushed us over the edge. It’ll probably show uparound the end of 1989, simply because we’vegof so much otherstuff to do between now and then.

IRS204 Very Useful205 Moderately Useful206 Not Useful

In Visible INK, the Circuit Cellar Research Staff answers micro-computing questions from the readership. The representativequestions are published each month as space permits. Send yourinquiries to:

INK Research Staffc/o Circuit Cellar INK

B o x 7 7 2Vernon, CT 06066

All letters and photos become the property of CCINK and cannotbe returned.

April/May 1989 21

Page 19: Circuit.cellar.008.Apr May.1989

PRODUCT REVIEWS:The Next GenerationCircuit Cellar INK sells out and enjoys it!

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

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

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

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

No Dweebs Here

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

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

22 ClRCfJlT CELfAR INK

let the Games Begin

As we began look-ing through the litera-ture on evaluating sys-tems, we worked ourway through the Whet-stones, Dhrystones,Savages, LivermoreLoops, and many more.We found that none ofthem really told volumepurchase influencerswhat they needed toknow about the systemat hand. We thoughtabout presenting all ofthe tests in an easy-to-read chart format sothat readerscould formtheir own opinionsbased on the informa-tion presented. Then we came to our senses and realizedthat what readers really want is to be led by the nose,bludgeoned by a single sledgehammer factoid that theycan point to in self-defense when things fall apart. If it’sa flattering number that companies can use in advertisingto justify their high prices, all the better.

With all of the above in mind, we formed our “MagicNumber Search Committee.” We knew that the mostimportant piece of the puzzle was the name. After hoursof research, pages of dictionary work, and several intenserounds of Balderdash, we found The Word. Henceforth,when systems of any type are compared, they will becompared in our devastatingly elegant unit of measure,the Mopoke. The range of Mopoke is from -53 to 177,using a logarithmic scale. Using the logarithmic scalemakes for snappier graphics and often makes manymediocre products look far better than they truly are.

Inside the Mopoke

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

Page 20: Circuit.cellar.008.Apr May.1989

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

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

time for each individualiteration (timed andrecorded by a specialnearly nonintervention-ist external CCINKBPE&JFCTF clock thatis linked by special opti-cal links to the AtomicClock at the NationalBureau of Standards) islogged, and the resultsare averaged using ageometric mean. Next,polar Fourier transformsare performed on thetotal data set at S-degreeintervals. These results,along with the geomet-ric mean from the firstevaluation, become fod-

Ider for the Mopoke can-non.

Next, we fearlesslydive into the human factors morass. Our dedicated staffpainstakingly measures keyboard feel (key travel, key capsize, depth at roll-over, angle of attack, height of the littlebumps on the home keys), display ergonomics (dot size,dot pitch, glare, aspect ratio, jitter, swim, bugaloo, accessi-bility of controls, versatility of inputs, and how hard it is tosneak the thing home to use withyourVCR),and mainunitconstruction (footprint, depth, height, hat size, presence ofnifty LED displays, decibel level of the fan, pitch of the fan,aesthetic considerations). We then go whereno review hasgone before and quantify what can only be called “EgoAppeal Factor” (EAF). The EAF takes into account impor-tant issues such as: Will this system make your bossjealous? Does the color of the system complement yourpower ties? Do the noises of start-up guarantee thateveryone in the office knows when you fire that sucker up?We run the results from all of these scientific tests througha weighted averaging system, where weights are deter-mined using a complex system based on the researcher’sbiorhythm, the hourly exchange rate between the U.S.dollar and the Greek drachma, and the Solunar Tablepublished in Field and Stream.

We don’t overlook reliability in the Mopoke, either.We are the only publication that runs each and every testunit through both a steel annealing oven and a cryogeniclife-extension chamber to check for continued operation attemperature extremes. We also operate each system inbooth #7at the “Tans for theMemories” tanningsalonandat the bottom of a washtub filled with Evian water to testfor susceptibility to damage from humidity extremes. Ourline-noise isolation test includes operating the system onthe same line as a heliarc welder, and injecting a signaltaken from side B of Def Leppard’s most recent single intothe test AC line.

As thorough as are these tests, we recognized thatmost failures involve hard disks. To stress-check harddisks of portable computers, we bolt the little monsters tothe main oscillating mixer down at “Merle’s Paint’N’Plas-ter World.” Desktop units are subjected to a patent-pending procedure we like to call the “Extreme PrejudiceTest.” Suffice it to say that this rigorous examination ofWinchester technology involves expensive disk drives,high-velocity ammunition, and a very low “Pass” ratio.

Now, most magazines would stop right there, butwe’re committed to press on. We know that most users arefar more afraid of their system’s manufacturer failing thanof the system itself failing. So, in an action unprecedentedin computer journalism, we rate the reliability of themanufacturer. First, we use the standard ratings based oninformation from Standard & Poor, Dun & Bradstreet, andthe men’s room attendant at the New York Stock Ex-change. Next, we test based on “look and feel” issues suchas color (or presence) of the CEO’s hair, number of com-pany executives wearing brown shoes with blue suits,glossiness of the annual report, and quantity of shrimpserved at the company’s COMDEX party. Finally, we takea hard look at marketing expertise including public rela-tions budget (did they bribe us?), advertising budget (dothey advertise with us?), and use of inappropriate celebri-ties, water fowl, or hors d’oeuvres in their ad campaign.

As with the other categories of data, company reliabil-ity information is not left to peacefully ferment. No, werun the raw numbers through a data colander unmatchedin subtlety and precision. The results are factored withnumbers taken from deep between the lines of the WallStreet ]ournal, New York Times, and Daily Racing Form.When we’re through, you’re presented with the one num-ber that can indicate beyond a shadow of a doubt whetheryou should place your trust in a company by purchasingits product. Several Wall Street heavies have come to usbegging for our numbers, but we have steadfastly refused.You see, we value the welfare of our readers far more thanwe value the paltry few million dollars offered for oursecrets. Knowing that you will be able to make major pur-chasing decisions based upon what you read here is worthmore to us than miles of yachts or buckets of caviar.

So now you know the why and the wherefore of ourreview process. As you turn the page, do so with theproper reverence, for you are truly taking part in a new era:The Age of MOPOKE. 0

Aprl//May I989 23

Page 21: Circuit.cellar.008.Apr May.1989

W ith our powerful new bench-marking tools in place, we de-cided that the first review

should be comprehensive, a detailedlook at a broad cross-section of pow-erful computational tools. For years,limp-wristed computer journals havebeen telling you that there’s no realway to compare different system typeson an even and fair basis. Poppycock!With the Mopoke at our disposal, wecan readily compare Apples and or-anges, DECs and Wangs, and IBMsand Banana Juniors.

Knowing that our readers arenothing if not diverse, we chose fourvery different computing solutions tocompare in our first review. For thevolume purchase influencer, wepicked the GeneriComp 286, a plain-vanilla PC/ AT clone. The more tradi-tionally minded among you shouldbe cheered by the inclusionof the Goo-golplexx 100, an S-100 mainframesystem. For the aficionado of portablecomputing we picked the most pow-erful computer, in the smallest pack-age we could find-the Hewlett-Pack-ard HP-41CX. Finally, just to provethat there’s no place the Mopoke can’tgo, we included a simple, dedicatedsystem, known and beloved by manyas an essential tool for modern living.We‘re talking about the Proctor-SilexTPB-5342 Dual-slot toaster.

There you have it, the lineup forthe first iteration of the most compre-hensiveandimpressiveproductevalu-ation system in the history of man-kind. Now let’s moveon to the tests.. .

The Hardware

The GeneriComp286: If you’re lookingfor the most risk-aver-sive choice in officeproductivity solu-tions, you’ll be hard-pressed to find a moreconservative com-puter. The safety-con-scious ~-MHZ topspeed, the haven of anIndustry StandardArchitecture (ISA) bus,and the soothing beige

SuperchargedWorry MunchersCircuit Cellar INK looksat four diverse applica-tions solutions

color unite to make this computer a“safe” option in many environments.We got this baby with 1 MB RAM,EGA, one 1.2-MB floppy drive, a 40-MB hard disk, lOl-key keyboard, oneparallel port, and one serial port. Acopy of GeneriComp MS-DOS ver-sion 4.0 came with the system, alongwith a handsomely photocopied Us-ers’s Manual. If CYA is the order ofthe day at your office, the Generi-Comp deserves strong consideration.

The Googolplexx 100: In days ofyore, when men were men and com-puters could heat the south wing ofyour house, Googolplexx became thecomputer marquee of choice amongthose truly “in the know.” The famedGoogolplexx One has been updatedthrough the years, with thelatest batchof revisions bringing us to theGoogol-plexx 100. As with all computers ofthis ilk, the 100 comes out of the boxpretty much useless. We stood aroundand gaped at the 43-slot backplane,the 382-watt power supply, and thevariable-pitch 1.5-horsepower cooling

fan. When we came back to earth andrealized that testing would be hardwith no components, we ordered a 6-MHz Z80 CPU, 1 MB of RAM (bank-switchable in 64-KB chunks), a quadserial port board, a parallel port boardwith cache, a DEC VT220 terminal,two 8-inch quad-density floppy diskdrives, and a 40-MB hard disk. Wealso decided to get a five-foot-highequipment rack in laboratory blue tokeep everything corralled. For soft-ware, we stuck with CP/M version2.2. Documentation included 47 sepa-rate User’s Guides, Technical Guides,Application Guides, and SchematicSupplements. No overall index orbookshelf was included.

The HP-41CX: If cranking away atnumbers while you’re bouncingaround in the back of a Jeep is part ofyour job description, then a portablecomputer may well be high on yourwish list. We chose the HP-41CX as anexample of a portable computer thatmakes sacrifices in user interface inorder to concentrate on the portabilityside of the portable computer equa-tion. The 41CX packs 8 KB of memoryinto a package less than l/20 the sizeof the GeneriComp. The HP comeswith a one-line display, 39-key key-board, and business-like dark browncase. It has a built-in clock/calendarand four proprietary expansion slots.We chose to get the handy leatherettecarrying case (belt loop included) forbetter portability.

The 41CX comes with an operat-ing system and fullyfunctional software.Documentation is intwo useful volumes.

P r o c t o r - S i l e xTPB-5342: Who hasn’texperienced the warmfeeling of waking upto hot chocolate and acouple of pieces ofc runchy bu t t e r edtoast? When we weretrying to decide whichsystem to pick torourid out our review,this sturdy chromebeauty was the nostal-gic unanimous choice.The hardware in-

April/May I 989 25

Page 22: Circuit.cellar.008.Apr May.1989

New! ModularProgramming SystemFROM MODULAR CIRCUIT TECHNOLOGYThis integrated system is Ideal for developers--it easily expands as vour needs crow! All themod&s uke a corn&n host adaptor card so youneed just one slot to program EPROMS, PROMS,PALS and more!

l A umversa mterface for all the programming$29.95

. User-selectable programmable addressesprevents addressing conflicts

l Includes a high quahty molded cableMCT-MAC

xu~ xv .*>%+ 11as<.s #de--* L

Universal Module $499.99l Programs EPROMS, EEPROMS, PALS,

bl-polar PROMS, 8748 & 8751 series devices.l Programs 16VR & ZOVB GALS (gallium arsemde)

from LATTICE, NS, SGSl Tests TTL, CMOS, Dynamic & Static RAMS- Load disk, save disk, edlt, blank check, program,

auto read master, verify and comparel Textool socket accepts .3 to .6” wide IC’s from

S-40 pinsMCT-MUP

EPROM Module $7 19.95l Programs 24-32 pin EPROMS, CMOS EPROMS

and EEPROMS from 16K to 1024Kl HEX to OBJ converterl Auto, blank check/program/verifyl WI’ selectable 5, 12.5, 12.75, 13. 21 & 25 volts* Normal, mtelhgent, interactive, and quxk pulse

programming algorithm

MCT-MEPMCT-MEP-4 4-EPROM ProgrammerMCT-MEP-8 R-EPROM ProgrammerMCT-MEP-,6 16-EPROM Programmer

$169.95$259.95$499.95

PAL Module $249.95. Programs MMI, NS, TI 20 & TI 24 pm devices’ Blank check, program, auto, read master, verify

and security fuse blowMC?-.MPL

PAL Programming development softwareMCT-MPL-SOFT 599.95

chides a smart rotary toasting dura-tion knob, two separate cook sequenceinitialization switches, two full-widthslots, a complete set of state-of-the-artradiant energy coils, a pair of time-actuated target product egress eleva-tors, and a handsome chrome case.

The TPB-5342 has achieved anadmirable level of user friendliness.The software was completely trans-parent to all testers. Given the dedi-cated attempt the company made atproviding a complete system solutionwhich requires remarkably little usertraining, the saddle-stitched documen-tation was completely adequate.

The Tests Begin.. .

The first part of our testing proce-dure is an examination of the execu-tion times for instructions. As weworked our way through this section,we made some startling discoveries.

The GeneriComp computer per-formed pretty much as you wouldexpect. I mean, everyone in NorthAmerica has seenat least 93 reviewsofsimilar machines, right? Anyway,since detailed information on eachniggling detail is not what theMopoke’s all about, suffice it to saythat after yawning through every oneof the “Friday the 13th,” “NightmareonElmStreet,“and”Halloween”mov-ies while the 80286 trotted through itspaces, we were finally able to dumpthe raw data into the Mopoke’s gap-ing maw. We let it quietly fermentwhile we went on to the Googolplexx.

When we started on the Googol-plexx, some of our engineers got allmisty-eyed thinking about the “olddays” and wanted to install toggleswitches on the front panel so theycould enter all of the instructions byhand. Then we ran into our first di-lemma with this system. When exer-cising the instructions, should we testthe mainframe and the terminal, orjust the mainframe? Boy, did we everscratch our heads over this one. Wefinally decided that the terminalcouldn’t really hurt, and might actu-ally help the results, so in it went. Bynow, we were looking forward to thestark simplicity of the Hewlett-Pack-ard. Little did we know.. .

Now, if you look back at our ex-planation of the Mopoke, you’ll seesomething about a million iterationsof each instruction. That’s no bigproblem with a big counter, and a nicekeyboard to help you out. The HP-41CX has a fairly good counter, buthave you ever really looked at thekeyboard? We’ll say more about it inthe human factors section, but you’vegot to know that those keys are tiny-and hard. We ended up taking moretime than we had planned because wehad to keep sending out for Dr. Scholl’spads (we found out they work just aswell on fingers as on toes) and adhe-sive tape. Grown engineers werereduced to whimpering hulks as theirindex fingers took the brunt of thebrutaltestingprocedures. Ittookdedi-cation, but our chests swelled withpride when we were finally able toshove the HP results through theMopoke’s statistical wood chipper.Since we finished with the 41CX atabout 4:30, we were all looking for-ward to the Proctor-Silex.

The basic procedure for testingthe toaster was simple: Insert twopieces of bread, set brown level, starttoasting, and time until finished. Itwasn’t until we sat down to order thetesting material that we realized therewas a problem. Let’s say that theaverage loaf of bread contains 25 slices.Four loaves take up about one cubicfoot. If you’re following, you see thatwe have 100 slices per cubic foot. Eachiteration of the test requires two slices(one for each slot), so we need 2,000,OOOpieces of bread, occupying approxi-mately 20,000 cubic feet. But wait!There are eight different brown-levelsettings on the toaster. Our chief labtechnician decreed that each level wasin fact a different instruction, mean-ingthat wereallyneed 16,0OO,0OOslicesof Wonder Bread. That many sliceswill take up approximately 160,000cubic feet. We’re talking about fillingup a block of average houses withtoast, here. Most other labs wouldhave given up at this point, but not us.The order was placed;the trucks rolledin, and the toasting commenced. Weall became jam and jelly experts, andour publisher has a great idea for whatto give away with new subscriptions.

26 C//?CUlT CfL!AR INK

Page 23: Circuit.cellar.008.Apr May.1989

The Touchie-Feelie Stuff

When we started looking athuman factors for the GeneriCompcomputer, weal1 started feelingunder-dressed. This is, after all, a machinethat pretty much demands a pin-striped suit and wing-tip shoes. Thebox itself is rather austere, with sharpcomersand lines,a staid tandemeanor,and no little LED panels telling youhow fast it’s going. The keyboard is astandard lOl-key affair with a soft,mushy feel, as if they had used KraftMiniature Marshmallows as returnsprings. Most of the staff rated it overthe 41CX, but well below the VT220.

The display is a standard VGAmonitor of obscure heritage. It’sbright,sits on top of the computer, and canshow you a DOS prompt in 256 colors.Wow. Then there’s the all-importantEgo Appeal Factor. The Genericompgets middle-of-the-road marks on thisscore, because there are just so manylike it out there. Sure to peg you as amid-level manager in most firms, the286 screams for a spreadsheet to belocked on its display. It is the K-car ofcomputers: It’s solid and reliable, butwon’t get you tons of style points.

The Googolplexx 100 is not thetaut, trimbox of the GeneriComp. Therack would crush most desks, andSasquatch has a smaller footprint.Actually, even if the rack would fit onyour desk, you probably wouldn’twant it there since the fan sounds likean A-10 ‘Warthog” attack jet and hasenough force to blow your briefcaseacross the room. The Googolplexxwill use lots of power, but your utilitybills shouldn’t go up much becausethe heat generated by the unit will letyou lower your furnace thermostat.

We gave the Googolplexx highmarks in Ego Appeal Factor. Thereare several neat lights among the sev-eral front panels,everyoneon the blockwill know when you turn it on, andyou’ll need a bigger office to store it. Ifyou wear the right accessories (horn-rim glasses, pocket protector, white

The VT220 impressed most of ourlab staff. Good keyboard, nice “hi-tech” look, graphics that are fine forassembly language programming.. .ittook top marks from our expert crew.

socks), the company will find a way towork “Engineer,” “Programmer,” or“Technical Wizard” into your job titleafter you arrive with this baby.

The HP-41CX was a bit of a prob-lem. The keyboard is lousy for touch-typing, and the screen makes any flightsimulator program a real challenge.Fortunately the bad stuff ends there.

The 41CX has the smallest foot-print of any system in this group. Thesleek dark case will look right at homeon the most thoroughly Italian-designer-inspired desktop.

Of course, the41CX makes its caseon portability. To be even-handed,we tried he other systems for similarportability. The HP-41CX arrived in agenuine leatherette case with a handybelt loop. It does, indeed, fit on astandard belt, sobecame our baseline.The next system to go onto the beltwas the GeneriComp. After the testsubject pulled his pants back up, wegave this one low portability marks.The Googolplexx was even less port-able. As a matter of fact, we couldn’teven move it by attaching it to every-one’s belts. The Proctor-Silex cameclosest to the HP in portability. It (andthebelt)stayedup,butthecord tendedto limit traveling range somewhat.

Apart from its lack of true porta-bility, the Proctor-Silex had soonworked its way to the topof our humanfactors lists. Take the keyboard-faraway. Why? Because you don’t needit! What genius! The display, too, is amasterpiece of understated elegance.No other system allows you to simplylook in the top of the case for an instantupdate on the progress of processing.

The big statement is why theProctor-Silex scored highly in the EAF.There’s certainly no mistaking thislittle gem for a Mac or P!3/2. As amatter of fact,there’snomistaking thekind of statement you’ll make byputting this system on your desk nextto your Day-Timer.

The controls are ergonomicallycorrect and easy to use. When youtalk about intuitive, user-friendlycomputing, you have to start with theProctor-Silex. Plus, despite its smallfootprint, the high-quality chromefinish helps the TPB-5342 make a bigstatement on any executive desk.

THE INTERCHANGE”Bi-directionalDatsMigration Facilityfor IBM PS/2, AT, PC, PORTABLEand Compatibles _

Features:*Parallel port to parallel port.*Economical method of file transfer.*Bi-Directional file transfer easilyachieved.

*Supports all PS/2 systems(Models 30, SO, 60, and 80).

*Supports IBM PC, XT, AT, Portableand 100% compatibles.

*Supports 3 l/2 inch and 5 1 f 4 inch disktransfers.

*Supports hard disk transfers.*Supports RAMdisk file transfers.*The SMT 3 Year Warranty.ONLY $39.95

FastTrap”The pointii device of the future iahere!

*Two and threeaxis pointing capability.

*High resolutiontrackball for X and Y axis input.

*High resolution fingerwheel for 2 axisinput.

*Use with IBM”PC’s, XT’s, AT’s andcompatibles.

*Three input buttons.*Full hardware emulation of Microsoft @Mouse.

*Standard RS-232 serial interface.*Includes graphics drivers and menugenerator.

*Easy installation.‘1 year warranty.*Made in U.S.A.

ONLY $149.00

LTS/C Corp.167 North Limestone StreetLexington, Kentucky 40507Tel: (606) 233-4156

Orders (800) 872 - 7279Data (606)252-8968 [s/12/2400 8-N-11VISA, Mastercard, Discover Card,TeleCheck

Circle No. 128 on Reader Service Card

April/May 1989 27

Page 24: Circuit.cellar.008.Apr May.1989

More Mopoke

Well, there’s plenty more detail togive you, but that’s not what theMopoke is all about, now is it? Sure,we could go on about our searchthrough the financial section for dataon company reliability, or even makeyour hair stand on end with tales aboutthe adventures we had with the “Ex-treme Prejudice” hard disk test, with asidebar on the ballistic properties of.44 Magnum hollow-point ammo. Butwe won’t muddy the water with de-tails. No, we’ll boldly go where nocomputer magazine has gone beforeand cut to the.. .

Surprise Ending

When we gathered close aroundthe Multiprocessor Mopoke Engine tosee what the results would be, the an-ticipation was palpable. When the re-sults finally came out, you could haveknockedusoverwithafeather. There,in stark black and white, was the win-ner of our first group review: The

Proctor-Silex TPB-5342 Dual-SlotToaster.

The TPB-5342 scored an amazing102.6984 Mopokes. In looking backover the raw data, we’re not sure whyit scored so highly, but we suspect thehigh ratings in Human Factors, Prod-uct Reliability, and Company Relia-bility overshadowed the toaster’srather mundane performance rating.

The HP-41CX came in second inour tests, with a 96.4205 Mopoke score.The HP far surpassed the other sys-tems in portability, making up for akeyboard that was suboptimal for mosttouch-typing applications. A strongsecond-place showing in HumanFactors helped, too.

Third place in our lineup goes tothe Googolplexx 100. It seems thatEgo Appeal Factor was the majorconsideration in helping the Googol-plexx attain 73.9917 Mopokes. It iscertainly a system that anyone herewould be proud to own. In addition toEAF, the Googolplexx came out ontop in general performance. As anyWordStar fan will tell you, a ~-MHZ

Z80 is one cranking little processor.Every shootout has to have a loser,

and in this case it’s the GeneriComp286. The buttoned-down demeanorof the AT clone was good for only34.9628 Mopokes. The Genericomp’sbest finish was in performance, whereit squeaked out a second-place stand-ing over the 41CX. After that, anunbroken string of thirds and fourthscontributed to the last-place finish.

While we were surprised by theMopoke rankings, it’s obvious thatgood ergonomics, a strong design, andserious use of RISC principles are thesystemdesign waveof the future. Vol-ume purchase influencers looking fora safe, forward-looking choice shouldheed the message in this solution-based comparison.

Now, we don’t want to makedecisions for you, but the lesson isclear: If an appliance is what you want,a toaster is hard to beat. 0

IRS207 Very Useful208 Moderately Useful209 Not Useful

- DIGITAL VOICE MODULE -l Low cost l Super qualityl Selectable banks l lWampl 4 Sampling rate l DRAM operation

DVM-l- $49 (without RAM)

-PASSIVE INFRARED DETECTOR -l Used In alarm system, moving detectionl Super sensitive l Exchangeable lensl Very reliable l Analog Pulse Count

RK4000PCA - $59

MING Engineering, Inc.515 S. Palm Ave., #5Alhambra, CA 91803

(818) 570-0058

28Circle No. 133 on Reader Service Card

CX’CWT CELfAR INK

“ The Best 8051 Emulator”

5 ft. cable

PC based emulators for the 8051 family(8051151FAl52/31132l44l152/451/452/535/552 + C M O S + more- PC plug I” boards or R-232 box * Program Performance analyzerl Pull-down menus combmed with * Powerful Macros with IF-ELSE, REPEAT.

Command-Drwn User fnterface WHILE sfructuresContext sensitw? help and l Source Level debug for PUM-51 and G51On-Screen Edtbng 01 data - Symbolic debuggmg wlfh m-line assembler

l 20 MHz real time emulabon and disassembler- 128K emufakm memory l Execution fine counter* 48 bit wde. 16K deep trace b”“er - Trace can be vlewed during emufat~on!

wlfh loop counter

PRICES: 32K Emulator for 8031 $1790: 4K Trace $1495’CALL OR WRITE FOR FREE DEMO DISK!

‘US only Ask about our demo VIDEO!

noHaU ?l?$%&zfue

CORPORATION (408) 866-1820

Circle No. 134 on Reader Service Card

Page 25: Circuit.cellar.008.Apr May.1989

Writing a Real-Time Operating Systemby Jack Ganssle

Part 2 1

Memory Management and Applications for the HD64

L ast issue’s installment aboutBCC180 RTOS discussedhow the task structure

works. This month we’ll exam-ine the memory managementaspects of multitasking, and anexample application.

Memory Management

The RTOS structure de-scribed so far is more than ade-quate for normal operations ona 280. However, the HDM18O’smost powerful enhancement isits internal MMU. A method ofmanaging it is essential.

The MMU is both a blessingand a curse. It gives programsaccess to 1 MB of memory, 16times the space available to theZ80. Programs previously nm-ning up against memory limita-tions can use the MMU to gainas much elbow room as needed.

The HD6418O’s hardware canhandle a large address space, but howcan a program with 16bit addressesget to it? Unlike the 8088, there are nosegments;youcan’tsplitdataandcodereferences (Zilog’s new Z280does givesplit addressing; a 280 program cango to 128K with essentially no changein the code). The software must dy-namically remap the MMU every timean access is needed outside of thecurrent 64K logical map. This makesit virtually impossible to write a con-ventional linear program longer than64K. A way of breaking the code intosmaller logically complete sections isneeded, along with a method to com-mand the MMU to bring the propersections of code into view as needed.

at 4000H and goes to 7FFFI-I. Com-mon 1 runs from 8000H to the endof memory. This configurationgives the operating system andother utilities 16K of memorystarting at OOOOH. All tasks typi-cally start at logical 4000H andcan be as long as 16K each. Com-mon 1 is the RAM data area.

CommonOftheoperatingsys-tern and other goodies) and theRAM area are always visible inthe logical map; they are nevermapped out. The Bank area,where all tasks arc stored, is theonly section affected by remap-ping. It is usually remapped foreach task to bring new ones intoview.

With this memory layout, 16Kis reserved for the RTOS and otherimportant global routines; 32K isavailable for variables. The restof memory, almost 1 MB, can be

Fortunately a multitasking RTOScan automatically remap the MMU togive access to very large programs.Tasks are logically complete sectionsof code; since only one task can beactive at a time, only the active taskneeds to be mapped into the currentspace at any time.

The BCC180 RTOS takes advan-tage of this by assigning each task to aseparate map. The operating systemautomatically resets the MMU afterevery context switch, bringing theproper code into view.

BCCl80 RTOSs memory map isconfigured as three separate banks. Inkeeping with standard HD64180 pro-gramming practice, Common 0 startsat location OOOOH and runs to logicaladdress 3FFFI-I. The Bank area starts

tasks. Sixteen kilobytes per task isalmost always enough, since tasks bytheir nature should each be simple;it’s better to have a lot of simple tasksthan a few big complex ones.

In some applications, other mem-ory configurations may be required.More RAM may be needed, or largeror smaller task sizes accommodated.The only thing sacred about the mapoutlined is that the RTOS start in lowmemory and never be mapped out,and that RAM be available somewhereand never remapped. The valueCBAR DATA in the code can bechanged at will, within these con-straints, to suit other requirements.

Since the HD64180 MMU has aresolution of 12 bits, this approachimplies that each task will use at least

30 ClRCUlT CELLAR INK

Page 26: Circuit.cellar.008.Apr May.1989

4K of memory space. Does this meanthat a program with four short taskswill need 16K (possibly wasting mostof it)?

Fortunately not.1 The TCB con-tains two values &hat affect mapping.A BBR (Bank Base Register) is storedfor each task, so the MMU can be rem-apped to this address. However, everytask’s start address is also saved. If alltasks started at 4000H logical (forexample), a start address would notbe needed.

tasks requiring some sort of service,typically performs a context switch inabout 800 microseconds. This meansabout 8% of the processor time is usedto support the multitasking (since ticsoccur every 10 ms).

By saving a start address, manytasks can be located within one map.In the extreme case, the entire pro-gram can use only 64K-set all BBRvalues the same, store each task at adifferent address, and set the properstart addresses within the TCB (usingOS-DEFINE). Thus, BCC180 RTOSgives the user all possibilities; mapping can be defined in virtually anyfashion, or it can be completely ig-nored simply by setting all BBR val-ues to 0.

The HD64180 is a reasonably fastprocessor while handling interruptsand for context switching. New archi-tectures are now becoming availablewith built-in features enablingblindingly fast tasking. For example,the H16, another Hitachi product,includes 16 identical register banks.Much of the work of a context switchcan be done in a single instruction!

Admittedly, it is very powerful, butthat power is useless if it won’t fit inthe system’s ROM. In these days ofcheap memory, designers often electto throw ROM at a problem, but that isnot always possible. Hitachi’s newHD647180X, a single-chip computerderivative of the HD64180, is limitedto 16K of ROM-period. Especially insingle-chip systems, memory must beconserved! BCC180 RTOS is quitesmall, requiring only a few hundredbytes.

Sample Application

Another important criterion fordetermining the performance of anyRTOS is to examine the code’s size.Intel’s iRMX can be huge, precludingits use in low-end applications.

We’ve described the operatingsystem in detail. Now I’11 present asimple multitasking program to showthe use of the RTOS and the varioussystem calls that request task servic-

A word of caution: Since taskscan be assigned to maps, no taskshould ever call or access an addressin another task. That address may notexist when the task is running! If youchoose to disregard this advice, besure you’re a mu1 titasking expert, andbe sure the tasks are reentrant.

start: Id sp,tOspcall inituart ; initialize the UARTId hl,OId (counter),hl ; zero counterrt init ; initialize the OS-

rt_define taskl,tlsp,0,40,1; define task 1rt_define task2,t2sp,1,32,2; define task 2rt_define task3,t3sp,2,32,3; define task 3rt_define task4,t4sp,3,32,4; define task 4

Performance

rt_run 1.5 ; start task 1rt run 2,300 ; start task 2-rt_run 3,lOOO ; start task 3rt_run 4,50 ; start task 4

root: jr root

By its nature, a real-time operat-ing system must be fast! It is chargedwith making sure external events aremonitored and serviced on time; pre-sumably those events won’t wait for aslow computer. For this reason, theRTOS must be coded in assemblylanguage and optimized for speed.Portability is the rage today, so someoperating systems are written in C oreven Pascal, a practice that I find of-fensive.

i; inituart--init the UART to 9600 bps

inituart:Idout0Idout0ret

a, 64huartinita,baudratebaudport

; 8 data, 1 stop, no parity

; set data rate

; task l--inc a counter

Context-switch times are difficultto measure since they’re a function ofthe number of tasks in the TCB (theRTOS must search the TCB on everytask), priority assignments, and typi-cal task states. However, it is possibleto find average times for average situ-ations.

asegerg 4000h

taskl: Id sp,tlspId hl, (counter)inc hlId (counter),hlrt_exit ; end task

; task 2--reset the counter to 0

BCC180 RTOS, when handling 16 Listing 1 -Example multitasking application (continued on page 32)

April/May I989 31

Page 27: Circuit.cellar.008.Apr May.1989

ow 5000h.phase 4000h

task2: Id sp, t2spId h1,OId (counter),hl ; zero counerrt exit.dephase

; end task

;; task 3--cancel task 2 after a while;

or9 6000h.phase 4000h

task3; Id sp,t3sprt cancel 2rt-cancel 3

; cancel task 2; cancel ourselves

rt exit.dephase

;; task 4--display the counter;

erg 7000h.phase 4000h

task4: Id sp,t4spId hl, (counter) ; number to displaycall hex4 ; dump itId c,Odhcall tout ; send a crId c,Oahcall tout ; send an Ifrt exit-. dephase

sting 1 -(continued from page 3 I)

ing.Listing 1 is a five-task program

(remember, task 0, at ROOT, exists bydefault). Task 0 does nothing; it runsan infinite loop. Task 1 increments amemory-based counter once every fivetics. It runs at a high priority, estab-lished when the task was defined bythemacro RT DEFINE.

[Editor’sNote: Complete softwarefrom this article is availablefor download-ing from the Circuit Cellar BBS or onSoftware On Disk #8. For downloadingand ordering information see Page 70.1

Task 2 runs infrequently (onceevery 300 tics). It resets the counter tozero.

Task 3 cancels task 2 after 1000tics, effectively killing off the resettingof the counter to zero. It also cancelsitself, since once task 2 is killed, task 3is done forever.

Task4 prints the valueof COUNTERtwice a second (50 tics). (HEX4 printsthe number in HL in hex.1 This letsyou see the effect of task interaction.The counter value will be generallyincreasing since task 1 runs often. Onceevery three seconds it is reset to zero

SC-,,The ideal solution for embedded control

applications and stand-alone development.

a lntel8052AH BASIC CPUa Serial printer output and 5, 8 bit l/O ports0 5 in.* prototyping area. Memory: 8K RAM, expandable to 128Kl Power requirements: 5V.DC @ 300 ma. only. PROM progammer; Z/F socket for 2764 or 27128 FPROMl rnterrupt handling capabilityl Built to exacting standards and warranteedl Still only $228.00 including documentation (quantity 1)

Cal/ now! 603-469-3232

•B Binary Technology, Inc.Main Street . PO Box 67 - Menden. NH 03770

Em@2

1 DeveloDment ToolsPseudoSam~ross-assemblers $50 00PseudoMax Cross-simulators $lOhO

PseudoSid Cross-disassemblers $100.00PseudoPack Developer’s Package $200.00($50.00 Savines)

I POwEliFUL -’Pseudo&de is pleased to announce the release of an extensive line OIprofessional crossdevelopment tools. Tools that speed development olmicroprocessor based products. Fast, sophisticated macro assemblers tcgenerate your program code:Versatile simulators that allow testing anddebugging of the program even before the hardware exists. Easy to usedisassemblers to help recover lost source programs.

AFFORDABLEUntil now, powerful tools like these have been priced from 5 to 10 timesPseudocode’s price. Putting these time saving tools out of reach of all butlarge corporate engineering departments.

BROAD RANGE OF SUPPORT0 PseudoCode currently has products for the following microprocessofamilies (with more in development):

Intel 8048 Intel 8051Motorola 6600

FICA 1802.05 Intel 8006Motorola 6801 Motorola 6.311

Hitachi 6301Motorola 8805

Rockwell 65cOzpk$xll&y MOSTechnolog 6502 WDC85co2

Motorola 68000.8 Motorola bOl0Zllog 280, NSC Lo Hitachi HC641BO

l To place an order call one of our dealers:Programmer’s Connection USA (800) 336-l 166 INTL (216) 494-3781

KORE Inc. (616) 791-9333PseudoCode

P.O. Box 1423Newport News, VA 23601-0423

@I) 595-3703

Circle No. 13.5 on Reader Service CardCircle No. 101 on Reader Service Card

3

CIRCUIT CELL4 R INK

Page 28: Circuit.cellar.008.Apr May.1989

by task 2 and the count resumes itsincrementing. After 10 seconds, task3cancels task 2, so the count is neveragain reset to zero.

Each of the tasks runs in its ownmemory map. They’re small, so theydo waste most of the address spaceallocated to them. However, this il-lustrates the use of the RTOS withmemory management and the load-ing of tasks in different maps.

Every task is assigned to logicaladdress 4OOOH, and occupies exactly10OOH bytes (the mapping resolutionof the MMU). The BBR values incre-ment from 0, so the physical addressesof the tasks are 4000H (task l), 5000H(task 2), 6000H (task 3), and 7000H(task 4).

The tasks may not be defined attheir physical addresses since internaljumps will then go to the indicatedaddress and not the logical address,which is where the program reallyruns. Tasks cannot be defined at theirlogical addresses because then all ofthe tasks would be at the same ad-dress, causing assembly errors.

The solution is to use an ORG di-

rective to set the physical address ofthetask,and .PHAsEand . DEPHASEto force the assembler to assume thecode is really somewhere else-inthis case at the execution address(4OOOH). The code is loaded at thecorrect physical address but it isassembled at the proper logical spot.

At the extreme, a command-lineinterpreter and disk system could beadded, giving a multitasking form ofCP/M. There seems little reason,though; most CP/M application pro-grams won’t run well in a multitaskingenvironment.

Possit$z Enhclnee

BCC180 RTOS is more a startingpoint than an end product. Manyapplications may demand more per-formance, more features, and greaterversatility. One logical extension isa dispatcher. Instead of compilingoperating system calls (via macros)into the application’s code, it wouldbe simple to issue a RST instructionwith an argument to request RTOSservice.

BCC180RTOSmakesallofRAMglobal to all of the tasks. RAM couldinstead be allocated to tasks andmessages passed via mailboxes andsemaphores. A more dramatic ex-tension would let tasks idle whilewaiting for a message.

BCC180 RTOS provides a com-pleteenvironmentforhandlingmulti-tasking problems. While it does notprovide many of the functions inter-active computer users are accustomedto, it is a solid base on which to buildreal-time multitasking applications.All of the multitasking and memorymanagement is handled by the oper-ating system and is mostly invisible totheuser,makingBCC180RTOSagoodplace to begin exploring real-timemultitasking. 0

IRS2 10 Very Useful2 11 Moderately Useful212 Not Useful

Micromint now makes affordabetter with Image

itizing even

The company that made video digitizing aff or even better withImageWise/PC~ . Bring your reports, graphics, security n up to the newstandard in cost-effective gray scale video digitizing with the new ImageWise/PC~.

l Digltlze any NTSC. PAL, or SECAM video source1* Up to 256x255 resolution wllh 256 level gray scale1l True frame grabber - dlglties In l/60 secondl* Dlglllzes 30 frames per second1l Composite video output1l Can display dlgltlzed pictures on EGA or VGAIl Advanced overlay and split screen capablllliesll Digltlzed Images compatible wlih paint and desktop publlshlng

program4l Modlfy, enhance, display, and print Images using sophlsiicated

ZIP Software Included with every ItnageWlse/PCI

Order by: TEL: (203) 87 1-6 170FAX: (203) 872-2204TELEX: 64333 1

MICROMINT, INC. - 4 Park St., Vernon, CT 06066

Circle No. 131 on Reader Service Card April/May I989 33

Page 29: Circuit.cellar.008.Apr May.1989

ImageWise/PC-The Digitizing Continues

Part 3by Ed Nisley Topping it off with Software

A lthough solder is the favoriteprogramming languagearound here, the ImageWise/

PC is held together with a large chunkof firmware. Now that you are ac-quainted with the hardware design,we can investigate the code making itall possible.

I’ll start by describing the 8031firmware controlling the ImageWise/PC card, then the routines that passin-formationandcommandsbetweenthecard and the PC, and finally the PCutility programs needed to run thecard.

Firm Control

The fundamental reason we usedan 8031 microcontroller on the Image-Wise/PC card is that it simplifies thedesign without restricting flexibility.Using firmware instead of hardwaremeans a change to the control logic isaccomplished with a program ratherthan a soldering iron.

For example, the 8254 Program-mable Interval Timer (U21) generatestiming for the rest of the circuitry froma lO-MHz clock. A video sync pulsestarts when the OUT0 pin of Counter0 triggers Counter 1 and the durationof OUT1 sets the pulse duration. Thefirmware controls those two counterson the fly to create all the differenthorizontal and vertical pulses neededfor each video frame.

Although a dedicated sync gen-erator chip could produce those pulses,the firmware squeezes more tricksfromthe8254. For example, theNTSC,PAL, and SECAM standards are just abunch of different pulse timings.Genlock is largely a matter of repro-

34 ClRCUlT CELL4 R INK

grammingCounterO’smodeandrout-ing the incoming sync pulses to itstrigger input.

Best of all, adding features wedidn’t anticipate can be a simple mat-ter of firmware! There are somechanges that can’t be handled in thecode, but many require just a few(hundred) more lines of assembler.

Making a Big Sync

The 8031 firmware has only twomain tasks: create video sync pulsesand communicate with the PC. Thecode is structured to ensure that syncgeneration has absolute, unquestionedpriority over anything else that maybe going on. Failing to put a syncpulse out at the right moment willcause painfully obvious jitter on themonitor.. .and there’s nothing moreannoying than an obvious glitch.

Fortunately, although the synccode must have high priority, the 8254

provides some relief from criticaltiming. A change made to an 8254register affects the next output pulserather than the current one, so thefirmware can load a new value anytime before the current interval ex-pires. This requires some carefulthought to make sure that the rightvaluesgo into the right registersat theright time, but overall the process iseasy to understand.

Figure la shows the sync pulsesoccurring at the end of the first videofield, with times in microseconds. Thefirmware must load the 8254 registersat the indicated points to produce thevertical sync signal. Because the 8254uses a lo-MHz clock, the firmwarewill load 318 (decimal) to produce theinterval shown as 31.8 microseconds.

Even in this short section of videosignal you can see that most intervalshave no timing changes. During the244 visible scan lines there are notiming changes at all. Although the

a1 8 2 5 4 s e t t i n g s

CtrB Period 31.72.3 Ctrl Width 27.1 2.1

63.5 Ctr2 Blank

bl I n t e r r u p t r o u t i n e s

nnnnnwuuuu

ihalflins -v iG1-v ieqlb -Y,J ieqlbe

LineSync LineSync LineSync

Figure 1 - The 803 l’s primary responsibility is sync generation.

Page 30: Circuit.cellar.008.Apr May.1989

sync generation is critical, much of thetime there is nothing to do!

Each sync pulse causes an INTOinterrupt which vectors into the maininterrupt handler shown in Listing 1.The variable REPCOUNT counts downto zero,at which point the STATE vari-able selects the appropriate sync rou-tine to handle the next timing change.The overhead during the active videolines is around 12 p, which is under20% of the total time available.

When REPCOUNT becomes zero,

LINESYNC saves the processor regis-ters, swaps to Register Bank 1, anduses STATE to select an entry in thejump table pointed to by R6 /R7. Allsync routines end with a jump toENDSYNC to restore the registers andreturn to the interrupted routine.

ThelabelsinFigure lbcorrespondto the sync routines shown in Listing2. For example, IHALFLINE getscontrol on the next-to-last full activevideo line to set up for the half line atthe end of the first field. LINESYNC

;-; Video sync interrupt handler; Basic timing is set by lOO-ns clock for 8254 timer; At least 5 microseconds have elapsed up to this point; Interrupt source is controlled by "genlock" output bit,

; but the state table base address in R6/R7 determines the

; routine that's in control...

LineSync PROC ; entry from vector codePUBLIC LineSync

;- tick state rep count and decide what to doDEC repcount ; tick counterXCH A,repcount ; is it zero yet?JNZ goback ; not zero, continue

;- need to handle a state changeXCH A,repcount ; restore APUSH PSW ; save bystandersPUSH ACCPUSH BPUSH DPHPUSH DPLSETB RSO ; select reg band 1MOV A,state ; get state offsetRL A ; get two-byte offsetMOV DPL,R6 ; set up state code baseMOV DPH,R7 ; set up state code baseJMP @A+DPTR

*- if no;oback

state change, return to normal code

EQU $XCH A,repcount ; restore A and countRET1

*- co-n return for state routinesLlSyllC EQU $

PUBLIC EndSyncPOP DPL ; restore caller's regsPOP DPHPOP BPOP ACC

POP PSWRET1

LineSync ENDPROC

listing 1 -Video sync interrupt handler

handles the interrupt without furtherbranchingwhenP.EPCOuNTisnonzero.

Because saving and restoring reg-isters takes about 30 ys in addition tothe 12 JJS needed to decrement and testREPCOUNT, IIIOSt sync routines getcontrol one sync before the 8254 regis-ters must be loaded. This ensures thatthey have ample time for any instruc-tionsrequired to get ready for the8254updates. For example, the first twolinesin IHALFLINE simply wait forthe next sync pulse on the INTO input(which is EQuated to SYNCINT, whichis much easier to remember whenyou’re writing code).

Sync Choices

Although it may sound as thoughthe differences between various syncstandards are just values loaded in8254 registers, the situation is a littlemore complicated than that. It turnsout that a different set of firmwareroutines is needed for each sync stan-dard, as well as for internal andgenlocked sync in each standard.

The reason is simple: the firm-ware must guarantee that the 8254registers will be loaded at the correcttime. As you see in Listing 2 andFigure lb, some of the interrupt rou-tines span several INTO pulses becausethe timing does not allow saving andrestoring registers. Because the pre-cise timing during the vertical syncpulses depends on the sync standard,the code must be optimized to suit.

The firmware startsup in internalNTSC mode. Selecting a different syncstandard, changing Che timing, orgenlocking must be handled by a PCprogram similar to SETIMWPC.

Because control from the PC is socritical to actually using the Image-Wise/PC, it’s time to describe howthat process works.

Registered Data

In the previous installment I men-tioned that theI’Ccommunicates withthe ImageWise/I’C firmware using aset of registers holding timing values,counts,andvoltagesettings. Thisideais similar to the 6845 controller used inIBM PC CGA video boards, but, un-

April/May 7 989 35

Page 31: Circuit.cellar.008.Apr May.1989

like that chip, the ImageWise/PC usesfirmware to simulate the registers.

Listing 3 shows the firmware’smain loop. If I hadn’t already de-scribed how sync generation works,you might think there was somethingtragically wrong: there are only threeinstructions! Because sync is entirelyinterrupt-driven, the main loop needsno calls to that code.

The 8031 input bit INDEXLOADEDis set to zero whenever the PC writesa value to the INDEX port. When thefirmware isn’t executing the sync gen-eration code it checks that bit everyfour microseconds. While that mayseem excessive, remember that thecode has literally nothing else to do.

When INDEXLOADED becomeszero, the firmware branches to thecode shown in Listing 4. The firststeps read the INDEX and DATAREGvalues (from addresses PCINDEX andPCDATAIN) into 8031 regiSk!rS.

Bits0 through6of the INDEX valuespecify which firmware register is ofinterest, while bit 7 is set to write theregister and cleared to read it. be-cause the firmware uses only registers0 through 2F hex, a range check on theINDEX value rejects incorrect registernumbers. There is no way to flag anerror, but because the interface rou-tines use constant register addressesthis does not pose a problem.

Most of the registers are mappedinto values in the 8031 Internal RAM,so reading or writing them is just amatter of copying data between DA-TAREG and RAM. Most of the InternalRAM values are used by the sync inter-rupt routines, which move the valuesinto the hardware at the correct times.

Some registers collect several bitsfromdifferent I/Oportsor status flags.The Control Register, addressed byINDEX = 0, is an example of such aregister. It controls functions rangingfrom enabling the video output tograbbing a new image, each selectedby a single bit value.

ThecodeatpC_wrctrlsexecuteswhen the PC writes a byte into theControl Register. It writes a copy ofthe entire byte into Internal RAM atPC controls and then moves thei&&dual bits into their proper places.

The Control Register video en-

*- field 1 half line of video,; gets control at next-to-last full video line; merges with the equalizing routine to ensure correct timing‘ captures half-line sync to ensure correct timing; captures first equalizing sync to ensure correct blanking; Half line of video is +1 count

ihalfline PROC

half0 JNH syncint,halfO; wait for line syncCLR syncint ; suppress interruptM W DPTR,#I82540MOV A,IntLineH ; figure half lineRRC AM W %AMOV A,IntLineLRRC AADD A,#1 ; add one count to half lineMOVX @DPTR,AMOV A,BADDC A,#0MWX @DPTR,AINC frames ; tick frame counter

half1 JNH syncint,halfl; wait for half-line syncCLR syncint ; suppress interrupt

*- set up for equalizing pulsesI; 6 equalizing pulses are +l count

half2

M W DPTR,#I82541M W A,IntHqualL : equalizing sync duration

@DPTR,AM W A,IntHqualHMWX @DPTR,AM W DPTR,#I82542M W A,IntLineL ; blank whole lineMWX @DPTR,AM W A,IntLineH

@DPTR,AJNE3 syncint,half2; wait for equalizing syncSETH disablevideo ; force blankingSETS vretrace ; indicate vert retrace timeCLR syncint ; suppress interruptCLR frameflag ; indicate field 1 is doneM W repcount,IntEqualN ; two syncs capturedDEC repcountDEC repcountINC stateLJMP EndSync

ihalfline ENDPRGC

;- field 1 vertical sync; gets control after 5th equalizing sync; captures 6th sync to ensure correct timing; vertical sync pulses are -1 count

ivsyncl PROG

vsl JNH syncint,vsl ; wait for 6th eq syncCLR syncint ; suppress interljlptMW DPTR,#I82540M W A,IntLineH ; figure half line

listing 2-NTSC sync interrupt routines (continued on page 37)

36 ClRCUlJ CELLAR INK

Page 32: Circuit.cellar.008.Apr May.1989

ivsyncl

RRC AMOV H,AMOV A,IntLineLRRC AMM @DPTR,AMOV A,H

@DPTR,AMOV DPTR,#I82541MOV A,IntVSyncL ; vert sync pulse durationMOVX @DPTR,AMOV A,IntVSyncHMOVX @DPTR,AMOV repcount,IntVSyncN ; one sync caughtDEC repcountDEC repcountINC stateLJMP EndSync

ENDPROC

I*- field 1 second equalizing pulse; gets control after 4th vertical sync; captures 5th sync to ensure that we get control correctly; captures 6th sync to ensure correct timing; The first 3 equalizing pulses are -1 count, remaining 4; are +l count

ieqlb PROC

eqlbl

eqlb2

JNH syncint,eqlbl; wait for 5th vert syncCLR syncint ; suppress interruptJNH syncint,eqlb2; wait for 6th vertical syncCLR syncint ; suppress interruptMOV DPTR,#I82541MOV A,IntEqualL ; equalizing sync durationMOVX @DPTR,AMOV A,IntEqualHMOVX @DPTRAMOV repcount,IntEqualN ; two syncs caughtDEC repcountDEC repcountDEC repcountINC stateLJMP EndSync

ieqlb ENDPRCC

,*- transition to full horizontal line timing; gets control after 3rd eq sync, sets period to +l count; captures 4th sync to ensure good timing; captures 5th sync, changes to norm1 horizontal period; captures 6th sync, merge with vertical blanking setup

ieqlbe PROC

MOV DPTR,#I82540MOV A,IntLineH ; figure half lineRRC AMOV H,AMOV A,IntLineLRRC AADD A,#1 ; add one count to half lineMOVX @DPTR,AMOV A,H

listing Z--(continued)

able bit provides an interesting ex-ample of the complexities that creepinto something that “ought to besimple.” Inprinciple,PC_video turnsthe video output on or off, so youmight expect it to control D I SABLEV-IDEO directly.

Inpractice,thesyncinterruptrou-tines Set DISABLEVIDEO wheneverthe output video must be turned off.That code checks PC-video, which iscontrolled by the PC, so that the videoremains off when the PC wants toblank the screen. Unfortunately, if thevideo is enabled or disabled in themiddle of the active video lines, manymonitors develop heartburn becausetheir sync detectors mistake that volt-age transition for a vertical sync.

So the firmware sets or clearsPC video as commanded by the PC,then waits for the interrupt code toupdate DISABLEVIDEO during thevertical retrace. Although the routinecould return control to the PC beforeDISABLEVIDEO matches PC-video,that might conflict with a subsequentattempt to capture an image. Ratherthan forcing the PC code to figure outwhen to capture an image, the firm-ware just spinsuntil everything isOK.

Thesyncinterrupt will turnDIS-~~~~~~~~~off(thusenablingthesig-nal) only when it finds PC video on.This allows the PC interface code towait for the first match betweenPC video and DISABLEVIDEO withconfidence that the interrupt codewon’t change the setting later.

The genlock control bit is anothercomplex example. The action requireddepends on which sync standard is inuse, whether the camera producesclean sync, and whether the video isalready locked. In this case, the firm-ware can compare the GENLOCKhardwareoutputbit(readasaninput1withthedesiredstateof PC genlock

to decide what to do. The Capture-Lock and UnLock routines handle allof the complexities, returning onlywhen the deed is done.

The program on the PC must ver-ify that the genlocking status bit in thefirmware status register (INDEX = 1)matches the intended state in the con-trol register. If genlocking failed, per-haps because there was no camera at-

April/May1989 37

Page 33: Circuit.cellar.008.Apr May.1989

How to get morefrom your

IMAGEWISE

ZIP Utility PackN e w ! . . . . . . . . . . . . . $39CONVERT gray scale images for usewith other programs. Choose amongthese popular file formats: PIW-PIF-PCX-ASC-WKS-TIF

ANALYZE images for quality control andresearch. Load image data into l-2-3,etc. and analyze according to yourspecific needs. Generate histograms,descriptive statistics, and pixel count ateach gray level.

CREATE images with your spreadsheet- use data, calculations, or equations togenerate images for use in ZIP and viewx-y-z interactions. Be creative and makeshading patterns, frames, or surreallandscapes.

EDIT images and individual pixels withany VGA paint program. Turn the paletteinto 64 shades of gray for realisticviewing.

DISPLAY custom slide shows of videoimages, rotate, and create mirror imagesfor transfer applications.

ZIP Image ProcessingIfrpfoved! ZIP . . . . . . . $79Controls the serial ImageWiseTransmitter and Receiver. Holds 3pictures for image processing andcombining images. Sophisticated imageprocessing functions for enhancingimages and creating special effects.Advanced display techniques forEGAJVGA. Saves in PIW-MAC-PCX-TIFfile formats. Supports dot matrix, inkjet,color, and laser printers. Now shippingversion 2.7, updates available toregistered owners.

New! ZIP8 . . . . . . . . . $79Controls the n e w ImageWiseiPC.Reads/writes PIF-PCX-TIF gray scalefiles. 256 gray levels. Autocalibrationfeature adjusts IW/PC for the bestpicture using available light. Contains allZIP features.

HOGWARE COMPANY470 BELLEVIEW

ST LOUIS MO 83119

To order ZIP products call:(314) 982-7833

VIWC

38 ClRCUlT CELLAR INK

ADDC A,#0@DPTR,A

e q l b e l JNB syncint,eqlbel ; wait for 4th syncCLR syncint ; suppress interrupt

eqlbe2 JNH syncint,eqlbej! ; wait for 5th syncCLR syncint ; suppress interruptMCV DPTR,#I82540MOV A,IntLineL ; set full lineMCVX @DE'TR,AMDV A,IntLineHMOVX @DPTR,A

eqlbe3 JNH syncint,eqlbe3 ; wait for 6th syncCLR syncint ; suppress interrupt

*- field 1 vertical blankingI

MOV DPTR,#I82541MOV A,IntSyncL ; normal sync duration

@DPTR,AMOV A,IntSyncHMOVX @DPTR,AMOV repcount,IntVHlankN ; no syncs pendingINC stateLJMP EndSync

ieqlbe ENDPRCC

sting P-(continued)

; -; The Main Loop!

mainloop PRCC

JH indexloaded,L?nop ; 1 = index notloadedDecodeCmd

L?nop EQU $LJM!? mainloop

sting 3-The Main loop

. -,; Command decoder; Gets control when PC loads the index register; Flips state of status bit when operation is finished; (PCs my not be able to detect a few microsecond pulse every; time...)

DecodeCmd PROCPUBLIC Decodeand

*- extract the data from the PC interface hardwareI

MOV DPTR,#PCindex ; get index reg value

~sting 4-Image Wise/PCcode forthe PCinterface (continued on page9)

Page 34: Circuit.cellar.008.Apr May.1989

MOVX A,@DPTRMOV PCregnum,AMOV DPTR,#PCdatain ; get dataMOVX A,@DPTRMOV PCregdata,A

.-I; Handle registers than need special code

>>>> bulky code omitted <<<<

. -,; Handle register reads

JB ACC.Y,regwritesADD A,#-30H ; must be O..2FJC PC_badopMOV A,PCregnumADD A,#PCregbase ; convert to int RAM addrMOV RO,AMOV PCregdata,@RO; set up return valueJMP PC-complete

. -,; Handle register writes

regwrites EQU $CLR ACC.1 ; turn off write flagMOV PCregnum,AMOV A,PCregnumADD A,#-30H ; must be O..2FJC PC_badopMQV A,PCregnumADD A,#PCregbase ; convert to int RAM addrMOV RO,AMOV @RO,PCregdataJMP PC_complete

;-; Write PC Control Register

PC wrctrls- EQU $

*- video on/offI; The video actually switches at vertical sync times to; give a prettier transition. We wait here until; disablevideo is in the right state, which saves some; ugly polling in the PC program. Waits only occur if; the bit has changed!

MOV A,PC_controls; get old bitsxRL A,PCregdata ; identify changesCLR EA - hold off interrupts!MOV PC controls,A: and set changes for testsMOV C,&!_video - save changed flagMOV PC_controls,P&egdata ; set new bitsSETB EAJNC L?enabledone ; skip if no changeJB PC video,L?waiton- ; decide what to

; wait forL?waitoff JNB disablevideo,L?waitoff ; . . . off

SJMP L?enabledone

listing 4-(continued

tached,PC_genlockwillstillbelbutPC locked will be 0. The PC codem&t take appropriate action, whichmay involve screen messages, retries,or whatever.

Regardless of whether the PCwrote or read a firmware register, thefirmware copies the current registercontents into PCdataout so the PCcan see what happened. Writing thatport also deactivates INDEXLOADEDin preparation for the next exchange.

The INDEXLOADED~~~~~~~~~S inthe PC status register port, so the PCcould test it to tell when the firmwarehas completed the request. However,the firmware is fast enough that it maybe able to flip the bit off before the PCis ready to test it, so the PC can’t tellwhether the request was completed orthe machinery is broken.

Asecond bit,called OPCOMPLETE,provides an unambiguousindicationmarking the end of each operation.The firmware flips that bit when it isfinished so the PC test becomes amatter of detecting a change in thebit’s state. If the bit does not changewithin a reasonable time, the PC mayconclude that the firmware is out tolunch and start whatever recoveryprocedures are needed.

Having covered the firmware ac-tivity for a PC transaction, it’s time tolook on the PC side of the fence.

PC Communications

Listing 5 presents the two lowest-level routines to read and write firm-ware registers. The routines are simi-lar so I’ll walk through ReadReg to il-lustratethcmainpoints. BecausethePC code is in Microsoft C 5.10 andMASM while the firmware is writtenin Avocet AVMAC assembler, youneed to keep several names for thesame bit in mind at one time.

One bit of C trickery that may notbe obvious is my use of a union tocombine a bit field with an integervariable. I prefer to test status bits byname, rather than perform obscurearithmetic on integer variables, buttheclibrary I/O routines handle onlyintegers. The solution is to defineHWSBITSasabitfieldtogettheindi-vidualbit names, then form a union

April/May 1989 39

Page 35: Circuit.cellar.008.Apr May.1989

with an integer value to keep the li-brary happy.

ReadReg starts off by reading thehardware status port to get the OP-COMPLETE bit. The port value is storedinto the integer member of SB ITS 1using the union notation SBITS~. I,which also sets the bit field membersfound in SBIT S 1. B because they oc-cupy the same storage byte.

The next step is to write the regis-ter number into the index port. Be-cause the high-order bit is off (com-pare this with WriteReg), the firm-ware will go through the gyrationsdescribed in the previous section, re-sulting in the current register valueappearing in the data port.

The do-loop simply reads thehardware status port into the integermember of SB1Ts2. The loop testcompares the OPCOMPLETE bit usingthe bit field members of SBITS 1 andSBITS2. Theresultofthetimeouttestis saved in the global variable Time-dOut, which the calling routine cantest to determine if something unto-ward has occurred.

Regardless of how the loop termi-nates, ReadReg’s return value is readfrom the data port. Because there areno bit fields involved, the value is asimple integer.

All of the ImageWise/PC supportroutines eventually call ReadReg andWriteReg to handle data transfersbetween the PC and the firmware.Two additional routines (calledReadAllRegsandWriteAllRegs)read and write all of the firmware reg-isters in one shot to simplify saving orrestoring a complete configuration.

Twiddling the Knobs

Back in the good old days, elec-tronic equipment came with a realfront panel. Changing an operatingconditionwasasimplematteroftwist-ing a knob or flipping a switch. Therewas a satisfying physical connectionbetween the knobs and the functionswith a lot of tactile feedback.

Sad to say, the times have changed.Apart from four RCA jacks on theback panel, there is little to reveal anImageWise/PC in your system. Cer-tainly there are no additional knobs

PC_badop EQU $

MOV PCregdata,#OFFHJMP PC_complete

;-; Standard completion; PCregdata has the return value for reads and writes: Writing the data out register resets the "loaded" input

PC_complete EQW S

MOV DPTR,#PCdataoutMCV A,PCregQtaMWX @DPTR,A ; clear "index loaded" flagCPL opcoqlete ; done = status bit flipRET

Decode&d ENDPRCC

listing 4-(continued from page 39)

L?waiton !JR disablevideo,L?waiton ; . . . on

L?enabledone HQW $

;- simple bits

MOVMQVM wMOV

.- genlockIJNHJB

nolockSJMPEQnJNB

lset EQu

C,PC_overlayenableoverlay,CC,PC_digitaldigital,C

PC_genlock,nolockgenlock,lset ; if already locked, skipCaptureLocklsetSgenlock,lset ; if already unlocked, skipWnLock$

;- if continuous mode is off, force acquire off inmediately

JH PC_auto,isautoCLR acquire

isauto EQU $

;- image acquisition

JNH PC_grab,nogetGetVideo ; snag a new image

CLR PC-grab ; and simplify PC code...Mov PCregdata,PC_controls: update grab bit

noget HQW $

;- return

JMP PC_conplete

;-; General collection point for errors; We return an unreasonable value for most things...

40 ClRCUlT CELLAR INK

Page 36: Circuit.cellar.008.Apr May.1989

typedef struct (unsigned int vertsync:l; /* 1 during vertical retraces */unsigned int syncpulse:l; /* 0 during any sync */unsigned int genlocked:l; /* 1 when hardware genlock active*/unsigned int fieldlzl; /* 1 during fld 1, 0 during fld 2*/unsigned int misc:2; /* unused bits "1unsigned int opcom@ete:l; /* flips 0->l and l->O after ops */unsigned int indexloaded:l;/* wr index->l, 8031 data rd -> O*/

) HWSBITS;

typedefunion (unsigned int i;HWSBITS b;

f HWSTAT;

/* *//* Read a program register from the 8031*/

unsigned int ReadReg(unsigned int regnum) {

HWSTAT sbitsl,sbits2;time-t start,now;int retval;

sbitsl. i = inp(IOBase+CTL_STAT); /* get current status*/time(&start); /* mark starting time*/

outp(IOBase+INDFX,regnum); /* set register number */

do (/* stall until done */sbits2. i = inp(IOBasetCTL_STAT);

} while ((sbitsl.b.opcomplete - sbitsi!.b.opcomplete)&& (!(TimedOut = (TIMEOUT < difftime(time(&now), start)))));

retval = inp(IOBase+DATAREG);/* snag current ctl bits */return retval;

)

/* *//* Write a program register into the 8031 */

void WriteReg(unsigned int regnum,unsigned int regvalue) (

KWSTAT sbitsl,sbits2;time_t start,now;

outp(IOBase+DATAREG,regvalue); /* set output value */time(&start); /* mark starting time*/

sbits1.i = inp(IOBase+CTL_STAT); /* get current status*/outp(IOBase+INDEX,regnum+REG_WRITE); /* set index with write

flag*/

do {/* wait for csd end */sbits2.i = inp(IOE.%asetCTL_STAT);

) while ((sbitsl.b.opcomplete =- sbitsZ.b.opcomplete)&& (! (TimedOut = (TIMEOUT < difftime(time(&now),start)))));

)

listing 5-PC code for the Image Wise/PC interface

Circle No. 126 on Reader Service Card

SAVE Developmentand Debugging Time

of EmbeddedMicroprocessor Systems!

l INTROL-C Cross-Compilersl INTROL-Modula-2 Cross-

Compilersl INTROL Relocating Macro

Cross-Assemblers

COMPILER PACKAGES INCLUDE:Compiler l Assembler l Linkerl Runtime library. includinga multi-tasking executive lSupport utilities l Full yea’smaintenance

TARGETS SUPPORTED:6301/03.6801/03~ 6809.68HCll l 68000/08/10/12.68020/030/881/851 l 320X1/32181182

AVAILASLE FOR FOLLOWINGHOSTS: VAX and MicroVPX;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 support.CALL or WRITEfor facts NOW!

INTRO1C O R P O R A T I O N

647 W. Virginia St.Mihvaukss, WI 53204

41412762937 FAX: 414/27&7026Quality Software Since 1979

April/May1989

Page 37: Circuit.cellar.008.Apr May.1989

hanging off your PC and nothing inthe way of tactile feedback. Fortu-nately, the PC does provide a full key-board, a CRT display, and lots ofcomputing power, so there is little ex-cuse for an awkward user interfacedespite the lack of knobs.

The SETIMWPC program takesadvantage of the PC’s features to pro-vide a convenient and legible frontpanel for the hidden ImageWise/PCcard. I designed it to show all of thefirmware interface registers, as well ascontrol and status information, in onescreen because I can never rememberarcane command-line sequences. Fig-ure 2 shows the screen layout, whichdiffers slightly from the one you sawtwo issues ago. [Editor’s Note: Com-plete executable software from this articleis available for downloading from the Cir-cuit Cellar BBS or on Software On Disk#8. For more information see page 70.1

SETIMWPC stores all the configu-ration information in a file calledIMWPC.CFG. Whenever you startSETIMWPC, it automatically reads thisfile and sets the ImageWise/PC regis-ters.

Getting Started

Because the ImageWise/PC hasso many options, you may have sometrouble figuring out where to begin.The firmware and software can copewith a wide variety of video signalsbut you have to know what to adjustfor the right results.

When you install the ImageWise/PC board, you should make sure thatall the terminating jumpers are in-stalled. Although you canchange theseto adapt the board for different termi-nating systems, start out with knownconditions. If you plan to use the videooverlay circuitry, you must use the on-board terminators to prevent overshooton the signals.

Connect a monitor to the digitalvideo output on J3. If you have asecond monitor available, you cancon-nect it to J4 to watch the overlay out-put. While you don’t need both, itdoes make setup a little easier. Ofcourse, you must connect a camera toJl if you plan to capture video images.

The monitors on J3 and J4 should

ImageWise/PC Control Panel 0.9 Firmware 0.4 -,

Camera Blankingr Analog -

Eq. PulseI I I

F4-, rF5-,--F6TF7--rF8-, rF9-,-F1~ 1IUnLockU Grab I Show L-J

Figure 2- The Image Wise/PC’s control panel allows the user completecontrol over most timing parameters.

be terminated to match the defaultvoltagesettingsinIMWPC.CFG. BothTV monitors remain blank when youfire up the PC because the Image-Wise/PC is reset until you explicitlystart it. Run LOADIMW, which willread IMWPC.CFG and load the pro-gram from IMWPC.HEX if you havean ImageWise/PC with RAM pro-gram memory. When it releases thereset you will see a test pattern on J3and camera video on J4. The board isnow running in internal sync modewith overlays disabled.

There are two groups of timinginformation you may need to change:internal and external. Internal syncvalues (on the left side of the SyncGeneration block in Figure 2) controlthe signals when the ImageWise/PCis producing internally generatedsync. External sync values (on theright side) control the signals whenthe ImageWise/PC is genlocked toan external video source.

If your camera produces standardNTSC sync, you can use the defaultIMWPC.CFG because it specifiesNTSC sync timings for the externalsource as well. Most modem camerasproduce standard sync signals be-cause all of the timings are derivedusing an NTSC sync chip; that’s asperfect as you can get in the world of

consumer electronics.I supply several CFG files to cover

someof themorecommoncases. Takea look to see what’s available; we mayhave covered your situation already.After you copy the appropriate file toIMWPC.CFG, you are on the air.

With the correct images on themonitors and the camera in focus, runSETIMPWC. It willread IMWPC.CFG,reload the registers with the defaults(again), and present you with a dis-play similar to Figure 2.

The legend under FS should readUnLock, indicating that the outputsync on J3 is not locked to the incom-ing sync on Jl . Press F8 to start genlock-ing; if the timings are correct and all issuccessful, the legend will change toLocked. If the ImageWise/PC firm-ware can’t lock to the signal it will re-turn an error which will appear as amessage on the bottom line.

If your camera timings are merelyclose to the values in one of theIMWPC.CFG files, the firmware maythink it is locked up but actually be offby a few lines. You will see the cam-era’s vertical sync pulse roll throughthe image coming from J3. The cure isto adjust the number of visible lines inthe External column until the rollingstops. Remember to press F3 aftereach change to write the new values

42 C//XX/T CfL!AR INK

Page 38: Circuit.cellar.008.Apr May.1989

into the registers; press F8 to lock andunlock with the new values.

As a last resort you may need toget an oscilloscope and actually countthe pulses during the vertical syncintervals. If the camera sync is par-titularly nonstandard, you should alsomeasure the pulse widths. There maybe some cameras that we can’t handle,but so far we’ve been doing prettywell.

When you have everything JustRight, press F2 to create a newIMWPC.CFG. This will overwrite theold file, so make sure you have a copystashed somewhere safe.

A Good Image

Press F9 to grab an image; makesure there is no file name in the ImageFile block so that the program doesn’tcreate a disk file yet. The image on J3should match the live video shown onJ4 when you pressed the key. If youwere not in genlock mode (F8 saidUnLock) before grabbing the image,the signal on J3 probably jumped a bitas the firmware locked to the incom-

ing video. You can avoid that twitchby tapping F8 until its legend readsLocked before F9.

Now press F4 to start continuousacquisition. The firmware capturesthe, first field of each frame; you willsee the results as they are digitized.Remember that the PC code is nottransferring the data out of the videobuffer so there is no problem digitiz-ing in real time even on slow PCs. Thismode is handy for focusing yourcamera if you have only one monitoron J4.

If the White and Black settings inthe Analog block are not matched toyour camera, you will see washed-outhighlights or flat black areas in thepicture. With the firmware in con-tinuous acquisition mode (F4 saysCant) you can change these values tomatch your camera. Black settingsbelow a certain point (about 50-80)will have no effect because they arebelow the black level of the picture.Similarly, some cameras producewhite levels above the 255 setting;those cameras are well out of spec!

Once those levels are set, press F2

again to write a new configuration filewith the new values.

Now you’re ready for overlays.Press F9 to grab an image (this willalso turn off continuous mode), thenpress F6 to overlay the analog imageatop the digital image. At any pointwhere the analog voltage level ex-ceeds the Overlay voltage, the digitalimage will show through. You mayhave to adjust the Overlay value in theAnalog block to get a suitable level.Try waving your hand in front of thecameraand watch what happens; withOverlay set correctly thedigital imagewill show through your hand.

TV stations use a similar methodto produce weather maps, althoughthey use a particular blue color ratherthan just brightness. With the Image-Wise/PC, you can use a whiteboardas a window into a digital image anddisplay your own weather maps. Justlike the real TV stations, too, the back-ground will peck through any otherareasin thcimage with theright inten-sities!

Press F6 again to overlay digitalatop theanalog. Now thedigitalimage

.

R&D ELECTRONIC SURPLUS, INC.Has been in business since 1946 selling NEWsurplus electronics and electromechanical parts.

Call for our FREE 40 page catalogue detailing:Batteries LEDsCables LugsCapacitors MOVsClocks Ni-CadsConnectors Power DevicesDigital Timer/Controllers many Power SuppliesDiodes RelaysDisplays SemiConductors galoreEnclosures Stepper Motors 8 Driver KSFans SpeakersFiCers Many SwitchesHeat-Shrinkable tubing Telephones and componentsHeatsinks TransformersIntegrated Circuits , ZenersLamps 8. Lights etc.

Telephone: (216) 621-1121 l Fax: (216) 621-6628

87C51 PROGRAMMER $125.Logical Systems brings you support for the Intel 87C51.The UPA87C51 programs this popular microcontroller ongeneral purpose programmers that support the 2732A. Withthe UPA87C51bits and the 87E

ou can program the 8751 and 87C51 security51 encryption array. Logical Systems, help-

lng you get the most out of your programming equipmentNith our growing line of adapters. OEM inquiries welcome.

4DAPTERJPA8751JPA87C51

PROGRAMS PRICEC8751,8751H, AMD8753H, 8744 $95.00C8751.8751H AMD8753H, 874487651,87C51 !=A

125.00

JPA63701V Hitachi HD63701VO 65.00JPA451N Signetics SC87C451 (64 pin DIP) 125.00

JPA63701X Hitachi HD63701XO (64-L Low insertion force socke p

in shrink dip)95.00

-2 Textool ZIF socket 149.00

JPA63701Y Hitachi HD63701YO (64 pin shrink dip)-L Low insertion force socket 95.00-Z Text001 ZIF swket 149.00

JPA63705V Hitachi HD63’;OWO 65.00CALL (315) 478-0722 or FAX (315) 475-8480

LOGICAL SYSTEMS CORPORATIONP.O. Box 6184. Syracuse NY 13217-6184 USA, TU( 6715617 LOGS

lrcle No. 127 on Reader Service CardApril/May I989 43

Circle No. 137 on Reader Service Card

Page 39: Circuit.cellar.008.Apr May.1989

MORE GOOD CODE...FAST!

Loftaid’s In-Circuit Emulators giveou all the power and speed youeed to develop microprocessorbased products in realtime,Icreasing your productivity andaving you time and money.

Emulators available for:i4180, 280, Z180, 808818086,10188/80186, 8085, v4o/v50

Priced from $595 to $2995

FULL SCREENDEBUGGING!

Vith the optional source levellebugger, you get a real time, fullcreen debugging environmentdith pop-up windows and symboliclisplays. Your source code and:omments are displayed in adindow that is automatically linked3 the debugging session. Thisnakes embedded systemlebugging FAST and EASY!

TIMELY TECHNICALSUPPORT!

Iur technical staff is ready tonswer your questions. Give us aall to discuss your microprocessorlevelopment needs!

Iomplete information is also,vailable on our BBS from 5 p.m. toI a.m. EST -- 301-964-8456.

l-1

8930 ROUTE 108COLUMBIA, MD 21045

(301) 964-8455(800) 433-8812

Circle No. 140 on the Reader Service Card

will show through wherever it ex-ceeds the Overlay setting, so as youwave your hand it will disappearbehind the brighter parts of the digitalimage. You will probably have toadjust Overlay until you find a suit-able level. This mode is useful fordigital titles and graphic overlays,although you must keep the Image-Wise resolution in mind when youdesign your layouts.

Press F6 un Gl the label reads Cam-era again; this disables the overlaysand restores the camera image to J4.

Picture Files

Type a file name into the ImageFile block. If you have a big RAM diskyou can save the files there; otherwiseuse a hard disk. Each image file usesfrom 30K to 80K bytes of disk space,depending on the file format and pic-ture content.

The code can handle four differ-ent file formats, determined by the fileextension and number of gray levels.PCX or PCC files (as in PIClVRE.PCX)are stored in the 256- or 1 g-gray-scaleformatusedbyZSoftPublisher’sPaint-brush and PC Paintbrush. IMW files(as in PICTURE.IMW) will be storedin the serial ImageWise format if youselect 64 gray levels. All other files arestored in 256-gray-level binary.

Pressing F9 or F10 when you havea file name filled in will save or showthat file. Saving the same scene in avariety of different formats will showyou the effect of 16,64, and 256 graylevels on the image quality when youshow the files in quick succession.The new 2%level files should winhands down!

On Your Own

After our journey through the Im-ageWise/PC from design principlesto software you should have a goodidea how to put the thing to use. Now,what can you do with an inexpensivegray-scale digitizer? 0

IRS2 13 Very Useful214 Moderately Useful215 Not Useful

DON’T FORGETThe deadline forCircuit Cellar INKDesign Contestentries is May 1,1989. Please getyour submissions into us suon.

COLOR IMAGEWISE

ZIP Software now allows both theoriginal serial DTOl and ImageWise/PC to digitize and display full-colorpictures on an IBM PC with VGA.Using three colored filters (red, green.& blue), ZIP digitizes three sequentialpictures and combines them into onefull-color composite PCX-format pic-ture which can be displayed on VGAor used in a variety of paint and pub-lishing programs.

ZIP Image Processing Software$79.00

The following is available from:ccl

4 Park StreetVernon, CT 06066

For information and orders:Tel: (203) 8752751Fax: (203) 872-2204

Item 1: ImageWiselPC PC board experimenter’s kit.Comes with 4-layer PC board, and assorted keycomponents including 27C256 EPROM; TML 1852D/A; AD7226 D/A; CA331 8 A/D; RCA jacks: ferritebeads; user’s manual; and ImageWiseN utilities onIBM PC format diskette.

Order IWPC-EXP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $399.00

Item 2: ZIP image processing software for Image-WiseK from Hogware.

Order IWPC-ZIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $79.00

A procurement list for all ImageWiselPC boardcomponents is posted on the Circuit Cellar BBS. Fullkits are not currently available. ImageWisePC isavailable assembled and tested.

All payments should be made in U.S. dollars bycheck, money order, or Mastercard and Visa. Shipping and handling: surface delivery add $6.50 forU.S. Call for Canada and air freight delivery else-where.

Page 40: Circuit.cellar.008.Apr May.1989

FROM THE BENCHCreating a Network-basedEmbedded Controllerby Jeff Bachiochi

The activity level of readers re-sponding to the DDT51 articleoverwhelmed many of us in-

volved with that project. For many,the DDT-51 would be an even moreinterestingprojectiftheyhadan8031-based system to use it on.

The primary reason for the suc-cess of DDT-51 is that it puts kilobuckdevelopment-tool potential into thehands of experimenters and consult-antsforlessthan$lOO. Unfortunately,once you’ve whetted a person’s ap-petitewithlow-costdevelopment,thenext immediate need is cost-effectiveend-use implementation.

The majority of 8031 and 8052controller boards are designed asgeneral-purpose controllers withexternal-board expandable I/O. Thisis not a new revelation, just an obser-vation. If you want an ADC, you addan ADC board. Want more parallelI/O? Then add a parallel I/O board.

The benefit of this architecture isthat such a system can be expandedin many directions to incorporatemassive amounts of I/O. Where thesystem fails, however, is that the fea-tures which offer easy expandabilityand on-board software developmentin large configurations are usuallyunnecessary in minimum-configura-tion, minimum-control applications.Often, we don’t need the48 I/O linesafforded through an expansion I/Ocard but only two or perhaps threeinputs. Similarly, we may not needmicrosecond-speed, infinite-accuracyanalog conversions but only a simple8-bit ADC for temperature measure-ments. What’s needed is a plain-brown-wrapper 8031/8052 control-ler that is optimized for these mini-

RTC3 1

RTCIO

RTC-Proto

mal-configuration applications.This month I am presenting a

new, lower-cost 803x/805x systemwhich meets these criteria. I’ve in-cluded features that will let you usethis design for one-shot prototypingor for serious applications. This newReal-Time Controller, designated theRTC31 (8031 processor) or RTC52(80C52-BASIC processor), is de-signed to be small and cost effective.

The RTC system measures only3.5 inches square and uses vertical-stacking connectors for I/O expan-sion. The RTC processor boardcontains the processor, EPROM andRAM memory, address decodingand buffering, parallel I/O withscrew terminals, and an RS-232/RS-485 serial port.

So far, we have designed twostackable expansion boards. First,the RTCIO board (which I consider apackaging achievement), containsthree parallel TIL I/O ports; an 8-channel, 8-bit A/D converter; a 4-channel, 8-bit D/A converter; a bat-tery-backed real-time clock; and aDC-to-DC converter which allowscomplete 5-volt-only system opera-tion. The second, the RTC-Protoboard, is just that-a prototypingboard. It permits the user to add hisor her own special I/O circuits.

A stacked-board arrangementhas certain benefits besides elimi-nating costly gold-contactbackplanes (motherboards). It al-lows configuration of either a basicsystem for experimentation or anexpanded system for black-box ap-plications, yet still retains its lowprofile. Eachverticallystackedboardonlyincreasestheheightby5/8inch.

Page 41: Circuit.cellar.008.Apr May.1989

Additional cost can be saved by populating only the I/Onecessary for the application.

The RTC Processor Board

The RTC31 processor board, outlined in Figures laand lb, has a no-frills architecture designed to meet basicsystem requirements. Like any 8031-based system, itneeds at least a processor, a low-address latch, and mem-ory*

The8031 microcontroller has the ability to address twoindependent 64K regions: data space (read/write mem-ory) and code space (read-only memory). These spacescan be addressed separately or overlaid for a combined“anything goes” space. To accommodate any program-ming eventuality, the entire 64K address space of the 8031is addressable on the RTC31 and two memory sockets areprovided to handle either 8K or 32K RAMS or EPROMs(62(X/62256 RAMS or 2764/27256 EPROMs).

A chip select (*CS) decoder would normally requiretwo ICs, one for decoding minimum address blocks (BK;2764/62644) and another for the “ORing” of 8K blockswhen using larger devices (32K; 27256/62256). A small bitof flexibility is traded here to reduce this to one chip(Figure la). An open-collector decoder allows 8K blocks to

be “ORed” by wiring them directly together. These “wire-ORed” chip selects save space but require that memoriessharing any address block, as in a separated data/codespace, be of the same memory size.

Serial communication is also provided on the RTC31processorboard. Full-duplexRS-232communication with+5-volt-only operation is provided by a MAX232 levelconverter. In addition, half-duplex multidrop RS485communication, which opens exciting new applicationpossibilities by network-connecting embedded control-lers, is also included. Using a multicontroller communica-tion network, the user can move task processing from acentral area to the source. Adding this potential is assimple as the addition of a single B-pin m-485 bus-driverchip (plus a little networking software).

The rest of the board logic consists of a bus driver forthe multiplexed address/data bus and a “glue” chip for“ORing” some control lines. The bus driver would not benecessary if we limited the system to this single processorboard with no further expansion (the ADO-7 port on theprocessor can drive up to four TTL loads; only three areused). Instead, the buffered address/data bus is directedthrough two vertical-stacking connectors which facilitateboth electronic expansion and mechanical support (moreabout this in a bit). Two additional connectors are in-

R E S E T C I R C U I T

A D D R E S S B U S

Figure I a- Ine NIL-J //zprovvlaes t/ex/f)le aaaressspace decoding plus r?S-.?Z/l?S-485and direct connection to the DOT-5 7 debugging tool.

G L U E’1.............................: DDT-51 C O N N E C T I O N

SERIFlL I / O; ._____ _ _____.______._____............................. _ ..__________._______........:

serial communication

April/May 7 989 47

Page 42: Circuit.cellar.008.Apr May.1989

eluded to directly connect the RTC31 to a DDT-51. To-gether, they serve to create the ideal controller development environment.

Finally, no basic controller configuration would becomplete without some parallel I/O. Eight bits from port1 and four bits from port 4 of the processor are brought outto screw terminal blocks for user I/O. These 12 TTL I/Obits are sufficient for most simple controller applications,making additional hardware unnecessary.

The total chip count for the RTC31/RTC52 design isnine chips. Cramming these, plus the associated connec-tors and discretes, onto a 3.5-inch-square board was noeasy task; we had to use fine-line (8-mill PC-board technol-ogy to fit everything. The end result, which draws only 80mA at 5 volts (without the RS485 driver) is destined to beused in many upcoming embedded controller projectsaround here. Stay tuned.

System Expansion with the RTCIO

For those who need a little bit of everything, the stack-ing RTCIO board, shown schematically in Figure 2, pro-vides a powerful assortment of I/O including parallelTTL, ADC, DAC, and real-time clock.

An 8K block of data memory space (at EOOOH) isallocated for all the I/O functions in an RTC system. It isdecoded into two jumper-selectable groups of four ad-dresses, called “upper” and “lower.” Within each group,

the addresses are designated as CSO, CSl, CS2, and CS3.CSO is used for parallel I/O; CSl is used for the ADC; CS2is used for the DAC; and CS3 is used by the real-time clock.Since each RTCIO board requires only four of these ad-dresses for its functions, two RTCIO boards can be stackedon the RTC processor board if required.

The 24 bits of parallel I/O are provided by an 8255 PPI.The chip is connected to external devices through a 26-position square-pin header. The PPI has four port registerswhich are memory-mapped to addresses EOOOH-E003H(if using the low address group). The PPI is initialized bywriting to register 4, the mode port. The value written tothe port configures the first three registers as input oroutput. Register 1 (port A) and register 2 (port B) are 8-bitbidirectional ports, each configured as either 8 bits in or 8bits out. Register 3 (port C) can be similarly used or splitinto control-line support. Once the configuration hasbeenset in the mode register, these ports can be written to orread from directly.

Eight channels of 8-bit A/D conversion are providedthrough anADC0808 ADC chip. The eight external inputs,which can be in a range from 0 to 5 volts, are brought to theA/Dconverter through screw-terminal blocks on the edgeof the board. The conversion speed of the ADC0808 isabout 9000 conversions per second (about 110 microsec-onds per conversion).

The ADC0808 is memory-mapped at the default ad-dresses ElOOH-E107I-I (channels O-7). A dummy write to

8031 ForthComplete Development Environment

. Bryte’s development environment uses BRYTE-FORTH on the actual production hardwareduring product development. No emulators, nochanges, no surprises.

l Optional PC-based cross-development tools useDOS files as microcontroller mass storage. Thesefiles can be used to generate compact EPROMimages, detailed listings, and cross-references.

BRYTE-FORTH 8031 EPROM(includes 130 page User’s Manual)

Utility disk(s)Cross-compiler/Cross-assembler8031 unlimited quan. license

$100.00

$65.00 *$235.00 *

$1000.00 *

* Includes complete source code

Call Today3207-547-3218

P.O. Box 46 l Augusta, ME 04330-0046Circle No. 108 on Reader Service Card

Cmto Professional Quality Circuit Diaarams with

d ova SW Ektrkal and-Elecbonb symt& forprdesixal quality circuitd&rams on Me Mac.

Symbols are in bdh PICTfumat fc# MxDraw,MadHI, or ctte~ CAD/Draw programs and inM&raw II libraks.

h&hem&ksymbolsarede@nedtosnapbgrid s2 their externalconnedDmiall M gripcintsandline3mnr&bsymt&%flthedM.

Indudes symbo!s from

l Anahg-ponentsl Gak/DiiilalDevii* lndustrbl Wiring- Ladder Diirams

IAll Mats

Circle No. 141 on Reader Service Card48 C//XX/T CEL/AR INK

Page 43: Circuit.cellar.008.Apr May.1989

ElOOH will start a conversion of channel 0 (INO). The EOC(end of conversion) signal is inverted by Q2 and availableon JP25. Either INTO or INTl may be selected to providea hardware EOC as opposed to doing a software delayloop to predict EOC. Reading the same address after EOCoccurs will grab the 8-bit conversion value from theADC0808. The resolution of the converter is about 20millivolts with a Vref of 5 volts. If you’re using 8OC52-BASIC with this ADC, a line of BASIC takes longer toexecute than a single conversion time, so waiting for EOCis not necessary!

An AD7226 furnishes four channels of D/A conver-sion, with each output ranging from 0 to 5 volts (set by thevoltage reference). Screw terminals along the edge of thePC board provide easy connection to the outside world.Full-scale-change settling time is 4 microseconds maxi-mum. The memory-mapped default addresses of theD/A converter are E200H-E203H. Writing an 8-bit valueto E2OOH will set the output for channel 0 (VoufA). The 8-bit resolution of the AD7226 is about 20 millivolts using aVn$of 5 volts. Reference voltages for both the ADC andthe DAC are supplied by an LM336Z-5, a 5.0-volt precisionreference diode. All the I/O on this board runs on 5 voltsexcept Vrefand the DAC. The DAC requires +11.4 to +16.5volts for Vddandanegativebiason Vss. Thesevoltagescan

come from an external power supply or can be generatedon-board by the MAX633 DC-to-DC converter. [Editor’sNote: For more information on how these converters function,see “Switching Power Supplies” beginning on page 10.1

An OK1 M6242B provides a real-time clock/calendar(on-board battery backup). Control of the clock/calendaris performed through sixteen registers at the default ad-dresses E3OOH-E30FH. Eachdigit of the seconds,minutes,hour, month, day, year, and day of week can be individu-ally read from or written to the chip as a BCD nibble.

In addition, three registers indicate various status con-ditions. Reading and writing the registers may be donewith or without regard for whether the chip is busy. Ifbusy is disregarded, double reads should be done and thevalues compared to ensure correct information.

If system power is lost, falling lines may cause arandom *CS on the clock/calendar chip since it is battery-backed. To prevent this from occurring, the program-mable I/cc-low leveldetectionoutput line from the MAX633is connected as a clock chip enable. An out-of-toleranceVcc (during power up or power down) deselects the clock,preventing erroneous data from being written into theclock registers.

The eight chips on the RTCIO board combine to makea powerful I/O combination. Partial population of the

HEtlORY EPROH/RflH

/UERTIC~IL STflCKING E X P A N S I O N 8US

. .._.....-.-..-.._-.....-..................~....~..........-..........-...........~ __..__________.___._..............................................’

Figure 1 b- Eifher 8K or 32K RAM and EPROM may be used on fhe RTC3 l/52. Screw terminals and verfical-stacking connectors make expansion easy and compact.

Aprii/May 1989 49

Page 44: Circuit.cellar.008.Apr May.1989

I/O board makes it a cost-effective approach to system ex-pansion. Need more?

For those of you who ask, “What about the.. .,“ a proto-typing board, with an array of holes on O.lOO-inch centers,makes it a snap to add a custom circuit to the microcon-troller engine. In addition to a bank of 12 screw terminalblocks, a 26-pin header layout is provided for bringingcontrol signals onto or off of the proto board.

Minimum System + Flexible Design = Minimum Cost

Summing it all up, the RTC31 & RTC52 are indeed apowerful combination. The stacking design allowsa mini-mum system to be flexible yet inexpensive for both thedeveloper and the end user. The degree of expansion iscontrollable, yielding a lower total cost, yet system expan-sion adds increments of only 5/8 inch to the total height.Five-volt+nly operation is maintained by on-board DC-to-DC converters, and RS-485 provides multidrop com-munication over a twisted-pair cable. (The ability tonetwork microcontrollers might not be a big advantage toyou now, but I think you will see it develop briskly in thenear future, especially here in the pages of Circuit CellarINK.) Finally, the RTC system connects directly to theDDT-51 and provides a low-cost platform for using it. 0

IRS2 16Very Useful2 17 Moderately Useful2 18 Not Useful

BUS

CONTROL BUS

OIGITFlL TO ANALOG

SOURCES

633Maxim Integrated Products, Inc.120 San Gabrial DriveSunnyvale, CA 94086(408) 737-7600

OKI Semiconductor650 North Mary AvenueSunnyvale, CA 94086(408) 720-1900

Analog DevicesOne T&hnology WayP.O. Box 9106Norwood, MA 02062-9106(6 17) 329-4700

AD=@08National Semiconductor Corp.2900 Semiconductor DriveSanta Clara, CA 95051(408) 72 l -5ooO

Maxim integrated Products, Inc.

&as Semiconductor4350 Bellwood Pkwy SouthDallas, TX 75244-3219(2 14) 450-0400

8031 I51 80631/51Intel Corporation3065 Bowers AvenueSanta Clara, CA 95051

Mobtra Harris Semiconductor2840-100 San Tomas EXDW.Santa Clara, CA 95051’ ’(408) 986-9ooO

S&etics Corporation811 E. Arques AvenueP.O. Box 3409Sunnyvale, CA 94088-3409(408) 99 l-2000

80C57-BASICMicromint, Inc.4 Park StreetVernon, CT 06066(203) 871-6170

Miller CoilJ.W. Miller DivisionBell Industries19070 Reyes AvenueRanch0 Dominquez, CA90221(2 13) 537-5200

ANALOG TO DIGITAL

-

, .Figure 2a-The RTCIO I/O board provides such useful functions as 24-bit TTL parallel I/O; 8-channel, g-bitanalog-to-digital conversion; and Qchannel, 8-bit digifal-to-analog conversion.

50 ClRCUlT CELLAR INK

P

Page 45: Circuit.cellar.008.Apr May.1989

31,148 ‘N4’48 CONVERTER~~--~~__._.._____......-.~.....~...__......._____________________________,

mDC/DC CONVERTER

~IDDRESS DECODER. ..______.........._______..____.._____._______._____.

/ I

Figure 2b-Additional features of the RJClO board include a battery-backed real-time clock and a DC-to-DC converter.

25 26 INTERRUPTS

\ I DATA BUS

IL \i \

VERTICF1L STACKING EXPfiNSION BUS f3DDRESS BUS

The following is available from: CCI l 4 Park Street, Suite 12 l Vernon, CT 06066For information and orders: Tel: (203) 875-2751 l Fax: (203) 872-2204

RTC31 boardRTC31 8031 microcontroller board experimenter’s kit. Includes PC board, 8031microprocessor, MAX232, sockets, all ICs except RAM and EPROM, piggybackexpansion board headers, manual, and detailed parts list. Screw terminals optional.Order RTC31 K-l $89.00

FIT&term (screw terminals) Add $8.00

RTC52 boardRTC52 8052 microconlroller board experimenter’s kit. Same as RTC31 except aMicromint CMOS 8OC52-BASIC microprocessor is supplied instead of the 8031.8OC52-BASIC chip can be jumper-selected to also function as 8OC31/8oC32.Order RTC52K-1 $89.00

RTC-term (screw terminals) Add $8.00Intel BASIC-52 Programmer’s manual $15.00

RTC-PROTO BoardRTC-system prototyping board. Includes PC board, piggyback expansion boardsockets, and eight 2-position screw terminal blocks.

Order RTC-Proto $39.00

RTCIO boardRTCIO Expansion board parallel 110 and AID kit. Includes PC board; parallel port PPI;&channel. 8-bil A/D chip; related board-mounted components; and piggyback expan-sion board sockets. Screw terminals optional.Order RTCIOK-1 $79.00

RTC-term (screw terminals) Add $8.00

RTCIO Board Options:OPTION#l: Hardware Real-TimeClockcomponents forRTCl0 board. Includes I.46242clock chip, crystal, Lithium battery, battery holder, and related components.

Order RTCIO clock upgrade #I Add $30.00

OpTION #2: D/A components for RTCIO board. Includes AD7226 4-channel D/A chipand related components.

Order RTCIO D/A upgrade #2 Add $35.00

OPTION P3: 5-volt-only operation DC-to-DC converter components for RTCIO board.lndudes MAX633, inductors, and related components.

Order RTCID DC-to-DC upgrade #3 Add $19.00

The RTC31, RTC52, and RTCIO boards are also available assembled andtested and In volume OEM quantities. Call for price and delivery.

All payments should be made in U.S. dollars by check, money order,$7 for U.S. Call for Canada and air freight delivery elsewhere.

MasterCard, or Visa. Shipping and handling: surface delivery add $3 for U.S.; Pnd-day delivery add

April/May 1989 51

Page 46: Circuit.cellar.008.Apr May.1989

HD647Embedded

by Tom Cantrell

180X-A New 8-Bit MicrocontrollerConfrollers Get Respect

M aybe it’s wishful thinking,but it seems as though theinfatuation with 32-bit mi-

cros and “workstations” is fading.Sure, there is plenty of sizzle, butwhere’s the beef? Clearly, the hypelevel far exceeds that justified by themarket size.

Enter embedded controllers. Theexact definition of an “embedded con-troller” is a little hard to pin down. It’sone of those things you can’t easilyde-fine, but you know one when you seeit. INKreaders,beingheavilyinvolvedin real-world applications, know whatI mean.

The immediate predecessor of theHD647180X, the HD64180 (also of-feredbyZilogastheZ64180andZ180),is a highly integrated Z80-compatibleCPU. Included on the chip are theCPU core, system support logic, and anumber of I/O devices.

what really sets the HD64180 apartfrom other 8-bit CPUs is the additionof a bank-select-type MMU (MemoryManagement Unit) which expandsmemory addressing beyond the 64kilobyte barrier to 1 megabyte.

TheHD64180alsointegratesthosesystem “glue” functions required inmost designs (wait state generation,DRAM refresh, and interrupt control)to reduce chip count and improveperformance.

Whatever an embedded control-ler is, the chip manufacturers are start-ing to realize (it’s suprising they everforgot) that a design win in a car,phone, or consumer product is muchmore lucrativethan one in thelatest “Personal-SuperMicro-Mainframe,”glamorous as thelatter may be.

Though the HD64180 CPU coredesign is quite different from theZ80-the HD64180 is microcoded-it faith-fully executes the Z80 instruction set.From theprogrammer’spoint of view,theonlydifferenceisthattheHD64180has a few extra instructions (notablyincluding MuLTiply) and many of theinstructions execute in fewer clockcycles. Another byproduct of microc-oding is that the HD64180 can trap“bad” opcodes typically caused by

Sales forecasts for microcontrollers (worldwide)(Millions of dollars)

F o u r - b i tcontroller chipscontinue to hangin there, and 16-bit controllersare being an-

19884-bit $944.78-bit $1,576.316-bit $15.0Total $2,536.0

Finally, the HD64180 includes acomplement of I/O functions: twochannels each of UART, timer, andDMA as well as a single-channelclocked serial I/O port. Compared toolder 8-bit controllers, the number andfunctionality of the HD6418O’s I/Odevices are much improved.

The HD64180 is built using aCMOS (Compli-mentary Metal-Oxide Semicon-ductor) processand includes anumber of low-power modeswhich allowprogrammabletradeoffs offunctionalityand power con-sumption. Low

1989 1990 1991 1992 1993$991.4 $979.0 $1,081.3 $1,174.6 $1,181.8

$1,654.4 $1,626.0 $1,911.0 $2,219.6 $2,267.8$17.9 $30.0 $58.1 $125.6 $219.1

$2,663.7 $2,635.0 $3,050.3 $3,519.8 $3,668.6

Source: Dataquest, Inc.

Figure 1 -Sales forecastsshow that

nounced. But for now, and the fore- the 8-bitmicrocontrollermarket will

seeable future, 8-bit controller chips be strong for years to come. power is not just an issue for battery-

lead the pack (Figure I).powered designs. It affects cost (small

The traditional 8-bit workhorsespower supply, no fan, plastic IC pack-

are the Intel 8048 and 8051, Motorolasoftware errors or an electrical glitch. age)and reliability (especially in harshNeedless to say, critical control appli- environments).

6801 and 68HCl1, and Zilog Z8. Let’stake a look at a new 8-bit contender,

cations such as those involving heavy The CMOS process cuts power

the Hitachi HD647180X.equipment or life-support products consumption dramatically. Considercannot be allowed to run wild! But that a ~-MHZ HD64180 consumes just

CPU Roots

52 ClRCUlT CELLAR INK

4

Page 47: Circuit.cellar.008.Apr May.1989

30 mA maximum (15 mA typical)under full-speed operation. By con-trast, the NMOS ZSO, without any ofthe HD64180 on-chip I/O, consumesmore than six times as much power(200 mA max>.

At one time, CMOS was a dirtyword implying slow performance andnonstandard I/O levels. Today, anyserious contender in the controllermarket must offer a high-performance,low-power CMOS process.

‘X’ Marks The Spot

The new “X” version moves theoriginalHD64180designsquarelyintothe g-bit controller fray. Three keyadditions are on-chip EPROM andRAM, parallel I/O lines, and analoginput capability (Figure 2).

On-chip Memory

Memory technology marches onand to paraphrase political wisdom,“A K here and a K there-pretty soonyou’re talking real memory.” TheHD647180X includes 16K bytes ofEPROMand512bytesofRAM-twiceas much memory as older chips andmore than enough for typical &bitapplications.

A unique feature of theHD647180X is the use of EPROM; amasked-ROM version isn’t even of-fered. The concept, known as “ZTAT”(Zero Turn Around Time) or “OTP”(One-Time Programming) combinesthe field programmability of EPROMwith the low cost of a nonwindowplastic package. This makes sensewhen you realize that EPROM-baseddevices allow production floor firm-ware fixes/upgrades and eliminateROM mask charges and inventory ex-posure. For lab and developmentwork, which actually requires erasa-bility, a windowed version of theHD647180X is offered.

Programming the HD647180XEPROM is simple. Timing and volt-age levels are the same as those of astandard 27256. All you need is asocket adapter which connects the pinsof the 27256 programmer socket to theHD647180X (Figure 3). Those wish-ing to secure their intellectual prop-

3

PORTB G-7

I 8\r I I I I

4 I I I I I r---ii\J

BUS STATE CONTRO L INTERRUPT

CPU

PORTD G-7PORTE G-3

PORTG ‘d-5

I-

ANALGG -PORTA 3 - 5

COMPARATORD A T A BUS 8 B I T S

(6Cti) -

1ADDRESS B”S 16 B,TS

Figure 2- The HD647 780X is similar to the HD64 180 with the addition oion-board RAM, EPROM, and analog comparator

L

0 MPo

MPI

1 RES/Vpp

PFo-

PF7

Data00-07

EXTAL

I

Figure 3-A simple adapterplus an EPROMprogrammercapable ofpro-gramming 27256s are all that are needed to program the HD647 780X.

April/May I 989 53

P

Page 48: Circuit.cellar.008.Apr May.1989

DROE GED ESIGN R OBOT FORTHEORIGINBTION OFEXFICTING GRAPHIC

MULTI-LEVEL SYMBOL CM\ICEPT.M E M O R Y LRYOUT AeOVE IS ASYMBOL WOE FROM TWO CHIPSYMBOLS WITH FIOOEO BUS WIREECHIP SYMBOLS FlRE MFlOE FROMMULTIPLE PFy3 SYMBOLS.

BQSIC ClO.OO POSTPFIIO:C6FI 3 COLORS 12 LFIYERS6’4 BY 6Y I N C H WORKSPFlCERNY GRID TO 0.001 INCHRUNS ON RNY PC COMPRTIBLE15 LINE WIDTHSDOT MRTRIX OUTPUT200KB OOCUMENTRTICN ON

TWO DISKS16 WORK FIREFIG WVEFWLESTITCH BETWEEN LRYERSZOOM QND PFlN TO FlNY SCALE

FIOVANCEO 66100.00 POSTPFIIO:FlBOVE FEQTURESE6R RESOLUTION 15 COLORSLFIRGE R JOBSMOUSEROVFINCEO E D I T I N GPRINTE 0 MFlNUFlL

5 4 ClRCUlT CfLLA? INK

MODE 0(Single Chip)

PORT A (8 bits)

PORT B ” ”

PORT C ” ”

PORT D ” ”

Parallel oron-chip I/O lines

Parallel I/O

Parallel I/O

Parallel I/O

PORTE ” ” Parallel I/O

PORTF ” ” Parallel I/O

PORT G (6 bits) Analog or parallel input

MODE 2(Exvanded)

<same>

CPU control lines

AO-A7

A8-A15 orparallel I/O

CPU control linesand A16-A19 or

parallel I/O

DO-D7

<same>

Figure 4-The HDtM7 180X’s many modes allow the designer to matchthe features of the chip to the application.

erty will be pleased to note that theHD647180X has protection modes toprevent the contents of the EPROMfrom being read. To get your code,potentialpirates will have togetdownand dirty and probe the die itself.

Parallel I/O

The HD647180X operates in oneof four modes, selected by the levelson two external pins at reset. EPROMprogramming mode (mode 31 is self-explanatory. Mode 0 is single-chipmode while modes 1 and 2 are ex-panded modes (Figure 4).

In mode 0, most of the chip’s pins(and there are a lot-the HD647180Xis packaged in 80-pin flat pack or 84-pinPLCC)areconfiguredasI/Olines.A total of 54 I/O lines are provided,organized as six 8-bit ports and a six-bit port. Generally, the ports are pro-grammable at the bit level as parallelinputoroutput, though therearesomerestrictions. Port G is input only whileport A is programmable (at the bitlevel) as either parallel I/O or UARTand DMAC lines. If the 16K EPROM,512bytesRAM,and54I/Olinesaren’tenough for your application, you canuse one of the expanded modes.

Mode 1 replaces most of the I/Olines with a complete address (20-bit)and data (8-bit) bus, as well as anumber of bus status and control lines.

Furthermore, the on-chip EPROM isdisabled. In essence, a mode 1HD647180X is quite similar to a stan-dard HD64180 with the addition ofthe on-chip RAM and a few I/O lines.

Mode 2 is more likely to find usein actual applications. It is kind of acrossbetweenmode 1 (fully expanded)and mode 0 (single-chip) in that theon-chip EPROM remains enabled butan external bus (for connection toadditional memory and peripheralICs) is provided as well. A neat fea-ture is that 12 of the I/O pins can beprogrammed individually to serve aseither upper address lines (A8-A191or parallel I/O. Many applicationsthat only need a small external ad-dress space (to add an I/O chip ortwo) can take advantage of this.

Analog Comparator

Real-world applications oftenneed to process analog signals. To thisend, the HD647180X includes a six-channel analog comparator whichworks as follows:

Six lines (Port G) act as inputs tothe comparator. Any of the six linescan be programmed to serve as eithera reference voltage (Vref) or a com-pared voltage Win) (naturally, thesame line shouldn’t be selected forbothfunctions). Thecomparatorfunc-tion simply sets a result bit indicating

J

Page 49: Circuit.cellar.008.Apr May.1989

which voltage (Vref or Vin) is higher.Though not intended to replace a

high-resolution A/D chip, the abilityto switch reference and input chan-nels leads to some interesting possi-bilities. For instance, five of the inputscould be “hardwired” to differentreference voltages with whichan inputvoltage could be compared. Eachcomparison takes only thirteen clocks,or about 2 its with the CPU running at6 MHz, so even a brute force approachof five sequential comparisons couldapproach a lOOk/second samplingrate. Similarly, a DAC (with outputvoltage selected by HD647180X out-put lines) could serve as a program-mable reference for comparison withfive different voltage inputs.

Bottom line

Whether theHD647180X fills yourbill depends on how well its featureset maps to your requirements. It isideal for midrange performance ap-plications that need single-chip formfactor (with low-cost field program-mability), lots of on-chip memory andI/O,low power consumption, and280software compatibility. On the otherhand, some of the HD647180X “largesystem” features-such as the MMUand DRAM refresh controller-maybe misplaced in a chip that is best usedin a “single-chip” mode.

Price and Availability

T h e loo-piece price for theHD647180X is $23.30 for the ZTAT/One-Time Program version in PLCCpackage and $94.00 for the windowedLCC package version. For literatureor parts, contact your local Hitachirepresentative or distributor or:

Hitachi America, Ltd.Semiconductor & IC Division2000 Sierra Point ParkwayBrisbane, CA 94005-1819(415) 589-8300 0

IRS2 19 Very Useful220 Moderately Useful221 Not Useful

inally!!!

The Circuit CellarSB180 Single-Board

Computer Kit

Since the time it was intro-duced on the cover of the Sep-tember ‘85 issue of BYTE, theSB180 has established itself asoneof the most reliable and cost-

effective single-board &bit computer sys-tems on the market. Incorporating up to 256K RAM, an

8K EPROM monitor, a floppy disk controller, two serial ports, and aparallel printer port, the SB180 has a remarkable list of features for its small 4” x75”size. An optional SCSI interface adapter easily expands the SB180 to includea hard disk.

Using the Z80codecompatible Z180/HD64180 super chip, the SB180 runsthe thousands of 280/8080/8085 programs faster and more efficiently than everbefore. Up to three times as fast as a ~-MHZ 280, the g-MHz SB180 can be usedas a stand-alone controller, or as a complete development system runningCP/M 2.2, CP/M Plus, Z-System, MP/M II, TurboDOS, or Oasis operatingsystems.

The SBI 80 comes with a plug-and-go 24command high-performance ROMmonitor which exercises and tests all its basic functions. For real computingperformance, we have an extensive software collection including the Z-Systemenhanced disk operating system. Considerably more advanced than CP/M, Z-System offers users utility programs and DOSfeaturesthat have only recently be-come common to 18bii PC users.

Through a special licensing arrangement, Circuit Cellar is now able to offera complete g-MHz SB180 kit (less DRAM) for the remarkable price of $195. Justadd a bank of 64Kor 256K DRAMS and you are instantly on the air. The optionalZ-System O/S software has also been redesigned with computer experimentersin mind. Theoperatingsystem checks available memory, apportioning it betweenTPA and RAM disk, and looks for the SCSI hard disk as well. Adding a 32-Mbytehard disk is as easy as plugging on the SCSI adapter to what you already haverunning-no merging or recompiling software. Complete source code for theBIOS and ROM monitor are also included. Plug and go!Features:.9.216-MHz Z18O/HD64180 CPU - Floppy controller (l-4 drives, 3.5” or~64K or 256K bytes RAM supported 5.25”, single/double density, single/double- 8K monitor and boot ROM sided, 40/80 tracks)- Measures 4” x 7.5 . One Centronics parallel printer portwith mounting holes - Two RS-232C serial ports (75-19200 bps)

, SB18oK-1: 9.216-MHz SB180 single-board computer kit. Includes all compo-nents except DRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $195.00

SB180K-l-20:Same as above with Z-System hardAloppydiskoperating system;BIOS and ROM sources) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .$295.00

COMM18OK-S: SCSI hard disk adapter board for SB180 . . . . . . . . . . . . . . . . . . . . . . $89.00

Available from: CC1 .4 Park St. l Vernon, CT 06066For information and orders: (203) 875-2751 l Fax: (203) 872-2204All payments should be made in U.S. dollars by check or money order. MasterCard, or Visa. Shipping and handling:surface delivery add $3 for U.S.; Pndday delivery add $7 for U.S. Call for Canada and air freight delivery elsewhere.

Me No. 110 on Reader Service CardApril/May 1989 55

Page 50: Circuit.cellar.008.Apr May.1989

FIRMWARE FURNACEThe True Secrets of Workingwith LCDsby Ed Nisley

M any controller applicationsneed a better display thanyou can get with LEDs, but

don’t have nearly enough informa-tion to justify a CRT. For example,while your new temperature control-ler should show both the setpoint andthe actual temperature, it doesn’t needfull color graphics to get the messageacross.

Even when you have a CRT, anauxiliary display can come in handy.Suppose your PC application moni-tors a set of switches. Would a smalldisplay near the switches make themeasier to use? Or could it providestatus or debugging information thatdoesn’t fit on the CRT?

Photos 1 through 3 show three liq-uid crystal displays. The first is a 16-character display that costs all of $10from TimeLine. I bought the 2x20display (along with a bunch of others)several years ago from a commercialsupplier; you can buy a similar unitfrom Digi-Key for about $32 (singlequantity).

This month’s column covers thecare and feeding of small alphanu-meric liquid crystal displays. I’ll illus-trate the important points by puttingtogether the hardware and softwarerequired to run an LCD from the par-allel port of an IBM PC. To make iteasy for you to evaluate new units, thecode this time around is in MicrosoftC for the IBM PC; all you need is aprinter port, some wire, and a powersupply toget useful results. Of course,this being the real world, my codewon’t work with every LCD made,but it will work with those that useone of the most common methods ofinterfacing to the outside world.

Lots of Dots

You maybe familiar with the work re-quired to drive a liquid crystal displaypanel. There are all manner of timingrestrictions, problems with DC bias,connections to a glass sheet, and so on.All in all, it’s not a trivial exercise.

Fortunately for us, technology hasadvanced to the point where all of theugly details required to drive an LCDpanel are hidden inside an LSI chip.Thedisplaysshowninthephotos(andmany others on the market) use theHitachi HD44780 LCDcontroller, witha few supporting driver chips in largerdisplays. That means the units allshare a common interface to the out-side world.

The HD44780 is adaptable to manydifferent display layouts. Unfortu-nately, the data sheets are not particu-larly helpful when it comes to explain-ing the details. Before learning how to

use these displays you must knowhow they work!

There are two basic types of liquidcrystal displays: segmented displaysand dot matrix displays. The LCDwatch on your wrist uses shaped seg-ments, which are easily visible as theseparate bars making up each digitand the glyphs marking AM/PM,ALARM, and so forth. Your new laserprinter (or your friend’s new laserprinter) uses a dot matrix LCD toprovide status information.

Shaped segment LCDs have a sepa-rateconnectionbetweeneachsegmentand the controller IC. This is feasiblefor a few digits, but a watch display-ing the date, day of week, and timerequires 75 active segments. Squeez-ing all those connections onto theperiphery of the display poses a con-siderablechallenge,asdoesgettingallthe wires into the controller IC, solarger displays are correspondingly

1 I

n n n n n n ~mmm n n n n n n n n n n n n n n nn mwmm n mm~m n n n n n n ~mmm n n n n nn mmma n n n n n n n n n n n n n n n n n n n nn mmmm n ~m~rn n n n n n n n n n n n n n n nn n n n n n n n n n n n n n n n n n n n n n n n nn n n n n n n n n n n n n n n n n n n n n n n n nn n n n n n n n n n n n n n n n n n n n BDD~~n n n n n n n n n n n mmm8 n n n n n mmmmm

-mmmmm n n n n n n n n n n n n n n n n mmm8 mmmmm mmmmm8

-rnrnDDrn n =mmm n n n n n n n n n n n n n n n n n n n n n mmmm-~~mmm n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n

: -mmmmm n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n-mmmmm n n n n n n n n n n n n n n n n ~mmm n n n n n n mmmm-~rn~mm n n n n n n m~mm n mmm~ n n n n n n mwmm n n n n n-mmmmm n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n

n mmmm n n n n n n n n n n n n n n n n n n n n n ~mmm n n n n n

1111 llllI llllI llllIIIIIl llllI IIII

Lt

4a sqment SignPlr

I t

Figure la-The Ho44780 requires just 56 connections to the LCD tocon fro/ 7 280 dots.

56 C//?CU/T CELLAR INK

1

i

Page 51: Circuit.cellar.008.Apr May.1989

Photo 1

Photo 3

more expensive.Dot matrix LCDs divide the visible

area into horizontal rows and verticalcolumns. The intersection of each rowand column forms a dot which can beturned on or off by sending the properwaveformsalongeachconductor. Thecontrolling IC activates one row at atime and turns on selected dots as

5x8 cells. A pair of control bits deter-mines the cell size and the number ofcell lines.

The 5x11 character cells occupy theupper rows of the array and the lowerfive rows are disabled. There are twochoices for 5x8 cells: a single line acrossthe upper eight rows or two lines us-ing all sixteen rows. The hardware

on fire, but the HD44780 cannot drivemore than 1280 dots by itself. Figure2 shows how an auxiliary HD44100driver chip provides 80 additional dotcolumns with either one or two char-acter lines. The HD44780 passes thecolumn data to the HD44100 over asingle wire using a common clocksignal, so the connection is almost triv-

needed to construct the image. The doesn’t allow you to select two lines of ial.displays can bemade quitelarge becausetheconnectionsto each dot areshared amongthe whole ar-ray.

A singleHD44780 con-troller canhandle a dis-play with 16rows and 80columns. Fig-ure la showstheconnectionsto such a dis-play; a little fig-uring indicates L

d

that 1280 dots Figure 1 b-Portions shaded in dark gray show the I-line display layour, Ine shows the Dis-

addition of another line results in a 2-line display, shown in light gray. play RAM ad-require only 56 dresses for

F o u rHD44100sstrung to-gether after anHD44780 dis-play up to twolines of 40char-acters. The 80bytes of Dis-play RAM setsan absolutelimitonthedis-play size, so ifyou seea largerLCD module,itwon’t have anHD44780 incharge.

Figure 3

connections. The regular array pat-tern also simplifies the task of gettingthe conductors off the display andinto the IC.

The HD44780 is designed to pro-duce characters, so it divides the dotarray into groups of cells. A singlecharacter is five columns wide andmay be either seven or ten rows tall,with an additional row used for anunderscore cursor. The 1280 dots canthus hold eight 5x11 cells or sixteen

5x11 character cells; that choice isforced to two rows of 5x8 cells.

The HD44780 has an 80-byte Dis-play RAM to hold the character codes.Figures lb shows how the addressesin that RAM match up with the LCDarray character cells. The second lineof a two-line LCD starts at address 40hex, a fact which causes a great deal ofconfusion for new users!

A display with two lines of eightcharactersdoesn’texactlysettheworld

some common LCD uni ts. Figure 3a isparticularly interesting because itmaps the two lines produced by anunassisted HD44780 into what lookslike a one-line, 16-character display.Much to the novice’s surprise, theeighth character on the display isn’tadjacent to the seventh character inDisplay RAM! The Hitachi manualhas a special section explaining this,urn, feature in the Troubleshootingsection.

April/May I989 57

Page 52: Circuit.cellar.008.Apr May.1989

In a similar fashion, Figure 3dshows a 4x20 LCD. Writing data se-quentially into Display RAM startingat address 0 fills the first, third, sec-ond, and fourth rows in that order.Take careful note of the separation be-tween the last address in the third rowand the first address in the second:those Display RAM addresses are notimplemented.

If the display has fewer than 80characters, you can store informationin the “off-screen” addresses. Small8031 applications, with only 128 bytesof on-chip RAM, may be able to makegood use of that additional memory.Do, however, refer to Figure 3 to makesure you know which addresses areused in the display. In the interest ofsimplicity, the interface in this articledoesn’t allow reads from the chip.

The HD44780 includes a charactergenerator ROM that translates char-acter codes into the appropriate dotpatterns for the display. The codesbetween 20 and 7F hex become theusual ASCII glyphs (with a few oddi-ties thrown in), while the codes above80 hex are a mixture of Greek, Japa-nese, English, and mathematicalsymbols.

The character generator has a RAMsection for the eight characters be-tween 00 and OF hex; space precludesdiscussing this feature here, but thetest program will show you how tocreate your own characters.

For the rest of this article, I will con-centrate on LCDs with one or tworows of 5x8 characters because thoseare the sizes most suitable for smallcontroller projects. The task of modi-fying the code supplied with this ar-ticle is left as a project for the inter-ested reader with an oddball displayin hand.

Interfaces Between.. .

The HD44780 reduces the task ofusing a liquid crystal display into thatof building a component into yoursystem. As with any component, youmust consider four different interfaces:mechanical, electronic, timing, andprogramming. Because we are con-sidering the entire display as a singlecomponent,eachaspectdeservessome

58 C//?CU/T CELLAR INK

Figure 2-A single-wire connection to an HD44 100 is all that’s requiredto add another 80 dot columns to the HD44780’s control realm.

a) Hitachi LMO2OL or Optrex DMC 16 117

b) Hitachi H2750

nnnnnnnnnnnnc) Hitachi LMO32L or Optrex DMC202 15

d) Hitachi LMWL

013

053

021

067

Figure 3-LCD displays are available in countless shapes and &es.

Page 53: Circuit.cellar.008.Apr May.1989

comment.The mechanical interface consists

of four mounting holes in locationsthat vary across manufacturers. Thedimensions tend to be “hard metric”rather than English, so you may needa metric ruler.. .or perhaps just biggerholes in the front panel. You mustavoid flexing the LCD, but l/4” stand-offs solve that problem. The 14 edgepadsareon 2.5~mm (well, actuallyO.l-inch) centers, but a ten-conductor rib-bon cable covers all the absolutelyessential connections with flex to spare.

setting depends on the number ofactive display rows (8, 11, or 16), am-bient temperature, viewing angle, andthe phase of the moon. For room tem-perature applications, connecting theterminal to ground works just fine.Figure 4 shows how to connect a con-trast trimpot if you really want one.Note that the data sheets specify thevoltage as the difference between Vccand Vee, so +4.5 volts is actually 0.5volts above ground witha +5 volt supP’Y.

The electrical interface is equallysimple. The boards require +5 volts atbarely a few milliamps. Although theHD44780 is a CMOS chip, all signallines can use TTL levels. You shouldavoid very long wires,although I havedriven the displays through a 15-footprinter cable with no troubles. If youare trying for a world record distanceyou should use cable with interleavedgrounds to prevent glitches on thecontrol lines.

Wiring an LCD board to a proces-sor is more interesting. Because theHD44880 uses &bit characters, youmight expect that it needs eight datalines. Many embedded controller sys-tems use lowend micros with a 4-bitdata path, so the Hitachi designersprovided the ability to transfer eightbits of data in two nibbles of four bitseach. Thefirstpartof theinitializationsequencedeterminestheinterfacesize,which cannot be changed after thatpoint.

The voltage on the Vee terminal Although the Hitachi manual de-sets the display contrast. The correct scribes how to connect the display di-

rectly to the processor bus, theHD44780 can’t handle the blazingspeeds used in contemporary CPUs(oreventhelowly8031). In4-bit mode,it needs only six lines, so you can driveit from a single parallel port. That portcan be an LS374, one byte of an 8255, afew bits from an 8031, or whateveryou happen to have lying around.

The HD44780 cannot accept infor-mation in a steady torrent. Each dataor command transfer causes the chipto become busy for a short time; atransfer made while it is busy mayresult in aberrant behavior. Althoughthere is a way to read the busy statusflag from the chip, a programmeddelay works quite well. The C soft-ware in this column has enough delaythat there is no need for specific delayloops.

I’ve taken the easy way out withthe interface in this column; if youhave a parallel printer port on yourPC you can experiment with thesedisplays. If whatever you’ve got isn’tan IBM PC, but it does have a parallelport, you can probably shuffle thecode

t11-1111111111111~

, Hobbyists, experimenters, R & D groups! II

i 8031 @ontroller Module i

I I

1 our 8031 PContmller Module forms the core of a complete

Iprototype and saves hours of tedious hand-wiring.

:

I we include a prototype quality printed circuit board popu- 1

lated with an 8031 microprocessor, 11.059 MHz crystal,I 74LS373 Address Latch, capacitors, communications and I

I II0 headers and a 2764 EPROM with diagnostic software. IThe module also contains a socket for a MAX232 level con-

I verter to pmvide an industry accepted serial communica-I

Itions port if your pmject requires it. I

The Developer’s Manual provided, describes the moduleI and provides an introduction to programming the 8031.

I

I I

I Send $39.95 p2u.v $3.00 S&H per moduleI

I Illinois Residents Aa!d 6.25% Sales Tax II I-.

;Cottage Resources I

ISuite 3-672,1405 Stevenson Drive I'

ISpringfield, Illinois 62703

(217) 529-7679I

~11111-1111111111 J

STOCKS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .OPTIONS I...................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FUTURES

Turn your PC into aMARKET QUOTATION MONITOR

Vew book covers complete information on financial newsmd market quotes for your PC from satellite and FM radio.ropics include:

- Data Encryption- Password Methods- Receiver Unit Design

Covers quotation processing and data broadcasting fromthe trading floor to the desktop, $19 plus $2 S/H (includesdemo diskette).

Send for FREE catalog of- DATA RECEIVER KITS- QUOTE DISPLAY SOWARE- DESCRAMBLING UTILITIES

CALL - (303) 223-2120 (anytime)

DATArx111 E. Drake Rd., Suite 7041

Fort Collins, CO 80525

April/May 1989 59

P

Page 54: Circuit.cellar.008.Apr May.1989

around to work with your system.Fair enough?

Figure 4 shows the Centronics andIBM PC printer port connections. Allof the strobes and controls are gener-ated in software, so there are no criti-cal bus timings. Getting the timingscorrect is, of course, a simple matter offirmware.

If you use a female Centronics con-nector for this project you can plug thedisplay directly into the printer cable.This is handy if you don’t want togrub around in the back of your PC,because Centronics connectors usesnap fasteners that don’t have to beunscrewed. Try to avoid the tempta-tion to print something to the display,though, because it just won’t work.

It is worth mentioning that thereare no standards for IBM PC printercable ground connections. The Cen-tronics schematic uses both pins 16and 19 because two of my printercables route pin 19 on the PC end toeither of those pins. You must verifythat your cable and port cooperate toget at least one ground wire to theLCD board. The display will not workwith a missing ground!

The photos show what’s involvedin this project. The power supply isone of those bricks you’ve seen adver-tised in the surpluscatalogs ever sincethe Coleco Adam computer wentdown the tube. It provides -5 and +12volts as well as +5 volts, but thosearen’t needed here. I put some tapeonthe back of the LCD to keep the usualconductive litter on my bench fromshorting out the LSI chips. You mightwant to attach a backplate like the oneshown on the 2x20 display in Photo 3.

Passing the Word

Figure 5 presents the relevant sec-tions of the HD44780 instruction set.The instructions to read the busy statusbit, Display RAM address, and Dis-play RAM data are omitted becausetheinterfaceusedin thisarticledoesn’tpermit reads. If you are designing aproject requiring data readback, youshould consult the Hitachi manualsfor details on the exact timing require-ments.

Notice how theinstructionsaredis-

C E N T R O N I C S P R I N T E R C O N N E C T O R

VERIFY GROUND CONNECTIONSI I I

IBtl P C P R I N T E R C O N N E C T O R

1

UERIFY GROUND CONNECTIONS T

CENTRONIC PORT GROUNDS:

PINS 16 . 17 . 19-38. 3 3

ucc

:

O P T I O N A L

3.3KCONTRAST

CONTROL

LESS2K -TO UEE PIN

MORE

IBM PC PORT GROUNDS:

PINS 1 8 - 2 5

Figure 4- A Centronics printer port makes a convenient interface to theLCD module for experimentation purposes.

Rs=Il

00000001 Clear display, set cursor to address 00000001* Set cursor to address 00000011s Set cursor move direction and display shit

1 - 0 = no shift, 1= shift display after write0 = decrement, 1 = incrrement after data write

OOOOlDCB

0 = no cursor, 1= cursor active0 = display blank, 1 = display visible

ooolSR** Cursor movementI- 0 = move left, I= move ri*t

0 = cursor movement, I= display shift

OOlDNF**&z%?F!$n;5x10 dot font

0 = 4-bit interface, 1= 8-bit interface

I OlAAAAAA Set Char Gen address- A = address value

I 1AAAAAAA Set Display RAM address- A = address value

L

Write data to Display or CC RAM

Figure 5-The HD4478O’s instruction set includes everything necessaryto initialize the display, move the cursor, and display characters.

I

Page 55: Circuit.cellar.008.Apr May.1989

‘, -:’ :

4” ” ,= _ * 4,

p I=aRstarr+s+ StwE , /.. ,,.. 2:. .“J.

f stmct (“_ _ z ,

/* b+ kapQt igsigned int data:4; /* data_ n#@e

unsigned int RS:l; /* Fe&star *elect;unsigned int E:l;

/* -a$lbie .- : .-*/.i * ; i _ z _- x r

f . . ( i - i _” *

fat f;bt

*r/*/

s,plJrss */void LCDout(PORTDATA pcxtval) {

/* *//* Send a byte to the display RAM *//* RS must be set active */

*J*rF

zz%WWm2* fJ

listing 1 - Code to send u single nibble and a full byte to the LCD displuy.

tinguished by the first nonzero bit.Although I don’t know the internaldetails of the HD4478O’s architecture,I suspect it is built around a shift reg-ister and state machine that can de-code bit positions with no extra effort.

The RS bit distinguishes betweeninstructions that control the HD44780and data destined for the Display orCharacter Generator RAM. All in-structions must be written into thechip with RS=O, while the data usesRS=l.

62 C//?CW CELLAR INK

r

Because the interface in Figure 4uses only four bits, the instructionsmust be transferred in two nibbles offour bits each. The most-significantnibble is written first, followed by theleast-significant four bits.

Each nibble is written into theHD44780 by transitions on the EN-ABLE line. To meet the data setupandhold timing requirements, the data ispresented with Enable=O, thenENABLE is brought high and low. Inour case, these transitions are made in

software, so the actual timings aremuch slower than the specifications,but (fortunately!) there are no maxi-mum timing restrictions.

The LCDout routine in Listing 1shows the steps needed to write asingle nibble. Because all of the dataand control lines wind up in the sameprinter port byte, the PORTDATA un-ion allows reference to either the indi-vidual bits or the whole byte. Pascalprogrammers will be familiar withunions, although the standard textswould have you believe that they areunreservedly A Bad Thing.

LCDchar accepts a byte (knownasan unsigned char incjargon),cracks it in half, and calls LCDout tosend the two nibbles. There obviouslyisn’t a lot of computation involved inthis process, so the pulse lengths andseparations are largely determined bythe C calling conventions.

A single call to LCDchar pro-duces two ENABLE pulses. Ona20-MHz I’S/2 Model 80 with moder-ate C compiler optimizations, eachpulse is 7 microseconds wide and theleading edges are 30 microsecondsapart.

Even with these relaxed timingsthere is no problem updating the dis-play. Listing 2 shows LCDstring,which copies a string into the DisplayRAM using calls to LCDchar. It turnsout that LCDstring writes bytesevery 190 microseconds, so 8 millisec-onds suffice for a 40-character dis-Play*

Your actual mileage may vary de-pending on processor speed and codeoptimizations. On a stock 4.77-MHzRC,forexample, LCDchar'sWOpUkSare 53 microseconds long and sepa-rated by about 260 microseconds.LCDstringcanwriteabyteevery1.6milliseconds, so it takes fully 64 ms for40 characters.

That may sound like an awfullylong time, but the optical responsetime of the liquid crystal material isover 100 ms at ordinary room tem-

perature. Even a stock PC can updatethe display before the syrup knowswhat hit it! The HD44780 changes thedisplay without interference so thereis no “snow” during rapid updates.

Incidentally, those timings are one

Page 56: Circuit.cellar.008.Apr May.1989

reason all the code is in C. Had I castit in assembler it would need allmanner of checks enforcing the mini-mum time between characters. As itis, you can tinker with the code toimprove things quite a bit; start by re-moving all the WaitSec (0 -0) calls.When you’re done you won’t be ableto see the difference!

If you use these LCDs in 8031 proj-ects you must pay particular attentionto the minimum delays. Make sureyou take data sheet in hand beforewriting the code.

Getting Started

Al though the HD44780 resets itselfafter the power comes on, the defaultvalues are usually not what you want.It selects an &bit interface and dis-ables the display, exactly what wedon’t need for this application. TheHitachi manual details what you mustdo to reset the chip. What they don’temphasize is that you cannot play fastand loose with the initialization se-quence.

The LCDinit routine inListingshows the required setup procedure.The timings listed are minimums, sothe large C code delays are quite ac-ceptable. In fact, one way to pin downinitialization problems is to single stepthrough the code until you find theinstructionthatdidn’tgetenoughtime.

The first three steps may seem sillyfor our application because they re-peatedly set an 8-bit interface withfour wires. Remember that the chipmay be in an unknown state, with aninstruction already in progress whenthe first byte is written. After threewrites separated by the appropriatedelays, the chip is in a known stateand ready to receive the remainingsetup codes.

The choices concerning the inter-face length, number of display lines,and character font size cannot bechanged without going through thewhole reset sequence again. Theremainingstepsmaynotbequite whatyou want but they must occur in thespecified order. Follow the instruc-tions in the listing and your displayshould start up successfully.

If all else fails, you will need a copy

44 C//?CU/T CELLAR INK

r

- ,-.. -“I*/

+ae awtig &arts Q$ whetier */*/

skdxag em&s in the usual \O character... *//* If$s%sg thamobafaote~=generator, zemember that this *//* routine won’t send out-a binary zero because that's the */If 't@. “I

“4“I

listing 2-Code to send a string to the LCD display.

The last column indicates the default values.

Firmware Furnace LCD Test Driver

Syntax is LCDTEST <switches>where the switches are:-c:x cursor selection (0 - 3) 0-f:x font selection (7 or 10) 7-1:xx characters in logical row 64-p:x printer port ID 1-r:x number of logical rows 1

To use LCDTEST with a two-line display connected toLPT2, type in:

LCDTEST -p:2 -r:2

Figure 6- LCDTEST supports several command-line parameters thatcover the more common LCD displays.

of the Hitachi documentation and ascope to make sure you are not violat-ing the timing specs.

Random Displays

Ifyouarebuildingcommercialproj-ects, you can obtain LCD units fromyour distributor. For those of youwho want to try out this stuff withoutgoing through minimum orderhassles, start paying attention to yoursurplus catalogs, and advertisementsfrom distributors like TimeLine, Digi-Key, Jameco, and JDR. Small LCDunits are showing up in laser printers

and the like, so the production vol-umes ensure lots of interesting sur-plus.

The 16-character display in Photo 1was advertised by TimeLine late lastyear. They had a few hundred at $5each in lots of five units; I bought tenon the off chance they might come inhandy. Good planning, huh?

I have seen liquid crystal displaysadvertised in other catalogs over theyears, but their availability is subjectto all the usual vagaries of the surplusbusiness. If you are interested in thissort of thing, drop by the Circuit Cel-lar BBS for up-to-the-minute informa-

Page 57: Circuit.cellar.008.Apr May.1989

CIRCUIT CELLAR INK’S

ADVERTISER’S INDEXReaderServiceNumber Advertiser

PageNumber

101 2500 AD Software102 AlSl Research ;:103 Alpha Products 7l Associated Comp.

104 AVOCET ;:

105 B&B Eledronics106 Berry Computers 1:t Best Associates 71107 Binary Technologies 32108 Bryie Computers 48109 Cabbage Cases 24110 Circuit Cellar111 Circuit Cellar zt Collins Associates112 Cottage Resources 5:113 Covox, Inc. 8114 DATArxt David Baker Assoc. ;;117 Environmental Optics 54

118Express Circuits

119 Galacticomm ;120 Grammar Engine 8121 GTEK, Inc. 16122123

Hazelwood Computer 63High Resolution Tech 45

124 Hogware 38125 lnnotec 66126 Intro1 Corp.

115/116t [iFr yz;systems zr,

127 Logical Systems ;;128 LT.% Corp. 27

129 Micro Resources130 Micromint :131 Micromint 33132 Micromint133 Ming Eng. ;:134 NOHAU Corp.135 PseudoCode z;136 Quinn-Curtis 14

137 R&D Electronics138 Schnedler Systems ::

139 Skunk Creek140 Softaid ::141 Thinking Tools 48142 Timeline* Tinney 2”9143 x-10 9

IRSINK Rating Service-low useful is this article?

At the end of each article andsome features there are three 3-3igit numbers by which you can,ate the article or feature.

‘lease take the time to let us, atCircuit Cellar INK, know how youfeel our material rates with you.Just circle the numbers on theattached card.

tion on what’s hot. [Editor’s Note:Forinformation on connecting with the Cir-cuit Cellar BBS,seepage 70. For informa-tion on how to order Circuit Cellar BBSOn Disk, see page 70.1

Because you may not have muchchoice as to number of rows or charac-ters, the LCDTEST program is adapt-able to nearly any display based onthe HD44780. Often you won’t knowwhich controller is on the back of theboard until you get it, but the Hitachiunit is fairly common.

Display Exercises

~~~~~STdemonstratesvariousas-pects of the HD44780. While it’s not acomplete diagnostic tool, if your newLCD works correctly for all of thetests, you canbepretty sure that you’vegot a live HD447BO (or a clone!) driv-ing it. If not, well, you did get the datasheets, right?

LCDTEST has several command-line parameters that cover the morecommon LCDs. You can’t blow out adisplay by incorrect programming, sosome judicious experimentation willhelp you understand how theHD44780 does its magic. Wiring thepower connections backwards is an-other matter, of course.. .

LCDTEST initializes the LCD cir-cuitry, then writes all character codesfrom 0 through 255 into the DisplayRAM. It will continue to do this untilyou tap the space bar, so you canwatch the display fill up and deter-mine the starting addresses for eachrow. The first few characters will begibberish because the character gen-erator RAM hasn’t been loaded yet, sodon’t get worried right away.

The next step tests the ability to setthe Display RAM load address. Sev-eral character strings appear at vari-ous places on the display; you shouldcheck to make sure that they are cor-rect.

Although I glossed over theHD44780’s character generator,LCDTEST loads eight graphics char-acters and illustrates how to displaythem. It also changes the CG RAM onthe fly, a trick that can produce a lim-ited form of animation.

The final demonstration displays

the real time (according to your PC’sclock) and a loop counter. The updaterateislimitedbyyourPC’sprocessingspeed, but you will see that it exceedsthe LCD’s ability to keep up. Even ona stock PC, the lower two digits areillegible!

Off The Bottom

TheselittleLCDdisplaysaresome-what like peanuts: once you’ve usedone, you just can’t stop. As long asyou have a microcontroller in yourproject already, it makes a lot of senseto use a classy display instead of (or inaddition to) those chintzy LEDs. 0

IRS222 Very Useful223 Moderately Useful224 Not Useful

ISSUe #%-Remote Video Sutveillance l ROVER:IRemotely Operated Video-Based ElectronicReconnaissance l Home Satellite Weather Center:

IFocus on the MC68000 Peripheral Controller l IO-IMHz/O-bit Digitizing Board for the IBM PC l PrecisionIPulses: Carrier Current Transmission TimingIIssue #&Data Acquisition

b ROVER: The Software l Home Satellite WeatherICenter Adding Serial and Parallel Ports to theIPeripheral Controller l Build a Remote Analog DataILogger l ImageWise/PCThe Digitizing Continues lI3DT-51 RevealedIISSUe #;l--Computing in Real Time1 ImageWise/PC:The Hardware l Build a Remotei4nalog Data Logger l Home Satellite Weather Cen-1 er -Finishing the Firmware for the Peripheral Proc-%sor l Writing a Real Time Operating System

CCINK’s 1st Year ReprintsOur fast rise in circulation has resulted in a virtualsellout of the first year of INK. So as not todisappoint any of our readers, we are offering aB&W offset reprint of CCINK’s first year (Issuesl-6). Availablefor$20,00inthe U.S. and$24.00to Canada and Europe (shipping 8 handlingincluded).Send check or money order to:

Circuit Cellar INK1st Year Reprint

P.O. Box 772Vernon, CT 06066

Via orMasterCard accepted, call (203) 875-2199

AVAILABLE BACK ISSUES

Send $4.00 per issue (includes S&H) in check ormoney order to: Circuit Cellar INK, P.O. Box 772,Vernon, CTO6066. Visa and Mastercard accepted,call (263) 875.2199.

April/May 1989 65

Page 58: Circuit.cellar.008.Apr May.1989

Introducing

the ID320

PORTDATA pbits;unsigned char cmddata;

/* No matter how silly, the following values are REQUIRED. Do*//* NOT change the sequence of bytes going to the display. */

Logic Analyzer Cardfor the IBM PC/XT/AT

itate of the art design bringa‘ou high-end performance atow-end price

peatures:

pbits.i = 0;pbits.b.data = 0x03;ICDout(pbits);WaitSec(O.1);LCDout(pbits);WaitSec(O.1);LCDout(pbits);WaitSec(0.1);

/* 8-bit interface (honest!)*//* set 8-bit intf *//* min 4.1 ms delay *//* set a-bit intf again "1/* min 100 us delay *//* set 8-bit intf again *//* min 1.6 ms delay "1

l 32 channels 2K deepl 25 MHz state analysis

50 MHz timing analysisl Variable Threshold

Input Podsl Single Slot Designl Multi-level triggeringl Selective Data Capture0 Software Performance

Analysisl Disassemblers for

popular 8/16 bitmicroprocessors

l Test DevelopmentLanguage supportsATE applicatrons

l Friendly User Interfacel And much more

pbits.b.data = 0x02;LCDout(pbits);WaitSec(O.0);

/* now set 4-bit interface */

/* minimum delay */

/*- after this point you have a little flexibility *//*Use ONLY the alternatives described in the comments *//*Do NOT omit any bytes from the sequence going to the display*/

cmddata = 0x20;if (NumRows - 2) {

cmddata I- 0x08;

/* 4 bit interface again */

/* set two lines */

if (FontSel - 10) {cmddata I= 0x04; /* set 5x10 font */

ICDcmd(cmddata);WaitSec(O.0);

/* tell the display *//* minimum delay */

LcDcmd(OxO8);WaitSec(O.0);

/*display off,no cursor,no blink*//* minimum delay */

from $1395Satisfaction Guaranteed or

your money back

ICDcmd(OxO1);WaitSec(0.1);

1" clear display *//* min 4.9 ms delay */

IcDcmd(Ox06);

WaitSec(0.0);

/* 06=inc cursor, no shift/* 04=dec cursor, no shift/* O'l=inc cursor, shift/* 05=dec cursor, shift/* minimum delay

*/*/*/*/*/

INNOTEC I*- You may now send whatever you want to the display. You */

DESIGN INC. I* CANNOT change the interface width or the char font size. */

.4640 Firestone Blvd., Ste. CLa Mirada, CA 90638

Tel: 714-521-5454

ICDdisplay(l,CursorSel); /* turn on disp & select cursor */return:

/* _---_-----------____--- --*//* Initialize the LCD board *//* The timings are minimums, which we exceed by a gross margin*//* if you are porting this to assembly language, you MUST *//* delay correctly. If not mentioned, the minimum timing is *//* 120 j.ks between bytes. This code sets up a I-bit interface.*/

void LCDinit(void) {

Circle No. 125 on Reader Service Card listing 3-Initialization sequence

f

Page 59: Circuit.cellar.008.Apr May.1989

THE CIRCUIT CELLAR BBS300/ 1200/2400 bps

24 hours/7 days a week(203) 87 1-1988 - 4 incoming lines

Vernon, Connecticut

Conducted by Ken Davidson

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

Most bulletin board systems rely heavily on localcallers to make up a large portion of their user base. Andthat’s fine for an amateur BBS that caters to having thelatest video game or utility available in the files area, or todiscussions of whether the local high school football teamwill beat their arch-rival. But when a BBS such as theCircuit Cellar BBS specializes in one particular area, ittends to attract a much wider audience extending beyondstate lines and, in some cases, country borders.

Msg#: 9649From: RICHARD ANDREWS To: TIM EMERSON

Right from the start, the Circuit Cellar BBS hasattracted a geographically widespread audience. Themajority of our callers are located outside OUY local callingarea and, for that matter, outside the state (and in a statethe size of Connecticut, that’s not hard to do!).

If you can use a dot-matrix-type display, 1 may have an idea foryou. The Staver Co. Inc. makes displays that are electromechani-cal and static. They have a disc which is black on one side andyellow, or whatever, on the other side. The unit has two coils;energizing the coils one way turns the black side out; energizingthem another way turns the other side out. One nice feature isthat the displays are static, so once set, power can be removedfrom the coils and t-he disc will stay put. I have seen this type ofdisplay used for time/temperature displays on banks, etc. Theirnumber is 516/666-8000.

I’ve been keeping track of where some of our interna-tional callers are calling from, and the list is fascinating.Over the past year or two, we’ve had callers from MexicoCity, Mexico; Verona, Italy; Vienna, Austria; Kingston,Jamaica; Moelln, West Germany; Helsinki, Finland;Bangkok, Thailand; Hong Kong; Sao Paula, Brazil; Haifa,Israel; Florida, Argentina; Riyadh, Saudi Arabia; and thelist goes on. We have quite a few callers who routinely callfrom Australia. In fact, in just one 24-hour period re-cently, we had calls from Stockholm, Sweden; Sydney,Australia;Malmoe, Sweden; Paris, France;and Maebashi,Japan.

Msg#: 9651From: JIM NELSON To: TIM EMERSON

So the next time you get your phone bill and cry overhow long you spent on-line, think of some of your fellowcallers ringing from outside the U.S. and imagine whatsome of their phone bills must be like!

The 1988/89 EEM carries some catalog pages for the Staver Com-pany’s Signalex displays. See volume B, pages 1093-1097. Theyhave 7x5 dot-matrix alphanumeric modules which vary in sizefrom 4” wide by 6” high through 13” wide by 18” high. The dotdisplay elements are also available individually. They are staticelectromechanical affairs, and are controlled by a pair of 12V to18VDC pulses. One pulse sets a dot t-o the fluorescent color, andthe other pulse resets the dot to the background color. The pulsewidths necessary vary from 1 ms at 18 VDC to 2 ms at 12 VDC.The required current for 12VDC pulses is about 700 mA.

We’ve all seen large computer-generated displays insporting arenas and outside banks. This first discussioncenters around building one such large display.

No controller is provided; characters or graphics must be built bypulsing the individual dots, which are addressed in an X-Ymatrix, on and off. This is a nasty problem, but is straightforwardto handle with the right mix of experience and microcontrol andinterface tools.

AEG makes some large composite LCD displays. Why do youthink these are better for your application than the equallymonochromatic electromechanical system I mentioned earlier?

Msg#: 9648From: TIM EMERSON To: ALL USERS MsgX: 9802

From: TIM EMERSON To: JIM NELSON1 have a requirement for a large-screen display (4 ft x 6 ft) todisplay status information in a factory. The ideal solution wouldbe an LCD unit, but 1 have had no luck in finding one larger thana laptop PC screen. Projection displays are too bulky and providea lot more resolution than 1 need to display simple text. Any ideaswhere 1 can look?

Actually, I’m not sure that the LCD display is going to be the bestway to go. 1 really need to get all the data before 1 decide. Whois AEG and how can 1 get hold of them? Thanks for your reply.1 have found out more through this BBS in a few days than 1 havethrough normal channels in weeks.

CONNECTIME Excerpts from the Circuit Cellar BBS

April/May I989 67

Page 60: Circuit.cellar.008.Apr May.1989

Msg#: 9868From: JIM NELSON To: TIM EMERSON

Telefunken Electronics, AEG Corporation, P.O. Box 3800, Route22, Orr Drive, Somerville, NJ 08876-1269,201/231-8300.

By the way, here’s an oft-used rule of thumb for estimating clearviewing distance as a function of character size: Under the bestconditions, and with normal eyesight, viewing distance = char-acter height (in inches) * 50 feet; usually, character height iscalculated as 1 inch per 25 feet.

The most-flexible LCD technology is a new product called NCAPfilm. Great-looking displays may be combined with membraneswitches. Thin flexible plastic is first coated with conductiveindium tin oxide, then coated with a thin uniform layer of anemulsion of tiny liquid-crystal capsules. This is laminated to asecond indium-tin-oxide-coated plastic sheet which has beenphotochemically etched to leave conductive areas correspondingto the pattern elements to be displayed. No polarizers are used,so its contrast ratio is very high, and there are not the severelimitations onviewing angle of older glass LCDs. Both transmis-sive mode backlighted NCAP and reflective mode NCAP dis-plays with colored reflectors may be combined with graphicoverlays. Power consumption is down around 9 mA per squarefoot.

Someday I’ll have some wallpaper made out of this stuff.

I am currently involved with two projects incorporating flat(LCD) displays. Utilization of the technology has a lot of parallelsin video, which seems a thread in one way or another through90% of what I’ve been doing for the past six years.

Msg#:10208From: PELLERVO KASKINEN To: TIM EMERSON

You might also consider one of the electroluminescent displaysthat you see in most European airports. They are made by Finlwc.Contact them at 408/725-1972.

As another point: AEG was in financial problems a few years agoand was saved by being partly bought by Daimler Benz. Nowthey are in an upswing, considering a purchase of some multibil-lion dollar enterprises. If that goes through, they may be thelargest industrial enterprise in the whole world. Other than that,they make anything you might want from hair dryers and powerdrills to nuclear power plants. Their name pretty much says thesame to the Germans that a GE says to the U.S. population-andincidentally, translates to “General Electric Inc.” or somethinglike that!

If you redly want to starf a religious wur, fry tellingsomeone his favorite programming language is for thebirds and some other language is the best. At least thefollowing discussion was kept civil while the merits ofvarious languages used for microcontroller programmingwere debuted.

MsgX: 9954From: DAVE FILICICCHIA To: ED NISLEY

I have been using the 8051 for some time now and started withlearning PL/M51. I use it at work and have enjoyed its flexibil-ity. I want to do some home projects using a high-level languagewith the 8051, but all the software packages are so expensive($750-$1000). Do you know of any high-level language packagefor the 8051 that can be purchased for a more reasonable price(like around $200 or so)? It would be great to stick with PL/M,but C or maybe even BASIC would be OK. Thanks.

Msg#: 9991From: ED NISLEY To: DAVE FILICICCHIA

Beats me...

Avocet advertises both C and Pascal, but they’re both in the high-price end of the market.

I’m not entirely convinced that high-level languages are a GoodThing for single-chip micros. After all, they depend on architec-tural features that microcontrollers (at least 8051s) don’t have: bigstacks, lots of registers, orthogonal instruction sets, lots of ad-dress space.

The tack we’ve been taking on Circuit Cellar projects is to put asmuch function in the PC code and as little in the 8051 code aspossible. The principle is to make the 8051 code simple, becausewriting and debugging it is such a pain-as you‘re well aware!

Msg#:10068From: DAVE FILICICCHIA To: ED NISLEY

Actually, I have found PL/M to be a pretty reasonable language.It seems to have a lot of parallels to C without being too cryptic.Table look-up becomes easy and even pointers aren’t too difficultto use. I’ve done a few designs that use the 8051 as a machinecontroller that didn’t require any external RAM.

After just learning Turbo C, I still prefer PL/M for now becauseit has a bit more structure and forces you to declare variables ina more obvious manner than C. Also, I find using keywords tobe helpful even though it requires more typing. Constructs in Cthat use the “?” in the special case of IF are confusing to me as abeginner C programmer, and the IF-THEN-ELSE of PL/M israther straightforward. I guess we all tend to use what is mostcomfortable. Thanks.

MsgX:10078From: ED NISLEY To: DAVE FILICICCHIA

Yeah, even if it wasn’t comfortable when you got started, you canput up with almost anything else rather than learn somethingnew. I’ve had this slap me a couple of times so far.. .

68 C//?CU/T CR LA R INK

Page 61: Circuit.cellar.008.Apr May.1989

Msg#: 9968From: JIM NELSON To: DAVE FILICICCHIA

Bryte Computers sells a Forth for the 8031 for $100. Their Mainephone number is 207/547-3218. This Forth willbe 10 times fasterthan BASIC on the 8031. Of course, if you can’t respect such aninexpensive product, you can buy 8051/31 ChipForth fromFORTH Inc. for $3750.00 or from MPE for 225 pounds sterling.

Bryte Forth is supplied in an 8K EPROM. The Forth assembler isincluded along with a 130-page manual. Minimum RAM re-quired is 2K bytes; program and data memory spaces must bemapped to the same physical memory devices.

Forth has beencalled a programming amplifier-it multiplies thepower of good programmers. It has the interactivity that BASICprogrammers embrace. This is combined with the speed andLisp-like extensibility necessary to allow you unequaled accessto and control of microcontroller hardware.

Msg#: 9984From: GARY LEAR To: JIM NELSON

Jim’s message sounds like that of a true-blue Forth man (we haveone at work). There are times, however, when the microcon-troller is already running with pins to the wall and *onlyassembly will do (or else add some more hardware). Forth has itsplace as a tight, self-contained operating environment, but it

takes a completely different mindsct to program in it at alleffectively.

Msg#:10031From: JIM NELSON To: GARY LEAR

Ray Duncan wrote an article on Forth for the November/Decem-ber issue of “Programmers Journal.” He begins with thesequotations:

“I have yet to seeadecent piece of software written in Forth. Let’sface it, Forth stinks.” John Dvorak

“Forthisthefirstlanguagewhichhasbeen honed againsttherockof experience before being cast into bronze.” Charles Moore

“Only brain-damaged programmers use Forth.” Allen Holub

“Forth is like the Tao. It is a Way, and is realized when followed.Its fragility is its strength, its simplicity is its direction.” MichaelHam

Rather than finding myself bound by a mindset, I have found agreat freedom in using Forth. What isn’t widely understood isthat a good Forth programmer can command, in a single appli-cation, the entire range of machine level to fourth-generationsoftware engineering technology. I used Forth tentatively forover a year before I became aware of the mindsets consequent to

Powerful, Low-Cost Data Acquisitionand Control with Commodore C64 & Cl28

l/O Boardwith ROM cartridge socket

Model al $119.

Original Ultimate InterfaceUniversally applicable dual 6522 versatile interface adapter board.

Model 64lF22 $169. Additional $149.16Channel, 8-bit analog*to-digital conversion module.

Requires model 64lF22. Model 64lFIADC0816 $69.Interface boards include extensive documentation and programdisk. Manuals available separately for examination. Call or writefor detailed brochure.

Resources for Serious Programmers.l Symbol Master Multi-Pass Symbolic Disassembler. 034 & Cl28 $49.95l PTD6510 super-powerful Symbolic Debugger. C64. $49.95l MAE64 6502/65CO2 Macro Editor/Assembler. $29.95l C64 Source Code Book. Kernal and Basic ROMs. $29.95

SCHNEDLER SYSTEMSDept. C, 25 Eastwood Road, P.O. Box 5964

Asheville, North Carolina 26813 Telephone: (704) 274-4646

BCC52 BASIC-52 COMPUTER/CONTROLLER

T h e BCC52 Gompuler/Contmller is Mi-cromint’s hot&t selling standalone single-board microcomputer. Its cost-effective archi-tecture needs only a power supply and termi-nal to become a complete develo ent orend-use system, programmable in I!?ASIC ormachine iangua e. The BCC52 uses Mi-cromint’s new dC52-BASIC CMOS micro-processor which contains a ROM-resident 8K

% 8.te Roatin oint BASIC-52 interpreter.e BCC5 contains sockets for up lo 48K

bytes of RAM/EPROM, an ‘intelligent’ 27841128 EPROM progTmer, 3 parallel ports, asenal termma port mth auto baud rate selec-tion, a serial pnnter port, and it is bus compat-ible with the full line of BCGbus expansionboards. The WC52 bridges the gap betweenexpensivepqrammablecontroliersandhard-to-justify price-sensitive control applications.BASIC-52’s full floatin

V-point BASIC is fast and efficient enough for the most

complicated tasks, wht e Its cost-effective design allows it to be considered formany new areas of implementation. It can be used both for development andend-use a l&ions.Since the IFASK;-52 is bus oriented, it supports the following Micromint expan-sion boards in any of Micromint’s card cages with optional power supplies:BCC22 Smal lsrmiral bcmd KC53ADP500 Usu vocaklay. cigiimi speech bcmd

knay md S-pcH 110 erp. boardBcci3 8.cbncl atit IuD mtim

WC25 LCOdgBCC33 lportl

ayboard WC30 16chmell2-tit IVD amverte~@a-&n board BCCtS Dud dumel w-id Ix) bard

BCC4OD BChmnel +kd?Jed 10 expamicn bmdBCXXOFI S-CMnel relay cuput board

‘&.X55 Prctctypbg twxdBCC45 St- Motoc bad

BCC52 BASIC -52 Controller board S189.00BCC-SY ST.5 ‘52 PAK’ Starter System s44g.W

Inckks:BCC52. ROMAIBLJTIL.. CCOl. MBOS. UPSlO l-800-635-3355BCC52 OEM 100 Quantity Price $149.00 Tel: (203) 871-6170

BCC52C Lowerpowerall-CMOSversion f199.‘XHa&: The ‘AC’32 Me6 is avdlable h II-&EM Temperatwe Range, lrlytoed. PricessMatSZM.00irqlaqty. C#l Iw OEM pi&q.

MIcromInt, Inc -4ParkStreet,Vemon,CT060)6

Circle No. 138 on Reader Service Card circle No. 132 on Reader Service Card

April/May I989 69

Page 62: Circuit.cellar.008.Apr May.1989

my experience in traditional languages.

Msg#:lOlzlFrom: GARY LEAR To: JIM NELSON

I have written a few small programs in Forth in an attempt tograsp the differences in overall philosophy. So far I have had onlyminimal success (I assume that you are familiar with Leo Brodie’stwo books, “Starting Forth” and ‘Thinking Forth,” at least one ofwhich was written at Forth Inc.). So far I have the same complaintthat I have with C: In an attempt to be concise, the language isexcessively terse. This may be contrasted with Pascal, which is aheavily “typed” language (which means two entirely differentthings to beginning and experienced Pascal programmers!). I stillfavor assembly for fast control applications, but this may beattributable to my hardware origins.

We often get questions on the BBS about where to findparts for projects. The following is a list of suppliers thatwe and others have had experience with in the past. Donote the cautions concerning the quality of componentsfrom surplus suppliers, however.

Msg#:11176From: RICHMOND ARMSTRONG To: ALL USERS

Is there anyone who can supply ICs, sockets, and other discretecomponents in small quantities for experimenters? Any sugges-tions for places to look are greatly appreciated. Thanks.

Msg#:llZOZFrom: KEN DAVIDSON To: RICHMOND ARMSTRONG

This is just a partial list of suppliers of both electronics compo-nents and surplus parts and equipment. Most have shippingcharges which depend on the size of the order, and some haveminimum order amounts, but all sell parts in single quantities. Ifanyone has a favorite supplier not on this list, let me know and I’lladd it.

ICs, Discretes, Sockets, Switches, etc.

Digi-Key Corporation Jameco Electronics701 Brooks Ave. South 1355 Shoreway Rd.P.O. Box 677 Belmont, CA 94002Thief River Falls, MN 56701-0677 (415) 5928097(800) 344-4539 Telex: 176043(218) 681-6674 Fax: (415) 592-2503Easylink: 62827914Telex II: 9103508982 “DIG1-KEY CORP”Fax: (218) 681-3380

Mouser ElectTonics2401 Hwy. 287 NorthMansfield, TX 76063(800) 346-6873(800) 992-9943 (to order a catalog)(201) 328-3322Fax: (817) 483-0931

70 C//?CU/T CfLLAR INK

JDR Microdevices110 Knowles Dr.Los Gatos, CA 95030(800) 538-5000(408) 866-6200Telex: 171-110Fax: (40813788927

The following list of surplus suppliers comes from the pile ofcatalogs we had on hand. Quality and availability of parts fromsurplus houses can vary considerably, and we make no claims foror endorsements of any of the suppliers listed here. We welcomecomments, both good and bad, from any users who may have ex-perience with any of these companies.

Surplus Parts and Equipment

Marlin P. Jones & Assoc.P.O. Box 12685Lake Park, FL 33403-0685(407) 8488236Fax: (407) 844-8764

H&R Corporation401 E. Erie Ave.Philadel(215) 426!

hia, PA 19134-1187-1708

Fax: (215) 4258870

Jerryco, Inc.601 Linden PlaceEvanston, IL 60202(312) 475-8440

Edlie Electronics2700 Hempstead T ke.Levittown, NY 11 &6-1443(800) 645-4722(516) 735-3330

John J. Meshna, Inc.19 Allerton St.Lynn, MA 01904(800) 637-4627(617) 595-2275

Sintec Company28 8th St., Box 410Frenchtown, NJ 08825(800) 526-5960(201) 996-4093

R&D Electronics1202H Pine Island Rd.Cape Coral, FL 33909(216) 621-1052

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

IRS225 Very Useful226 Moderately Useful227 Not Useful

SOFTWARE and BBS AVAILABLE on DISK

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

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

To order either Software on Disk or Circuit Cellar BBS on Disk. send check ormoney order to:

Circuit Cellar INK - Software (or BBS) on DiskP.O. Box 772, Vernon, CT 06066

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

Page 63: Circuit.cellar.008.Apr May.1989

Ctrl

STEVE’S OWN ’ N K-7 Smile When You Call Me That

‘\\, -r J

‘. (.’

EifiLike most engineers, I enjoy the opportunity to investigate new technology and utilize it where it seems appro-

I priate. Having to produce 12 monthly design-oriented projects for the last 12 years was more than ample. ...’ incentive to build some truly wild things. My house now sports a complete electronics lab, a computer-

controlled wood stove, electronic lighting control, and a surveillance system that rivals the National Security Agency.Unfortunately, the next step in career evolution for me, again like most engineers, is to move from pure

engineering to management. According to Circuit Cellar INK’s reader demographics, a lot of you are in the same boatwith me. Fully a third of the readers define their training as engineers, yet further designate that their current functionis management. I remember a long time ago when I worked for one of the industrial giants, the joke down in the pitswas that the best way to destroy a good engineer was to make him a manager.

So, what are my observations a year after this career modification?As with any job, the proper solution to a management assignment is part intuitive ability and part logically

defined physical exertion. Simply stated, management success is usually a combination of proper task definition anddelegation.

This isnot a consulting course on management training, and I don’t wish to bore you with the obvious. Virtuallyall engineers have little problem defining tasks. In fact, they are better suited to it than most professions. Where theyhave greatest difficulty, however, is delegation. Engineers generally think in terms of tasks for themselves, andsolutions that they intend to accomplish. Yes, it was a joke that putting an engineer in management produces botha bad manager and a useless engineer, but it is not without some basis in fact. We train engineers to be independentfountains of knowledge with little emphasis on communication and people management skills. When an engineertries to apply traditional engineering techniques and methods in a pure management situation, he soon finds thatlogic and opportunity are often in conflict.

There are two ways to learn things in life: trial and error, or someone tells you. You might think that afterspending a solitary existence in a cellar for 12 years that I’d be at a disadvantage. Be advised, however, that my allegedstatus as a “hermit” is more myth than reality. I surely don’t have to fail first hand to get the message that differenttactics are required when you direct a magazine rather than just write for it.

I discovered that the proper place for me is managing the direction of Circuit Cellar INK, not managing the eve-ryday tasks of publishing it. Fortunately, I had no problem attracting the right people. The staff of Circuit Cellar INKreads like a who’s-who of publishing. I’d like to think that it was the result of my personal charisma, but in realitythese people are here because they have a common interest in producing the best computer applications magazinearound. With people this motivated, managing objectives is easy.

So, in actuality there really hasn’t been any metamorphosis for me, just a modification in time allocation. I don’tspend as much time in the cellar as I once used to, and I don’t just design projects to be published. My responsibili-ties now include communicating and promoting our message more. I still warm up the soldering iron to work onmy own projects but I am more inclined now to direct the Circuit Cellar INK engineering staff to work on one of myideas rather than doing it personally.

Sigh.. .I guess I have graduated into being a manager. Regardless of that fact, my first love is engineeringand the contents of Circuit Cellar INK will always reflect that reality. Yes, I’ve ascended to management. Butyou’d better smile when you call me that!

SteveCiarcia

72 C//?CU/T CELLAR INK