Top Banner
8/13/2019 Circuit.cellar.022.Aug Sep.1991 http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 1/93
93

Circuit.cellar.022.Aug Sep.1991

Jun 04, 2018

Download

Documents

Sarah kaya
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 1/93

Page 2: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 2/93

EDITOR’S

The March of TechnologyINK 

  Cu rtis Fran klin, Jr.

I don’t often get the ideas for these editorials from enter-

ners, but the title you see above came from a speech given by

r Peter Ustinov to the  National Press Club on June l 1991.  He

ed thephraseintheanswertoaqucstionaboutthccausesofthe

  changes in eastern Europe. Regardless of your position on

y number of subjects, two facts are incontrovcrtiblc: Technol-

y is constantly changing, and the changes in technology affect

e way we live. Voices have been raised in protest against the

emingly inexorable march of technological progress, but many

these latter-day Luddites have merely established technology

a shibboleth for rallying their followers: They use a broad

ush to paint every technological advance as evil rather than

tempting to understand how a particular technology effects

eir area of concern.

Of course, if you’re reading this magazine of your own free

ll, you don’t need me to tell you all of this. So far, I’ve been

reaching to the  choir.” I’vegot to convince you, though, that all

this does matter because the people who don’t understand

chnology are reporting the news and making the laws in far too

uch of this world. Let me give you a couple of examples.Early this year, a comprehensive act concerning terrorism

as introduced in the   U. S. senate. One of its many provisions

ated that the lawmakers wanted law enforcement officials to be

le to look at any file on any computer in the land. One of the

sults of this would be to force every programmer working on

ta security or encryption to leave a “back door“ through which

w enforcement officials couid   look at data. The bottom line

ould be that data security, as we know it, would cease to exist

nce any security system with a back door is no longer secure.

rtunately, folks from several industry organizations went to

e sponsor and explained why the  bill would have unintended

  The passage has been removed from the bill. Govern-ental bodies   on every level are becoming involved with more

d more technical and technologically advanced issues. In

any cases they appear to be acting with no input from people

ho are well  versed in the technology at issue. The results from

y one of these cases could range from inconvenient to disas-

ous, and most of the population will not care because they are

t experts   and have no one to explain  the situation to them.

Ideally, the mass-media press would be able to make even

cmost complex issueclear to their readers. Onerecent incident

s shown that they are capable of dangerous misunderstanding

garding technological issues. I’m referring to the  Great Prodigy

ata Theft Caper.

The Wall Street Journal started the ball rolling with an article

on a particular file that Prodigy’s software keeps on the user’s

hard disk. Prodigy uses the file, about a megabyte in size, for 

storing graphics primitives so that their fancy graphics are merely

slow and not glacial. Some genius took a look at this file with a

sector editor and found bits and pieces of old data inside. They

then decided that this was a nefarious plan by IBM and Sears to

suck personal data off the hard disks of subscribers, and come up

with a plan to make us all wear blue suits and buy Kenmore

appliances. It was a great story, but it had the flaw of being

completely ridiculous. Anyone who knows about MS-DOS and

its putative file system realizes that deleting a file makes a change

in thedirectory, not in thcdata sectors. Whether you run Prodigy

or not, if you look at your disk with a sector editor you’ll find bits

and pieces of old files.

Furthermore, 1 refuse to believe that even IBM has the

computing horsepower to suck in random chunks of an old

guacamole recipe, a spreadsheet based on the assumption that

I’m as rich as the Sultan of Brunei, and a letter to my great-aunt

Kathryn and reach any conclusion at all. The story had no soundtechnological basis, and was blown complctelyout of proportion

 by people who hadn’t the information to know better.

Whyaml tellingyou this? ThereadersofCIRcrnTCELLARINK

are in a unique position to make a difference in both areas,

government and media. I frankly don’t care which side of an

issue you take, but when the issue involves computers, electron-

ics, or other technologies in which you‘re conversant, let the

officials involved know how you feel and why. In a similar 

fashion, it’s all too easy to see a boneheaded factual error in a

newspaper or magazine article on computer and laugh, but I’ve

resolved that after I finish laughing I will write the editor of the

offending publication and tell them how they erred. If it happensoften enough they’ll realize that they have readers who know

enough about the   technology to care when the media makes  a

mistake.

Hardware and software design teach us that the details

count. Keeping elected officials, bureaucrats, and the fourth

estate informed and honest is mostly a matter of letting them

know about the details they’ve missed. I think it’s an effort worth

 putting forth.

Auyust/ Sep temb er  199 1

Page 3: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 3/93

FOUNDER/EDITORIAL DIRECTORSteve C iarcia

PUBLISHERDaniel Rodrigues

EDITOR-IN-CHIEFCurtis Franklin, Jr.

MANAGINGEDITORKen Da vidson 

PUBLISHER’SASSISTANTSusan McG i l l

ENGINEERING STAFFJeff Bach ioch i

Edw a rd Nisley 

CONTRIBUTINGEDITORSThom a s C a r & e / /

Christopher Ciarc iu

NEW PRODUCTSEDITORHarv Weiner 

CONSULTINGEDITORSGlenn Hartwig

La rry Loe b 

CIRCULATIONCOORDINATORRose Manse / l a

CIRCULATIONCONSULTANTGreg ory Sp itzfad en 

ART/PRODUCTIONMANAGERMa rk Vereb 

ART DIRECTORLisa Fe rry 

BUSINESSMANAGERJeannet te Wal ters 

ADVERTISING

COORDINATORDa n G orsky 

STAFF RESEARCHERS

Northeast

Eric Albert 

Ric ha rd Sa wye r 

Midwest

 Jon E/son

l7m  McDonough

West Coast

Frank Kuec hm an n 

Cover Illustrationby Robert Tinney

2   C IRCUIT CELLAR INK

Using Device Drivers to Change the Rulesby Chris Ciarc ia 

MS-DOS device drivers are the key to controlling PC hardware at the lowestlevel. Learning how to write drivers can open up your applications to greater

functionality and flexibility.

ISDN (S/T) Interface-Part 1

Ge neral Review of Funct ional Conc ep ts by Steven E. Strauss 81 P.K. Gov ind

integrated Services Digital Network (ISDN)   is making the transition from planningto reality. Understanding the nature of the network is an important first steptoward using ISDN’s  potential. Next time: The hardware for making ISDN  work

with your PC!

S-ART: Building the Network Software-Part 2by John Dybow ski 

Control networks are the sum of their hardware and software. The conc ludingpart of this article talks about the software for tying the net together.

Numerical Applications Using DSPUsing a DSP Chip fo r Hig h-Sp eed Num eric Proc essing 

by Edua rdo P fe z  Dapang Chen 

Digital Signal Processors are frequently more than just signa l processors, they’rehigh-speed number crunchers in their own right. Knowing what they can do

may open up new applications for these popular and powerful processors.

But it Worked with My Emulator!

Why Emulation Isn’ t Rea lity by Keith Wen two r th

Emulators are valuable tools when it comes to working the bugs out of a newdesign, but there are traps and pitfalls waiting for the unwary. Knowing what tolook for when you use an emulator can reduce the surprises when you move

your software to the final platform.

Son of DDT: A New 8031 Debuggerb y Ed N isley 

 The DDT-51 was a break-through project in low-cost debugging and develop-

ment equipment. Now, it’s time for the next generation. Find out what four  yearsof input from users, field experience, and technical development have done for

the personal embedded software development.

Page 4: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 4/93

q1Editor’s INK The March of Technology

by Cu rtis Fran klin, Jr.

 4Reader’s INK-Letters to the Editor

l-l8   NEWroductNews

Firmware FurnaceToolmaker’s Toolworksby Ed Nisley

From the BenchReducing Power ConsumptionBrea th ing New Life In to Da ta Log g ing 

by Jeff Bac hiochi 

q88Silicon UpdateKynar To The RescueThe Ult ima te Se nso r? 

by Tom Cantre l l

Practical AlgorithmsSummarizing Your DataProp ert ies of a Bou nd ed Pro b a b ility De nsity Func t ion 

by C harles I? Boegli

Connec Time-Excerpts  from the C ircuit Cellar BBS

Conduc ted by Ken Dav idson 

Steve’s Own INK A Standard Column

1 by Steve C ia r c i a

197

Advertiser’s Index

Circuit Cellar BBS-24 Hrs.

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

parity, 1 stop bit, (203) 871-

1988: 9600 bps HST

(203) 87 l-0549

All programs and sche-

matics in Circuit Cellar INK 

have been carefully re-

viewed to ensure that their

performance is in accor-

dance with the specifica-tions described, and pro-

gramsarepostedon theC ir-

cuit  Celiar BBSforelectronic

transfer by subscribers.

Circuit Cellar INK makes

no warranties and assumes

no responsibility or liability of 

any kind for errors in these

programs or schematics or

fortheconsequencesofany

such errors. Furthermore, be

cause of the possible vari-

ation in the quality and con-

dition of materials and work-

manship of reader-as-

sembled projects, CircuitCellar INK disclaims any re-

sponsiblity  for the safe and

proper function of reader-

assembled projects based

upon or from plans, descrip

tions,  or information pub-

lished in Circuit Cellar INK.

CIRCUIT CELLAR INK (ISSN

0896-8985 is published bi-

monthly by Circuit Cellar In-

corporated, 4 Park Street,

Suite 20, Vernon, CT 06066

(203) 875-2751,  Second-

class postage paid a t Ver-

non, CT and additional of-

fices. One-year (6  issues)

subscription rate U.S.A. and

possessionsS17.95,Canada/

Mexico 21.95,  all other

countries S32.95. Allsubscrip

tion  orders payable in U.S.

funds only, via international

postalmoneyorderorcheck

drawn on U.S. bank. Direct

subscription orders tocircuit

CellarlNK.Subscriptions.P.O.

Box 3050-C. Southeastern,

PA 19398 or call (215) 630.

1914.

PO STMA STER: Plea se

sendaddresschangestoC ir-

cuit   Cellar INK, Circulation

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

Southeastern, PA 19398.

Entire contents copyright

0 1991 by C ircuit Cellar In-

corporated. All rights re-

served. Reproduction of this

publication in whole or in

partwithoutwrittenconsent

from C ircuit Cellar Inc. is pro-

hibited.

Aug ust/Sep temb er 199 I 3

Page 5: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 5/93

MORE ON STANDARD DEVIATION

Charles P. Boegli provided us with a description of atool in hisarticle “Adjustingstandard Deviation to SampleSize” in CIRCUIT CELLAR INK 20.  It has a very powerfulapplication if used in a more useful form. Some of us

average data to get a “better” number. He has shown usthat we should average at least 10 samples.

What is the quality of our data? The standard devia-tion used as calculated is a difficult-to-interpret number.What some of us would like to have is a measure of quality.If the standard deviation is presented in terms of percentof the mean value, we have what I will call the quality.

A quality of O.OOOOOOOOOO... would indicate a nearperfect measurement. The number of zeros after the deci-mal point indicates how good the data is. A lower numberof zeros means higher quality. Not being a mathematician,or having even taken statistics, the actual numerical sig-

nificance of this number is unknown to me. It seemsbelievable that it could predict the number of significantdigits in the measured value.

In a DC (steady state) measurement system, where astimulus is applied and an average value is measured, theprocedure usually takes the form of: (1)  Apply stimulus,(2)   Wait x, (3)   n: (Measure, Wait yl, (4)   Average. If thequality of the data is computed along with the averagevalue, programs can reject those values that are not mea-surable and/or unstable automatically.

While using the notion of data quality, I found a flawin step 2. If the first stimulus is large and the subsequent

stimuli small, the first data point would have a largerquality value, thus lower quality, especially if the samplesmeasured are capacitive. The x  wait time needs to beadjusted by a function of the magnitude of change inexternal stimulus if you want the steady state value.

The above information should prove useful for thosecharacterizing electrical devices and those who write pro-grams that need to determine the validity of a valuemeasured by a sensor that is assumed to be in a steadystate.

Editor’s N ~ ~ ~ I ~C I R C U ~ ~C E L L A R  INK 21 we published a letter by Mr. Norman Stanley which criticized the article “AdjustingStandard Deviation to Sample Size” from C I RCU IT C ELLAR INK  20.  The author responds:

I appreciate the effort Mr. Norman Stanley has spent

defending the status quo against my paper, and will replyas briefly as possible. Apparently I was overenthusiastic insaying that O/X)~~  is imaginary when x is negative; as hecorrectly observes, it is zero. Since the expression is alsozero when x is positive (as we both agree), the indetermi-nate expression obtained when x=0   likely also evaluates tozero. None of these methods is useful with a single sample,which we all knew anyway.

In hastilybrushingaway theraisond’etreof mypaper,Mr. Stanley illustrates the kind of personal discomfort Ialluded to in its opening. My correction comes from a tablein the identified recent (1985) source, from which I now

quote: “When we wish to refer to the standard deviationof.. .a parent population, we use the symbol o’. . .[which]is usually unknown. However, it is possible to estimate dby using.. .a series of samples as follows:

d  = (sigma of a sample fo a given size) x 1 /c2

where c2  is a factor that varies with the sample size.”This correction is applied to a SD obtained with the divisorn, for which the symbol ois used there. I find no ambiguityin that statement. The table is found in many sources andby inclining “to view it with suspicion” Mr. Stanley casu-

ally sidesteps the central issue. Fitting the value of 1 /cZ  tothe sample size by an expression that can be neatly intro-duced into that for ois my own work. Mr. Stanley correctlyobserves that this expression gives d  (or, as he will haveit, 01  even larger than n-l. It also took me a while to recoverfrom the shock at calculating this value.

My source manifestly uses symbols other than thoseMr. Stanley prefers, and he will find other usages in othertexts. Perhaps there is less unity here than he suggests. Iprefer to use SD and take the trouble each time to define it.

Ron Dozier Charles Boegli

Wilmington, DE Blanchester, OH

4   ClRCUlT CELLAR NK

Page 6: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 6/93

Page 7: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 7/93

A/ElAPRODUCTNEWSNElA/PRODUCTNEWS

PALM-SIZE386%SINGLE-BOARDCOMPUTER

An industrial-gradesingle-board computer,

featuring a 16-   or 20-MHz

386SX microprocessor, has

 been announced by Teknor 

Microsystems. Measuring

only 7” x 4.7” (178 mm x 119

mm), the TEK-AT2 board

runs either in stand-alone

mode or on a PC/AT bus.

The board uses all CMOS

technology for low power 

dissipation and extended

temperature operation.Up to 16 megabytes of mixed

DRAM are supported. An

optional IM-byte   Flash

EPROM and IM-byte   SRAM

with battery backup are

available, as well as optional

 piggyback support for an

80387SX   math co- I

 processor. The TEK- IAT2 contains both

hard and floppy controllers,

two serial ports, and one

 parallel port. Video supportis available through an

optional add-on board. Setup

software in ROM and on disk 

is provided.

The TEK-AT2 includes

software utilities, complete

documentation, and full

technical support. The board

is priced at $725 in loo-unit

quantities (16-MHz  model

with no memory).

Teknor Microsystems, inc.C.P.  455

Sainte-The e   Qu6bec)

Canada J7E  4J8(514) 437-5682Fax: (514)  437-8053

Reader Service 500

W ANT TO SEE YOUR NEW pRoducT  iN Cincuh  C R

INK’s NEW PRoducT  NEWS sEcTioN?

JUST smd  us YOUR NEW PRoducT  A NNOUNCEMENTS

OR PRESS REUSES

smd  TO:

CuRTis  FRANktiN,  JR .

EdiTowiwChiEf

CiRcuiT  CELLAR   I N K

4 PARk  ST R E E T

V E R N O N, CT 06066

PROCESS CONTROL/DATA ACQUISITIONSOFTWARE WITH RULE-BASED FEATURES

A software package that features a rule-based, table fill-

out application generator is available from Automated Control

Systems. PACX (an acronym for Process Acquisition and

Control expert) eliminates traditional programming by

allowing a user to describe the application instead of coding it.

The main part of the PACX system consists of the System

Builder, an application generator that is a menudriven editor.

The editor, which is the only user interface, consists of three

 parts: one used to describe the hardware, one to describe the

application, and one for the artificial intelligence section.

Based on this description, the editor creates a “Knowledge

Base” which consists of a database of I/O points and a set of 

rules for control. The set of rules in the Knowledge Base is

used by a real-time multitasking operating system. As the

operating system runs, it uses drivers to read and write the

I/O points of the controlled process. PACX has been designed

such that at each given time, only the I/O points that are

critical for correct control of the process are updated. Thisoptimizes the operation of the computer for fast control and

data acquisition.

A complete set of mathematical operators is available for 

 both digital and analog calculations. Inputs are checked

against a mathematical expression for true conditions to drive

the rule base to new rules. Outputs may also use full math-

ematical expressions which utilize any of the other I/O for 

calculating their settings.

A full set of timing operations including relative timers,

wall clock time, and minimum and maximum for each rule is

also available. During run time, full screen control is available

to the user. Text-based menus, data entries, and messages may

all be built and controlled using the System Builder, giving theoperator full control for interactive-type applications.

The PACX Data Acquisition and Control Software is PC

compatible and consists of the PACX System Builder ($349.00)

and the PACX Run Time ($349.00). Available device drivers

are $99.00 each, and customized device drivers can be obtained.

Automated Control Systems, Inc.

P.O. Box 49 l Provo, UT 84603-0049 l (801)  373-0678

Reader Service 501

Page 8: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 8/93

ElAPRODUCTNEWSNElAPRODUCTNEWSFLASH MEMORY DISK EMULATOR BOARD

Sealevel  Systems has

nnounced the PROM-III

lash Memory Disk Emula-

or Board. The board can

eplace both hard disks and

loppy disks in embedded PC

pplications where critical

ata retention is required.

he PROM-III stores up to

ne megabyte of data in flash

EPROM. Flash EPROM

llows erasure and repro-

ramming without the need

o physically remove the

hips. The PROM-III also

upports battery RAM

modules and conventional

EPROMs.

The board works in

conjunction with the

PROMkit  Software from

Annabooks. Both DOS and

application programs can ”

 be placed in EPROM and 1

automatically booted.

Applications include factory

automation, dedicated PC

controllers, diskless worksta-

stations.

The PROM-III sells for 

$239.00 with OK, $319.00 with

360K of flash EPROM

installed, and $389.00 with

720K of flash EPROM.

Software to program the flash

memory devices is included

at no charge.

Sealevel  Systems, Inc.P.O. Box 1808

107 S. Pendleton St.Easley, SC 29640

(803) 855 158 1

Reader Service 502

DEVELOPMENT SYSTEM FOR EMBEDDEDCONTROL APPLICATIONS

A complete prototyping board for developing embedded

ontrol applications is available from Rigel Corporation. The

R-535 Prototyping Board with R-Ware features efficient

oftware development and rapid hardware prototyping

ombined in a single integrated development environment.

he R-535 uses the 80535 microcontroller, which is an en-

anced version of the popular Intel 8032 controller. The R-535

an be used to develop programs for the 8031 family of 

microcontrollers. The R-535 uses external RAM during the

evelopment cycle. Once an application program is devel-

ped, the R-535 has the capability to permanently place the

pplication program in EPROM using the on-board EPROM

urner. With an application-specific program installed, the R-

35 may be used to emulate an embedded controller.

The software development effort is greatly

implified by R-Ware’s integrated host environ-

ment. The environment is completely   menu

riven. It includes an editor, cross-assembler,

nd debug utilities. The ROM-based software

esiding on the R-535 board complements the

C-based host software. Together, R-Ware

andles all PC-to-board communications,

rogram download, debugging, and EPROM

urning. Besides components of the   integrated

nvironment, the ROM-based on-board software

ncludes operating system utilities complete with

ser-accessible system calls and an ASCII

erminal mode to be used when a PC-host is

navailable.

Prototyping components consisting of push

uttons, DIP switches, LEDs,  numerical displays,

nd potentiometers are used for emulating

ontrol application inputs and outputs. The large

olderless breadboard terminal strip is used to

onstruct application-specific circuits to be

nterfaced with the microcontroller. All

microcontroller ports and all major system control lines are

available through a 54-post solderless breadboard terminal

strip. In addition, all system lines are available by two

standard 40-pin headers. These provide flexibility for connect-

ing prototyping components to the microcontroller lines, and

for developing and debugging user-designed analog and

digital application circuits.

The R-535/R-Ware includes a lOO+   page user’s guide with

schematics, board layout, and control experiments with

example software.

The R-535/R-Ware is available as a kit for $395.00

(includes all necessary components and an assembly manual)

o r assembled and tested for $495.00.

Rigel Corporation l P.O. Box 90040

Gainesville, FL 32607

(904) 373-4629

Reader Service 503

Aug ust/ Sep tem be r 199 I 9

Page 9: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 9/93

PC VOICE CARDFEATURES DATACOMPRESSION

A proprietary real-time

voice data compression

scheme that can usuallyreduce data size by about

30% without voice quality

degradation is available in a

voice card from Eletech

Electronics. Compression is

achieved by not recording the

 pauses between spoken

words and sentences. Instead,

a special code designating the

length of the pause is

recorded, reducing thousands

of bytes of digitized “silence”

to just a few bytes.

When voice data is

 played back, a period of 

silence is added whenever 

the special silence code is

encountered. This approach

results in virtually no voice

quality degradation since

only the pauses and not the

words are compressed for 

storage.

This compression

scheme has been incorpo-

rated on the DigiCorder PCVoice Card, an g-bit half-

length card that fits any

available slot in an IBM PC/XT/AT or compatible. Digital

recording and playback at

adjustable sampling rates are

 possible, and the unit‘s input

supports standard micro-

 phones and tape players. The

length of the recording (or 

the size of the data file) is

limited only by the capacity

of the disk drive.

A menu-driven utility

 program is included to

 provide functions of record,

 playback, and limited speech

editing. Line command utility

 programs for recording or 

 playback are also included to

facilitate batch mode opera-

tion. All programs run under 

the PC-DOS operating

system.

The DigiCorder sells for 

$99.00 and comes with a

high-quality speaker and Eletech Electronics, Inc.

microphone, and utility 1262Katella  Ave.

 programs and device drivers Anaheim, CA 92805

supporting Micro-soft C and (714) 385-1707

QuickBASIC  under DOS. Fax: (714) 385-1708

Clipper support is a $79.00

option. Reader Service 5@4

decision. Make your choice and rest easy because only Paradigm LOCATE has the ability

to work with both of these powerful softwaredevelopment environments. With comprehensivestartup, run-time library and floating point initiali-zation code, Paradigm LOCATE frees you to con-centrate on the details of the application.

options for controlling the locate process. Bind

e initialized data or generate optional EPROMocumentation   files. Intel 801861188 usersappreciate how Paradigm LOCATE uniquelyeliminates the hassles of memory chip select

initialization. And Paradigm LOCATE ismuch faster than your current tools,

locating large applications with fulldebug information in just seconds.

in hardware development tools will also appreciatethe ability of Paradigm LOCATE to generate completeIntel OMF for use with popular in-circuit emulators.

RelaxYour application is done in record time becauseyou made the correct choice of software develop-ment tools. If you’re still struggling, now is thetime to experience the power, flexibility and com-

 pleteness of Paradigm LOCATE.

Call or write us today for more information on state-of-the-art embedded system solutions  from Paradigm for Intel 80x86 and NEC V-Seriesmicroprocessors.

Specific questions about what Paradigm LOCATE can dofor you? Call toll-free info-line l-800-582-0864

Paradigm Systems3301 Country Club Road, Suite :

S To order: (800) 537.5043 l [607:2214 l Endwell.   NY 13760  748.5968 (FAX)

Pdradq  LOCATEIsalrademarLofPdradlgmSyslemi

ReacierseNice   led

10   ClRCUlT  CELLAR INK 

Page 10: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 10/93

NEMPRODUCTNEWSNEWPRODUCTNEWSOST-EFFECTIVEATA LOGGINGYSTEM

A unique data-logging

stem that consists of a

ftware package and anput module that connects to

e serial port of any IBM or 

mpatible computer has

en announced by Woods

ectronics. The Count

gger acquires data in real

me by counting pulses

hich are applied to the

put module, and sending

e count to the screen, disk 

ta file, and/or printer.

Each time a pulse is

plied to the module, Count

gger tricks the serial port

o thinking a valid RS-232

ta byte has been received,

d accepts the pulse as one

unt. The module shapes the

put pulses so that any wave

ape will be accepted as one

lse. To log randomly

occurring events, the output

of the event detector is

connected to the input

module. To log frequency,

the output of a signal

generator is connected

directly to the module.

Any quantity can be

measured by converting it to

a frequency. For example, to

measure temperature, a

simple temperature-to-

frequency converter is

connected to the stock 

module.

Count Logger 

records the number 

of counts received

within a precise user-

specified time period

ranging from 0.2

seconds to 1 year.The number of time

 periods can be set

from 1 to 10,000,000

or indefinite. The

starting time can be

set to a future time.

Each time period also records

the actual time at which it

occurred. As a result, each

logged entry contains the

data needed to fully analyze

the content of the input

 pulses. The data is continu-

ously analyzed by the Count

Logger and sent to the screen

for immediate use. The data

file to which data is recorded

is in ASCII format and can be

read, printed, edited, or sent

to your spreadsheet or 

database for further analysis

or sophisticated display.

The output to screen, file,

or printer includes user-

inserted messages, time,

length of sample period,

number of counts in that

 period, frequency, totalcounts in all sample periods,

average number of counts per 

unit of time, and error 

messages. An on-disk 

operating manual is provided

along with error checking of 

machine and user-selected

options.

Count Logger is avail-

able for $169.00 including

input module and real-time

 program. Any two-pin jack 

can be connected to the

 pigtails of the input module.

A DB-25-to-DB-9 connector is

also available for $7.50.

Woods Electronics, Inc.

4233 Spring St., Ste 117

La Mesa, CA 91941

Reader Service 505

Take complete control with ParadigmLOCATE, TDREM and the Turbo Debugger Total VisibilityParadigm LOCATE, TDREM and the award-winning Turbo Debugger are the ultimate weapons

Don’t settle for anything less than the best. To get

in the fight against system blindness. Acting as athe complete story, call, fax or write today to learn   P-,   _I I

window into the target system, the Turbo Debugger how Paradigm LOCATE, TDREM and the Turbo

gives unprecedented control over an embeddedDebugger can improve your Intel 80x86 and NEC

application. Debugging in the dark? Use the power V-Series applications.

?2?z ~‘&,,, a  bred. Mscms

 and capabilities of the Turbo Debugger to identify

and isolate even the most insidious bugs!

“m”arspabuity

.*S*“ ~~~

~a r+erS,

WziXl(loo~~sadIlhae..

Unrivaled Productivity  l&&c++

 nt l  c-86 Mect  PLiM 86 kK2-

The same Turbo Debugger that is unrivaled for thedebugging of PC applications can also train its

Specific questions about what Paradigm and the

guns on embedded applications. ConditionalTurbo Debugger can do for you?Call our toll-free info-line I-800-582-0864

 breakpoints with pass counts, execution history,inspectors, watches, macros and a host of other capabilities offer an unparalleled picture of the

  @,i

inner workings of your application, even in a real-   Gtime multi-tasking environment.

  ‘~+J @  P w lGM

Borland Microsoft IntelCompatibility

Paradigm  Systems3301 Country Club Road, Suite 2214

Paradigm LOCATE and the Turbo Debugger areEndwell, NY 13760

compatible with Borland, Microsoft and Intel com-to order: (600) 537-5043 . (FAX) (607) 746-5966

 pilers. So go ahead and use your favorite compiler.  TurboDehugger,salrademarLofBorla”dIn,ernallonalPdr@rn  LOCATE  lratrademarL  “fRradl@n   system\

ader Setie   l& i

Augus t /Sep tember 79 9 I 11

Page 11: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 11/93

Page 12: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 12/93

Page 13: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 13/93

FEATUREARTICLES

Using Device Driversto Change the Rules

ISDN  S/T) Interface-Part 1

S-ART:Buildiing  theNetwork Sottware-Part 2

Numerical ApplicationsUsing DSP

Using Device Driversto Change the Rules

For most of us who work withinthe DOS environment, our only con-tact with device drivers comes whenwe load their images and then makethe appropriate entries into ourCONFIG SYS  file. Invariably, theyseem to take on the form of somestrange, cryptic, unintelligible, andnecessary-“do I really have to haveit?” definition line, which weal1 knowrepresents a continued loss of thosefew remaining bytes of program space.As I have pushed my software againstthe all-too-well-known MS-DOS wallof oblivion, they have provided mewithadditionalammunition tohandleprogramming situations where Ineeded to break the rules in creatingsome slick and fancy application.

In the traditional sense, devicedrivers are written to attach a newdevice to a system. They are programmodules that insulate the computersystem from attached hardware byprovidinga basiccommunicationsin-terface   between the two. Of course,you could make  your device look morelike something your system’s ROMsalready support, but that seems torepresent an inordinate amount ofwork. Instead, designing a piece of

software that looks like an extensionof DOS itself, while performing therequired interface functions, seemsmore practicable. Of equal importance,I have found that device drivers canserve purposes other than hardwareinterfacing. They can serve as power-ful tools for creating a window intoDOS during the boot-up phase. Adriver loaded into low memory di-rectly above the operating system’sfile-control blocks and disk buffers is

initialized early in the boot-up pro-

cess,  well before the AUTOEXEC . BAT

file is executed. This early initializa-tion can be very useful.

A LEARNING EXPERIENCE...

I recently developed a special se-curity procedure that needed to beactivated each time the system wasbooted. It was designed to deny unau-thorized access to sensitive data evenif a floppy system disk was used toboot the computer. It had to be abso-lutely uninterruptable since any dis-ruption in its execution would alwaysresult in a total system crash. The codewas designed to remap many of thebasic DOS interrupt vectors andmodify the hard disk’s work partition

area ownership, which would be setand reset at the beginning and end ofeach user (login/logout)   sequence. SoI needed to find a way to isolate theboot sequence (program operation)from the operator.

My first attempt was to place thecode into the first line of my AUTOEXEC . BAT fileand  set theBREAKswitch to OFF. I expected it to run, dothe necessary interrupt handling, andwhen security requirements were met

I expected it to modify the disk parti-tion table allowing access to sensitivedata. Like most high-level program-mers who typically ignore system“things,” I quickly found out that acarefully inserted CTRL-BREAK, keypulsed during the boot sequence, in-variably generated a Terminate batchfile? prompt, allowing me to bypassthe AUTOEXEC . BAT file. This was notacceptable. I needed my code to run inan unstoppable  mode. I thendebugged

COMMAND . COM and inserted a portion

14   C lRCUT CELLAR INK 

Page 14: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 14/93

rFEATUREARTICLE

Chris ck rck

f my own code to vector theOMMAND . COM procedure to my secu-ity code at the appropriate time. Iave that up when all I could see wasears and years of versions as eachew DOS came out. I then tried togure out how could get my applica-

As it turned out, I was able to imple-ment a procedure by cre-ting my own operatingystem environment (us-ng the ONFIG SYS

HELL c o m m a n d ) a n dhen mirroring theOMMAND. COM functionsnd passing control to

AUTOEXEC. BAT. Itworked! For a while I was

appy, but the new solu-on was a memory hog. I

ost an additional 10K  ofmy 640K above and be-

ond what I would usu- COMMAND.   COM.

hard disk partition and it then resetthe keyboard interrupt vector when itwas ready to pass control to an autho-rized operator. Without the driver inplace, the security code was ineffec-tive and access to the hard-disk workpartition was denied. This made sen-sitive files on the hard disk fairly safefrom the random floppy disk system

booter, provided they didn’t comewith Norton utilities on their disk.Then again, PCs were not designed tobe secure, so all I needed to do wasmake it harder to break the rules.

As such, my use of a device driverto mask the keyboard demonstrateshow it provided me with an accesswindow into the DOS boot sequence.

It was such a simple andpowerful tool that I’d liketo share with you some ofthe basics I learned aboutdevice drivers. I’d like todiscusshowDOSloadsandinitializesa driver,itsbasicstructure, and how I usedit to mask the start-up se-quence.

 Address   Name Size IJiw000000 000400 Interrupt Vector  000400 000100 ROM Communication Area000500 000200 DOS Communication Area

Then I got smart-Iearned to write devicerivers. I worked out ample procedure where-y a very basic deviceriver was loaded, which

uring its initializationhase masked out the key-

oard interrupt vector.his effectively disabledny unwanted keystrokesnd attempts to circum-ent the procedure usingTRL-BREAKS. My secu-ty code was then run as

he first program withinhe AUTOEXEC batch file.

did its thing with the

000700 IO

NUL

CON AUX

PR NCLOCK

 A:-C:

COMl

LPTl

LPT2LPT3

COM2

COM3COM4

002510 System Program

DOS NUL device driver DOS ccnsole  driver 

DOS serial port driver 

DOS printer driver DOS clock driver Drives A: thru C:

System Device Driver 

System Device Driver 

System Device Driver System Device Driver 

System Device Driver 

System Device Driver 

System Device Driver 

002ClO MSDOS   008E20 System Program

OOBA30   IO OOE650 System Data

DRVR 000130 DEVICE= “our example”

MICEMM4F  006AE0 DEVICE= my mouse driver 

 ANSI 001180 DEVICE=LADDRV OOOAEO DEVICE=

000820 FILES=000100   FCBS=

003E70 BUFFERS=

0008FO LASTDRIVE=

OOOCDO STACKS=OlA090 MSDOS 000030   Free

Figure 1 -A ba sicm emo rymap and dev i c ed r iv e rcha in asit app ea rs 

o n my Comp uA d d  386-B running DOS 4.0 w ith a 120 .MB ha rd d isk .

The  ab ove m ap was obta inedb yrunning the DO Sut i l i ty  MEM w ith the 

 / d e b ug sw itc h o p e ra b le .

THE RAW AND THE

COOKED

Before continuing weshould be aware that thereare two types of devicedrivers used by DOS: char-acter and block. They arefundamentally differentand it’s important that youunderstand that difference.

A device is defined asa character type if it is byteoriented. An examplewould be the typical printerport. All communicationbetween the system andthat device occurs on acharacter-by-character ba-sis with the I/O being de-fined as “cooked”or  “raw.”In the “cooked” mode, DOSrequests one character at a

time from the driver and

Aug ust/Sep tem be r 199 15 

Page 15: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 15/93

Page 16: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 16/93

Page 17: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 17/93

Page 18: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 18/93

Page 19: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 19/93

Page 20: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 20/93

Page 21: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 21/93

Page 22: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 22/93

Page 23: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 23/93

Page 24: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 24/93

Page 25: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 25/93

Page 26: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 26/93

Page 27: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 27/93

Page 28: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 28/93

Page 29: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 29/93

Page 30: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 30/93

Page 31: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 31/93

Page 32: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 32/93

Page 33: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 33/93

Page 34: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 34/93

Page 35: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 35/93

Page 36: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 36/93

Page 37: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 37/93

Page 38: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 38/93

Page 39: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 39/93

Page 40: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 40/93

Page 41: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 41/93

EMULATORS SIMULATORS

U?A

4 74HC64

Data Direction  Register Bit

WRITE

CONNECTIONS I/O  Port  _ 2 3

TO INTERNAL Bit (Latched)

DATA BUS 410

READ. 8

Data Direction  Register Bit

WRITE

CONNECTIONS __, I/O  Port 3TO INTERNAL Bit (Latched)

DATA BUS

Figure 4-The  use of an em ula to r ca n a lso m ask po ten t ia l signa l loa d ing p rob lem s.

B@@

 AT PC DOS’ or MS hDS’

PCF-1 l New Multi-Megabyte Disk Emulator l For diskless systems, solid-state reliability and speed

l Flash File System or battery-backed SRAM read/writetechnology for ISA bus operating under MS DOS.*

l Up to 7MB using 1MB   Flash or SRAM-up to 14MBusing 2MB Flash SlMMs

l I10   mapped-high performance-write Flash at hard

disk speeds-95Kb/sec  and erase 4MBllO  sec. Readand write SRAM at l/O  bus speed

l Single or Dual mode-to provide Autobooting andFlash File System or SRAM read/write

l PCF-1 with one 1 MB SIMM, $695 with one 1 MB SRAM,$995,1  MB Flash SlMMs 3961  MB SRAM SIMMs,  $495,2MB Flash SlMMs $695

l Other ROMDISK  models provide up to 1.44MBcapacity with autobooting in EPROM, Flash andSRAM technologies

CURTIS, INC.2837 North Fairview  Ave.*St. Paul, MN 55113

612/661-9512*Fax  612/631-9566* IBM  PC XT AT. PS/2  and PC WS  are trademarks of IBM MS WS  IS a trademark of M~crosnft

Reader setie +’

R ITEPROMEMUL TlONTEM

NEW41MEGABITVERSION

n Emulates up to 8   w   Accepts Intel Hex,4-Megabit EPROMS with Motorola S-Record

one control card. and Binary files.n Downloads 2-Megabit n Software availableprograms in less than for IBM PC and23 seconds. compatibles and

n Allows you to examineMacintosh systems.

and modify individual   w  Base 27256 EPROMbytes or blocks. System $395.00 Other 

configurations available.

ORDER TODAY--IT’S EASYCALL OR FAX FOR MORE INFORMATION

Incredible Technologies, Inc.(708) 437-2433(708) 437-2473 Fax

VISA now accepted.

Reader Se rv i ce 156

46 C IRCUIT CELLAR INK

Page 42: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 42/93

Page 43: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 43/93

EMULATORS & SIMULATORS

used interrupt for this purpose is the running too slow for the monitor pro-Software Interrupt (e.g., SWI).  Of gram to communicate quickly withcourse, if you use the software inter- the user. This can make a simple de-rupt for testing, this makes that in- bugging session drag on and on. Somestruction unavailable for the user pro- emulatorsget around this problem bygram. Thus, if your program uses the switching to a fast clock while run-software interrupt, the result will be a ning the monitor program regardlessbreakpoint instead of the intended of the speed of the clock used for the

effect. user program.When a breakpoint occurs, its as-

sociated interrupt may leave informa-tionon the user stack. Theonly   signifi-cant problem this poses is that theremust be room on the stack for thisadditional information. If no room isprovided, this information will writeover the previous important stack in-formation.

FINAL NOTES

This article has covered many ofthe special considerations involvedwhen using in-circuit emulators. Be-fore buying an ICE, be sure to find out

Breakpoints are useful and neces-sary, but regardless of their imple-mentation, they bring with them a fewproblems. All these problems occurbecause the real world doesn’t stopwhen the emulator stops the user’sprogram at a breakpoint.

While the emulator is running themonitor program, there can still beinterruptsgenerated by the target sys-tem. These interrupts may be ignoredand still be pending when the user’sprogram is continued, or they may beserviced by themonitor program witha dummy service routine. On 68xx

families, the built-in, free-runningtimer cannot be stopped, so it keepsticking while the monitor program isrunning. What often occurs after abreakpoint is the timer immediatelytimesout   and other interrupts want tobe serviced.

Cross-Assemblers from $50.00

Simulatorsfrom lOO.OO

Cross-Disassemblers from tOO.OO

Developer Packagesfrom 200.00(a   $50.00 Savings)

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

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

Simulators.Recover Lost Source!

Our line of disassemblers can help you re-create the original assemblylanguage source.

If you are emulating on a realtarget system, it is possible to haveconditions where a program must notbe stopped. This could include thesituation where one signal must fol-

low another after a short period oftime. If the program is stopped afterthe first signal but before the second,real damage could occur on a targetsystem. Determining and avoidingsuch dangerous breakpoints is the re-sponsibility of the user.

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

ProcessorsIntel 8048 RCA 1802,05 Intel 8051 Intel 8096,196kcMotorola 6800 Motorola 6801 Motorola 68HCllHitachi 6301 Motorola 6809 MOS Tech 6502

 c;&&32&;05

Rockwell 65CO2 Intel 8080,85 Zilog 280 NSC 800

Hitachi HD64180   Mot. 68k,8,10

NewZilog Z8 Zilog Super 8

l   All products require an IBM PC or compatible.

What happensif you want to emu-late a low clock frequency? This is areal issue with CMOS chips since theycan operate down to a DC clock. Theemulator will work just fine while it isrunning the user’s program, but it is

For Information Or To Order Call:

PseudoCorp716 Thimble Shoals Blvd, Su E

Newport News, VA 23606

(804)873-1947 FAX:(804)873-2154

40   ClRCUlT  CELLAR INK 

about its limitations. Armed with thisknowledge, you can choose an emula-tor that will work for your system, ordesign your system to work with thatemulator.

Keith Wentworth is a project engineer withThe Engineers Collaborative Inc. TECU.  Hehelped design and provides customer supportfor t h e c o m p a n y ’ s MC68HC05   a n dMC68HCll   in-circuit emulators.

IRS4 10 Very Useful411 Moderately Useful4 12 Not Useful

Reader   Service 191

Page 44: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 44/93

Page 45: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 45/93

Page 46: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 46/93

Page 47: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 47/93

EMULATORS & SIMULATORS

line is active, the 8031 puts all its busoutputs and controls in a high-imped-ance state. Thisgivcs the DDT51 Con-troller full Target System access with-out conflicts. In effect, the Controllerwiggles the WR, RD, and PSEN lines

 just as the 8031 CPU would, and theperipheral devices cannot tell the dif-ference (apart from the speed!).

Of course, resetting the CPU haltsthe 8031 program, so it is not a step tobe taken while debugging a program.Although the original IBM AT used adastardly trick involving hardwareresets and magic bytes in the key-board controller to switch the 80286CPU from protected to real mode, I

didn’t think this was a trick worthemulating in Son of DDT.

To load the Kernel code, the DDT-51 Controller activates the Target Sys-

tem Reset line  and transfers the Ker-nel code directly into the Debug andTarget RAM chips. When the Control-ler releases Reset, the CPU vectorsthrough the branch at address 0000 inTarget RAM to the Kernel code inDebug RAM. After that, Kernel mustfollow the software agreement to avoidcollisions with the DDT51 controller.

The 8031 can address 64K bytes ofprogram memory and 64K bytes ofdata memory, but the Son of DDTsystem combines these into a single64K  program/data memory. The rea-son should bc obvious from the pre-ceding discussion: the DDT51 Con-troller and Kernel code must bcable toread and write the user’s Target Pro-graminstructionsas”data”ratherthanas”program” values. Because the 8031has no way to write program instruc-tions (they are usually stored inEPROM!), the only practical methodis to treat them as data.

DELICATE HANDSHAKES

Any time you plan communica-tion between two computers (or twopeople!), you must first determine a“protocol” for the conversations. TheDDT51 Controller and the Kernelcode use just two bits to negotiate aconversation through the DebugRAM, ensuring that only one side ac-cesses the RAM at a time.

The DDT-51 Controller can cause(or at least request) an 8031 interruptby activating the INTl line; the bit is

EOOO

coo0

A000

8000

6000

Standard RTCI/O  Device Address Range

Unused

Debug RAMon DDT-51

Board

Unused

Target RAM

8K or 32K

on Target

Svstem Board

k:

A400-A7FFA300-A3FFA200-A2FF

EAlOO-AlFF

L\  AOOO-AOFF

Kernel codeRead-only seg tableExternal RAM buffer Internal RAM buffer Kernel variables

Target Program startsReserved for KernelInt 1 vector Reset vector 

Figure2-7he Ta rge tSyste m  CPUsee  the Ta rge tRAM a nd Deb ugRAMa sa norma lp a r t o f

i ts ad dressspa c e. How eve r, logic on t he DDT-5 I boa rda l l ows the DDT-5 Co ntroller to rea d 

a nd  w rite the Debug RAM.

called IRQBIT by the Kernel code.When the Kernel responds to the in-terrupt,itactivatestheTOoutput(a.k.a.HALTBIT to indicate that the TargetProgram is no longer running. Thatexchange marks the start of a conver-sation between the two.

Figure 3a shows what happenswhen IRQBIT goes active when theTarget Program is running. The Ker-nel interrupt handler copies the 8031CPU’s internal state into Debug RAM,updates some status variables, andasserts~~~~~IT.TheControllerwaitsfor HALTBIT  to become active, thenextracts the values from Debug RAM.

 Just as the Controller cannot ac-cess Debug RAM data while the Ker-nel is active, Kernel code must stayout of the Controller’s way. Becausethe hardware overlaps Program andExternal Data spaces, the Kernel can-not even execute instructions fromDebug RAM! The need for the “Re-served for Kernel” block in Figure 2should now be apparent: the Kernelcode spins in a tight loop while wait-ing for the Controller to finish access-ing the Debug RAM.

The whole point of stopping theTarget Program is to get the CPU’sstate to the PC via the DDT-51 Con-troller. The user (you!) can then up-

date the values shown on the PC’sscreen and restart the Target Program.The SONOFDDT program sends thenew values to the Controller, whichwrites them into Debug RAM and setsa control value indicating that Kernelshould resume running the TargetProgram.

Figure3b  shows this program startsequence. When IRQBIT goes inac-tive Kernel emerges from the TargetRAM spin loop, restores the CPU state

from theDebugRAM,clears~~~~~~~,and passes control to the Target Pro-gram by executing a normal “ReturnFrom Interrupt” instruction.

As described above, the DDT51Controller cannot read or write theTarget RAM (addresses OOOO-7FFF),

nor I/O   devices (addresses EOOO-

FFFF),  because the 8031 controls thebus lines. Therefore the Kernel mustcopy data from the those sections ofthe 8031’s address space into Debug

RAM and copy changed values back,

52   ClRCUlT C ELLAR NK

Page 48: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 48/93

Page 49: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 49/93

Page 50: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 50/93

Page 51: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 51/93

Page 52: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 52/93

read-only segment boundaries in De-bug RAM.

 Just before Kernel passes controlto the Target Program, it computes achecksum for each read-only segment.Whenever it regains control, itchecksums the segments again. TheController compares the two values

and reports an error for any mis-matches. In principle, a running pro-gram should never modify its code, soany changes indicate a bad pointer orrunaway code.

This is particularly valuable insingle-step mode, where you learn ofthe damage right after offending in-struction. While Son of DDT can’t pre-vent code damage, immediate detec-tion tracks down program bugs thatwould otherwise remain invisible.

If your linker doesn’t produce asymbol table file in the Avocet format,you can write a filter program (usingyour favorite PC language) to convertyour SYM files. If that isn’t practical,you can use a time-honored trick: putall your variables at fixed locationsand createa  SYM file describing them.

  E M U L A T O R S & S I M U L A T O R S

Unless you can force your subrou- D EC LAR E W AR O N BU G S

tines to fixed locations, you won’t beable to refer to them by name, but it’s Although Son of DDT has many

surely better than nothing. Figure 4 more features than the original paral-

shows a sample SYM file. lel DDT51, the best way to find out

Photo J-The Son of DO Tsoftw a re  d isp lays every th ing ab out the ta rge tp roc essor on o ne 

ea sy- to - rea d sc reen .

FOR EMBEDDED DATA AQUISITION

AND CONTROL APPLICATIONSEMAC OFFERS A COMPLETE LINE OF INDUSTRIAL STRENGTHSlNGLEBOARDCOMPUTERSANDSUPPORTPERIPHERALS,WlTHALLTHE  FEATURES NECESSARY TO PROVIDEYOU WITHATOTALSYSTEM SOLUTION ! FEATURES INCLUDE:

l DlGrrAL   AND ANALOG I/O

l TIMER/COUNTERS

l RS232/422   SERIAL PORTS

l DISPLAY BOARDSl TERMINAL BOARDS

l SIGNAL CONDITIONING CARDS

l EMBEDDED FORTH 8  BASIC LANGUAGES

l PRICES START AT $249.00 QTY  1

EVilAt ,  inc.EOUIPMENT   MO N I T O R A N D C O N T R O L

618-529-4525‘.O. BOX 2042 CARBONDALE, IL 62902

YOUR WINDOWTO EMULATIONPRODUCTIVITYw Easy to learn &  use

n Windowed interface --user configurable

n FAST! Download--

m  SourceL e debug

n A 4K frame trace buffer with advanced searching capabilities.

n Hyperlinked On-line help guides you throughtheemulationprocess.

n iceMASTER connects eosily toslots. Works onany PC(DOSor 0r

our PC, requires nodisassembly, or expansion/2 ,McroChanne  or ESA Evenlaptops!

n Supports more t han 50 different 8051 family derivatives. M68HClsupportwill beavailobleearly in1991.

n Try iceMASTER  riskfree! SotisfoctionGuaranteedor returnfor ofull refund!*

n RENTALSAVAILABLE! Ideal for consultants andresearchers!

n Call today for free demo disk and ask about a free

8051   MacroAssemMer (800)   6 3 8 - 2 4 2 3

Metoti nk  orpartin   PO Box  1329 [handler by  85244-1329

Phone 1602 9260797 1bt   1602 926-1198 TElEt   4998050Ml NK

  Wi i I Odoy m   perfad

ReaderSewce 43ReaderServi ce 169

Page 53: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 53/93

EMULATORS 81 SIMULATORS

what it can do for you is to download

the SONOFDDT demo. The demo ver-sion of the program provides all the“look and feel” of the real program

 but doesn’t require the Son of DDThardware. While you can’t debug a

 program, you can get a good feel for how the user interface works on your 

system.fEdifor’s  Note:Soffwarefor  thisarticle is available on the Circuit Cellar BBS on Software On Disk 22.   See

 page 106 for downloading and orderinginformation.]

A parallel port version of the newSonof  DDT software, compatible withthe original parallel port connectedDDT51, will be available in Septem-

 ber as an upgrade.Finally, in the spirit of Steve’s

original DDT-51 design and other 

Ciarcia’s Circuit Cellar projects, Cir-cuit Cellar will provide full-functionsoftware to anyone who builds Son of DDT hardware from scratch. Therewill be a nominal charge for materialsand shipping. Realize of course, that“from scratch” means just that: Con-necting purchased RTC31 and DDT-

51 printed circuit boards does notqualify. Instead, you’ll have to buildthe original DDT51 as described bySteve in volume 7 of “Ciarcia’s CircuitCellar” and the RTC31 in CIRCUIT CEL-

LAR INK issue 8.  Send pictures of your finished assembly to Steve at theaddress below and join our war on

 bugs.

Ed Nisky   is a Registered Professional Engi-neer and a member of the  Circuit Cellar INK engineering staff. He enjoys finding innova-

tivesolutions todetnandingand unusual tech-nical problems

IRS4 13 Very Useful414 Moderately Useful

415 Not Useful

SOURCE

Circuit Cellar Kits4 Park St., Suite 12Vernon, CT 06066(203) 875-2751Fax: (203) 872-2204

1. Son of DDT assembled and tested in a 5.5” x ”  x 1.5” metal enclosure with power supply and target RTC31 controller mounted on top surface. Comes

with user’s manual and software on disk. System functions on any PC or ATclone with 64OK,  serial port, and any standard display. . . . . . . . . . . . .  499

2. Son of DDT software upgrade for use on original parallel port connectedDDT51. Available in September ‘91. Comes with user’s manual and dis-ke t t e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $150

Items above do not include shipping and handling. Please call for appropriate costs.

DIGITAL DESIGNERS

MINIMIZE YOUR LOGIC

KARNAUGH MAP SOLVER FOR PC’sMinimum Gates from Your Specs

l Combinational, Sequentiall Mealy & Moore State Machinesl 2 to14 Inputs, Any Number Outputsl Sum of Products, Product of Sumsl JK, D,  SR, and T Flip Flopsl Expert Reference and Tutoriall 60 Day Money Back Guaranteel MUCH MORE

SAVE 40% :  1  I + 5(P W

Reader Service  49

EC151 y BASIC cross compiler l integer math with 4 integer data types l arrays of any length l print, print pwm, evenon a plain 8031 l call a compiled program from BASIC-52,pass values back & forth l in-line assembly l blazing speedl exceptional suppotf  l with assembler utilities $299

Systronix Inc.754 East Roosevelt AvenueSalt Lake City, UT 84105

801-487-7412 FAX: 801-487-3130

ReoderSeki ce 201

 August/September 199 1 59

Page 54: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 54/93

FEATUREARTICLEEdu ardo  P6rez

  Dapa ng Chen 

Numerical ApplicationsUsing DSPUsing a DSP Chip fo r Hig h-Sp eed Num e ric Pro c e ssing 

H istorica lly,  discrete-time domain or DSP algorithms have closely tracked

the development of digital computer technology. Before the 196Os,  the

technology for signal processing was mostly analog. Electronic circuits and

even mechanical devices processed signals in the continuous-time domain,

The introduction of digital computers in the 1950s brought signal processing

into the digital domain. The limited computational capabilities of the early

digital computers restricted their use to numerical computations and some

simulation of analog systems. Computers were treated as speedy calculators.

Hardware aside, lack of DSP theory also made the use of digital computers for

DSP operations difficult at best.

be solved by numerical approxima-tions. Finite element analysis is an-

other largebranch of discrete-timedo-main applications that is extremelyimportant to the study of aerodynam-ics. These types of applications usu-ally involve a set of grid points onwhich the evaluations are made. Thegrid points must often be denseenough to avoid irregular behaviorsbetween them. A denser set of gridpoints means more points to be evalu-ated, which slowsdown thecomputa-tion. Often computational complexity

is proportional to the number of points:O(N), O(N2),  or even O(NN).  Controlapplications often require matrix op-erations to solve a system equationand to determine the stability of thecontrol system. DSP and numericalapplications often require floating-point processing for accuracy, preci-sion, and dynamic range. In the past,software performed floating-pointnumber operations, a very slow pro-cess in computationally intense algo-

rithms. Dedicated floating-point pro-

The discovery of the fast Fouriertransform (FFT)   by Cooley and Tukey

in 1965 toimplement thediscrete-timeFourier transform (DFT)  was a quan-tum leap in DSP technology. It re-duced the computation time of theT   from O(N2)  to O(N   x Log,(N)),

making DFT spectrum analysis

algorithmalsopromoteddevelopmentof special hardware dedicated for theFFI’. Most importantly, the new FFTinspired development of a completetheory of discrete-time mathematics.

The FFT  is not a simple approxima-tion or simulation to an analog systembut is exact in the discrete-time do-main. The FFT  has become a key com-ponent of spectral analysis, and FFT-related algorithms have been studiedand used extensively.

In addition to discrete-time do-main spectral analysis, many otherapplications are in the discrete do-main by nature. For instance, manydifferentialequationsand integrations

are not analytically solvable and must

60   C l X / T CELLAR INK 

cessing hardware was expensive andnot readily available.

Hardware technology, especiallyVLSI technology of recent years, hasmade the floating-point processor af-fordable and available. A floating-point processor is often called a mathcoprocessor. The instruction set of thecoprocessor includesmany frequentlyusedfloating-pointinstructions,arith-metic operations, transcendental op-erations, and logarithmic operations.Usually, the math coprocessor is de-signed as an integral part of a com-

puter system. The instruction set of-ten becomes part of the computer’sinstruction set and can be directly con-trolled and programmed from theCPU. The interface and communica-tions between the CPU and a mathcoprocessor are very simple to a pro-grammer. High-level language usersneed not be concerned about the exist-ence of the math coprocessor. By us-ing the math coprocessor, however,floating-point computational time is

reduced by orders of magnitude.

Page 55: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 55/93

DSP hardware is quite differentfrom the math coprocessor. The chipis independent of the host computerand can be built as a stand-alone sys-tem. DSP hardware, such as the TexasInstruments (TI)  TMS32OCxO   series, isdesigned to maximize certain mathoperations (such as parallel multiplyand add) commonly used in spectralanalysis and numerical applications.Most DSP chips can complete any in-struction in one instruction cycle, in-cluding the floating-point multiplica-tion and addition made possible byspecial floating-point hardware. Tokeep everything in one cycle, how-ever, DSP chip instructions do notcontain many floating-point instruc-tions. For instance, the floating-pointdivision instruction does not exist inthe instruction set of most DSP chips.

The instruction is implemented viasoftware. This strategy is true for alltranscendental and logarithmic opera-tions and is very similar to the re-duced instruction set computer (RISC)where a smaller core set of instruc-tions is optimized at the expense ofotherlessfrequentlyusedinstructions.In addition, DSP chips are capable ofsome special addressing modesunique to FFT  applications such asbit-reverse addressing and circular

addressing. DSPchipscanalso  handleDMA data transfer and interrupt han-

dling. Therefore, DSP hardware is not just a simple improvement of the mathcoprocessor; it is a unique hardwarearchitecture suitable for spectral analy-sis and other numerical applications.In the following sections, the hard-ware and software features of DSPchips are briefly introduced and ap-plication examples are discussed.

FEATURES OF DSP HARDWAREAND SOFTWARE

Dedicated Floating-Point Hardwareand Parallel Instructions

The dedicated hardware multi-plier provides the bulk of a DSP’sprocessing power. A floating-pointmultiplication is executed in a singleinstruction cycle. In addition to fastfloating-point multiplication, in-

creased performance is achieved byparallel instructions. Typically,a mul-tiplication and addition can be ex-ecuted in parallel in one instructioncycle. For example, the following96002instruction can execute three floatingoperations in one instruction cycle:

FMPYXO,Xl,DlFADDSUB.XD3,D.Z

Theinstructionmultipliesthecontentsof X0 and Xl and stores the result in

Dl,  adds D3 and D2 and stores theresult in D2, and subtracts D2 from D3

SamplesA

samp  es

IDetected  Pulsed

Recei ver   Butterworth

LowPass

Figure 2--This graph ica l pu lse de mo examp le wa s de ve loped wi th La bVIEW

National Instruments.

2 from 

x0W01x_lW '

Figure 1 -  FFT b u t t e m y  signa l diag ram.

and stores the result in D3 in parallel.This instruction is very efficient forFFT  butterflies, as shown in Figure 1.

PipeliningPipelining is common to all DSP

chips. A pipeline architecture breaks acomputation into separate stages forinstruction fetch, decode, operandfetch, and execution. While one in-struction is being executed, the re-

maining instructions can be fetchedand decoded. Pipelining is automaticwhenever possible. When standardbranch instructions are encountered,the prefetched instructionsin thepipe-line are no longer valid, and the pipe-line is flushed. Some DSP chips nor-mally have delayed branch instruc-tions that do not require flushing thepipeline.

Special Addressing and Zero-Over-

head LoopDSP chips also have many special

instructions that are useful to carryout the FFT  and digital convolutionoperations. For instance, the follow-ing TI TMS32OC30   instructions imple-ment a loo-tap dot product. One tap isthe accumulation of one multiplica-tion:

LDI   @A,ARO ; addr. of h

LDI   @X,AR~ ; addr. of x

LDF   O.O,RO

  first product

MPYF3 *ARO+t(l),*ARl+t(l),Rl

RPTS 98 ; rep. 99 times

MPYF3 *ARO++(l),*ARltt(l),Rl

I  ADDF3 Rl,RO,RO ; accum. result

ADDF3 Rl,RO,RO  ; final accum.

There are two features in theseinstructions: zero-overhead loop, andparallel multiplication and accumu-

lation. Zero-overhead loop means that

Aug ust/Sep tem be r I99 I 6 1 

Page 56: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 56/93

there is no penalty for RPTS when it isset up (three cycles for setup). Theparallel instruction ”  ”  means thatboth MPYF3 and ADDF3 can be ex-

ecuted in the same instruction cycle.

Fast and Parallel Memory andPeripheral Access

DSP chips such as the TI  chip have separate pro-gram buses, data buses, and DMAbuses for parallel program fetches,data reads and writes, and DMA op-erations. Many DSI’ instructions canaccess two memory operands at thesame time, providing an excellent plat-form for complex operations such asthe complex FIT.   An on-chip DMA

ment between the DSP chip and theexternal peripherals, which are usu-

ally much slower than the DSP chip.Many add-on DSP boards, such as theNB-DSP2300 from National Instru-ments shown in Photo 1, also providean additional on-board DMA control-ler for convenient data transfer.

DSP SOFTWARE DEVELOPMENT

The hardware features of DSPchips make them quite attractive for avariety of applications. They are fast,

flexible, and economical. But, hard-ware without software is hardly use-ful, and is especially true for DSP sys-tems. To fully use the computationalpower of a DSP chip, software must bewritten to take advantage of the archi-tecture and addressing modes of theDSP. Naturally, this places a higherrequirement on the DSP programmer.

To simplify software develop-ment, most DSP chip manufacturers

  softwaredevelopment tools:

a high-level language, assembler,linker, debugger, and simulator. Thehigh-level language is a convenient,quick, and efficient way to begin de-velopment. In this case, much of theexisting software can be easily portedonto a DSP platform, saving develop-ment time. With the assembler, theuser can have complete control overthe DSP hardware for the best pos-sible performance, which is necessaryformanytimingandinterrupt-relatedtasks. The simulator provides a good

62   C lRCUlT C ELLAR INK 

testing environment. Before runninga program on the hardware, the usercan test it using the simulator to makesure that all the requirements are met.

The current trend is to provide agraphical user interface not only todevelop numerical analysis and DSP-based applications quickly and effi-

ciently but also to be able to directlyinteract with the system itself as is thecase of LabVIEW,  a graphical DSP

software development system. Anexample appears in Figure 2 wherethe user interaction is through front-panel controls and the actual programis a block diagram.

NUMERICAL ANALYSIS ANDDIGITAL SIGNAL PROCESSING

Numerical analysis is the branchof mathematics concerned with the

Siana l:  x(t)

Probability Density

Probability Distribution

Figure &Computed Prob a bility Dens i t y  and Distribu tion func tions of Q  Ga ussian d istrib- 

uted noise signal.

Page 57: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 57/93

Page 58: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 58/93

Page 59: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 59/93

Page 60: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 60/93

Page 61: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 61/93

Page 62: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 62/93

Page 63: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 63/93

Page 64: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 64/93

DEPARTMENTS

I I

141ww  74 

Firmware Furnace

kdpaw  8

From the Bench

Hpage 88

Silicon Update

Practical Algorithms

  i lpage   104

ConnecTime

Toolmaker’s Toolworks

We humans are tool users.While other animals may fiddle withsticks or rocks, we alone regard amuffler repair and oil change as nor-mal weekend activities.

However, brute forcerules theday

in the engineering workplace, as manybeasts (uh, engineers) continue to dotheir PC tasks manually. Their excuseis that it takes too much effort to find,write, or build the right tool for the

 job. While the PC itself is a tool, thereare ways to simplify common tasksthat don’t require a lot of effort.

What prompted this column is aconversation 1 had with an engineer atan IEEE meeting. We were talkingabout bulletin board systems and Imentioned the “robot typist” scriptsthat automate my BBS message han-dling. He was intrigued that such athing could be done.. .

Although I will concentrate onscripts for serial communication, youcan apply similar tricks to nearly anyrepetitive task. In effect, you create arobot to do yourbidding without hav-ing to bend any metal.

 YOUR FIRST SCRIPT...

The 8052 is a good starting pointas many of you have struggled withthe BASIC-52 interpreter. AlthoughBASIC-52 includesa rudimentary edi-tor, retyping an entire line to replaceone character gets old quickly. Whatyou really want is to edit the programusingyourfavoriteeditor, thendown-load the whole smash. Show of hands:how many people do just that?

While it is easy enough to put theprogram into an ASCII text file, auto-

matically sending that file to the 8052

is oddly difficult. BASIC-52 parseseach line into an internal format afteryou press Enter, then displays the fa-miliar “>”   prompt when it is ready forthe next line. The delay can range

Ma ny e ng ineers 

c o n f i n u e  o  d o fhe if 

PC tasks m anua lly .

The ir e xc use is fha f if 

fak es foo m uc h 

e ffo ff fo find , wr i te

o r b ui ld fhe rig hf fo o l 

for fhe job .

from milliseconds to seconds, but,because there is no input buffer, youcannot send the next line until theinterpreter is ready.

Theobvious solution is to wait forthe prompt character. Show of handsagain: how many of you have fired upProcomm, changed the Pace Charac-ter to ASCII 62 ‘3’9,  sent the file

using ASCII transfer, and found itdidn’t work? Thought so. Unfortu-nately, ASCII 62 can appear within theprogram line as the “greater than”operator, as part of the “not equal to”token, and in REM comments. BecauseBASIC52echoeseachcharacterasyou

type, Procomm (and most other ter-minal emulators) react to any”>” char-acter within the line without waitingfor the real prompt on the next line.

The next best solution is to delay

for a fixed interval after each carriage

Page 65: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 65/93

Page 66: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 66/93

Page 67: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 67/93

Page 68: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 68/93

Page 69: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 69/93

the programs run without memorylimitations and multitask quite nicelywhile you are doing something else.But you surely don’t need OS/2 to getuseful work done.

BBS ROBOTICS

Anyone who makes a long-dis-tance call to a BBS knows that “thinktime” is best done off-line. Answeringa question may take some research,but minutes are precious when thephone is off-hook. You should down-load all the messages, hang up andreply to them while the clock isstopped, then call again to upload yourreplies. Because the BBS is (presum-ably) automated, there is little reasonfor you to interact with it: let tworobots do the talking.

call   w  attr   w, i t em+l , 2, fnwide, whigh_end

endwhen key = down then do

if item < fnumthen do

call w attr w, 2, fnwide, wnormitem =-item t 1

itemtl,

call w attr w,end -

itemtl, 2, fnwide, whiqh

endwhen key = enter then do

leaveend

when key = esc then doleave

endotherwise nap

end

end

call w close w_

if key = escthen do

'emsg   *** Transfer cancelled'signal halt

end

/* remember for next time */address dos   'qlobalv   setlp   lastbas'   fname.item

fname.item   =  space(fname.item,D) /* strip blanks */fspec = curdisk   /  I  curdir I  I ‘\ ’ I/  fname.item'message File spec  is' fspec

CC< continue with Listing 3 >>>

The two most complex scripts I’vewritten automate the mechanics ofworking with the Circuit Cellar BBS.A REXXTERM script handles dialing,downloads new messages, and up-loads replies. A KEDIT macro parses   Listing  4-cohehuadthe downloaded message file and re-

Aug ust /Sep tem be r 199 1 79

Page 70: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 70/93

duces  replying to a message a matterof a single keystroke. All I have to dois type the text.. .that’s not automatedyet!

Lack of room prevents me fromlisting the script here, but the wholething is available to download fromthe BBS. Imagine: the call you make to

download the file may be the lastmanual call to the Circuit Cellar BBSyou’ll ever have to make.

WRAPPING UP

You can avoid writing tools bybuying them from commercial sup-pliers. For example, the Basikit pro-gram available from MDL Labshandles BASIC-52 interfacing quitenicely (and with many more features

than my scripts!), while TAPCIS auto-mates dial-up access to CompuServe(if not the CCBBS).   The key point is

SOURCES

Datastorm TechnologiesP.O. Box 1471Columbia, MO 65205(314)  443-3282

MansfieldSoftwareGroupP.O. Box 532Storrs, CT 06268(203)   4298402

Quercus SystemsP.O. Box 2157Saratoga, CA 95070(408)  257-3697

MDL Labs15 Deerfield Rd.Chappaqua, NY 10514(914)   2380416

that you can get better and faster re-sults by letting the computer handlerepetitive chores and using your timefor more productive tasks.

The BBS files for this column in-clude the full source code for the scriptsI’ve discussed here. The Procommscripts require Procomm Plus 2.0 and

the REXX scripts run under MansfieldSoftware’s REXX with either REXX-TERM or KEDIT. Even if you haveanother con-u-n program and editor(quite likely.. . ), the code should giveyoua  startingpoint foryourown tools.

OK, I admit that muffler weldingis more exciting. But tedious typing ismuch less interesting-and quite un-necessary. Write a tool today! a

Ed Nisley is a Registered Professional Engi-neer and a member of the Circuit Cellar INK 

engineering staff. He specializes in findinginnovative solutions to demanding and un-usual technical problems

IRS4 19 Very Useful420 Moderately Useful421 Not Useful

*TEXT EDITOR, CROSS ASSEMBLER, ANDCOMMUNICATIONS FACILITY IN A COMPLETEINTEGRATED DEVELOPMENT ENVIRONMENT

l MACROSl

CONDITIONAL ASSYl LOCAUAUTO LABELSl SYMBOL TABLE CROSS REF

us p 95

l S OR HEX FILE OUTPUT DOWNLOADS pLus  S’H*TO MOST EPROM PROGRAMMERS

 AVAILABLE FOR MOST 8-BIT MICROPROCES-SORS AND 68000/010.   CALL OR WRITE FORTECHNICAL BULLETIN. 30 DAY MONEY BACKGUARANTEE. MC/V/AE.

*  PER SHIPMENT:$5 CONTIGUOUS USA$10 CANADA AK. HI

Micro Dialects, Inc.DEPT. C, PO BOX 30014CINCINNATI, OH 45230

$20 INTEiNATldNAL (513) 271-9100

8 0   ClRCUlT CELLAR INK 

Reader Service Y 172

. .

\  ’  /

-QSunset Laboratory   Advanced Interface Board

12-bit  ADC (9 microsec), 12-bit DAC (second optional).Eight analog inputs, 6 software selectablevoltage ranges.Digital Input/Output, 16 programmable lines. Lockingconnector cables include power for outside circuits.Cables, manual and disk includes operating programsand examples.

APPLE II AIB-II IBM Compatibles AIB-PC

lOO,OOO/sec  with GS. Up to 90,OOOkec   with fast CPU.

Operates on II Plus, Operates on XT, AT and o ther ISA.Ile,  and IIGS.   Includes Half-size card fits portables.three 16-bit   Timers.

$260 .00

Sunset Laboratory 9  (503) 357-51512017 19th Ave., Forest Grove, OR 97116

Reader Service XZWJ

Page 71: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 71/93

?educingsower ConsumptionBre a th ing New Life In to Da ta Lo g g ing 

CL

R ecycle”   and “conservation”

FROMTHE

BENCHJeff achiochi I

I

are two of the 2bth century’s latest buzzwords. We all are becoming increasinglyaware of our dwindling resources and ”growing waste problem. It kills me whenan appliance is ditched because it’scheaper to buy a new one than to repair

the old one. If you take your IBM back tothe dealer, chances are the whole

MO”motherboard will be replaced. Few repairshops can or will do component-leveltroubleshooting and replacement.

 J he po we r c on t ro l module is small enough to sit on f o p of a 9-V batfery c lip .

It seems to me price should reflect notonly the cost of raw parts and labor, butalso the cost of disposal. An example ofthis is the “return deposit” on carbonated

higher costs for goods sold. If we all haveto pay more, it then makes financial sense

to fix and not discard.Our energy dependence on both for-

eign and domestic oil will continue until a viable altema-tive is discovered. TI’s  latest breakthrough in solar celltechnology demonstrates the United States has the capa-bility of leading the world in finding new and renewablesources of energy. Meanwhile, brownout alerts are pre-dicted each summer when we crank up our air condition-ers. Conservation is presently our only hope. So, we sweata little, carpool   when possible, quit watering the lawn, andrecycle metal, glass, plastic, and paper.

SOMETHING’S UP, BESIDES THE UTILITY BILL

My house is one of seven served by a “communitywell.” The well’s pump is located about 200 feet belowground and fills a 375-gallon storage tank with cold cleanwater. The energy cost for pumping the precious liquidaverages about $300 a year ( 25/monthl. That divides toabout $50 a year per household. Not too shabby as long asrepairs or maintenance are not needed.

Cindy, the designated treasurer and receiver/payerofthe electric bill, stopped by the other day to chat. It seemshe bills were increasing by leaps and bounds, topping

over $60 for the last month. We had a mystery here. Either

someone was drinking an awful lot of water, or the systemhad problems. Was the usage one of high demand duringcertain parts of the day or was it a constant increase. Thisis a job for “Data Logger”!

A quick inspection of the well house (pit is moreappropriate) revealed a minimum of useful information.One, there were no leaks here and two, the only wiringaccessible were the wires running down the well casing tothe motor below. This means no power available, exceptwhen the pump is on. Hmm. I need to log pump usage with

a battery-powered logger.

HOW LOW CAN YOU GO?

 You may remember a project I presented a couple ofyears ago: the RTC52. This small, 80C52-based

microcontroller used a built-in BASIC interpreter whichreally made development a snap. It actually took longerfor me to find my prototype than it did to write the smallBASIC program needed to log pump usage (see Listing 1).

Using a simple optoisolator with bipolar LEDs  likethe NEC 2505-1, I could monitor the AC power going to thepump. A series47k   resistor limits the LED current to a few

AugusWep t em be r 99  I 8 1

Page 72: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 72/93

milliamperes. A pull-up resistor on the open-collectoroutput of the isolator will be pulled low whenever AC ispresent (which means the pump motor is running). Thepull-up, along with a capacitor on the open-collector out-put, will filter out and prevent the AC zero crossings fromaccidentally being sampled-which would be interpretedas a “pump-off” indication-by smoothing the AC signal.

Let’s see. A simple linear regulator on a 9-volt batterywill give the controller the necessary 5 volts. A quick checkwith the current meter shows about 150 mA  of current isnecessary. Whoa! A 9-volt battery only has 550 mAH ofuseful life. Three hours of logging is useless.

THROW OUT ANYTHING NOT TIED DOWN,WE’RE SINKING FAST

Time to whittle down the load. About 50% of thesupply current can be saved just by substituting HC partswhere available and removing the unnecessary ones(MAX232 and the like). A 50% reduction isn’t going to beenough. The CMOS version of the microcontroller has an

additional feature over the standard NMOS version: PDand IDLE (power-down) modes. These modes conservepower by shutting down the internal oscillator. (Note: TheMatra-Harris part has static registers and can be operatedwith an external clock down to 0 Hz. This is different thaninternally disabling the clock, which is what power-downdoes.) Once in the idle mode, only an interrupt or acomplete reset can release it again. A reset is the only actionwhich will revive the controller from the PD mode. Asavings of about 15 mA   is possible by using one of thepower down modes. Since CMOS uses more power themore often it switches (the faster the clock speed), slowing

down the clock will also save the same 15 mA.  With all thepower-saving devices employed, the consumption is stillaround 25 mA for the whole system. That’s still less thanone day on a 9-volt battery. Harumph.

Steve tackled some of these same issues in his article“Build a Low-Power Data Logger” in issue 15  of CIRCUIT

CELLAR INK. If you haven’t read it, shame! If you have, thenyou probably know that by shutting the power downcompletely, a great deal of current can be saved. Well, atleast while you’re waiting for your next sample.

TIMEBASE-POWER CONTROL-LOGGER

This data logging system is made from three parts. The“Timebase” which produces an accurate stream of triggerpulses equal to the rate at which you wish to sample yourdata. The second part, the “Power Control,” turns on thepower supply at each timed trigger pulse. Finally the“Logger,” which samples and records the digital or analogdata, and upon completion of its task, signals the PowerControl to turn off the power until the next trigger pulse.

The RTC52 has the ability to run a program on power-up. In this case, it should sample the water pump’s stateand, if it has changed, record the time of the change, then

signal the Power Control that it’s done. See Figure 1.

10 REM PORT1.O = LOGGED INPUT (O=ON l=OFF)20 REM PORT1.l = POWER CONTROL OUTPUT (FALLING

EDGE = TURN OFF)30 REM PORT1.7 = PRINTOUT FLAG INPUT BIT (0 =

PRINTOUT ROUTINE)40 REM50 REM UPON PROGRAM AUTOSTART, CHECK FOR

PRINTOUT FLAG60 TP=TPtl : GOT0 24070 REM80 REM IF NOT, LET'S SEE IF FIRST TIME AROUND,

CHECK LOGGING ID90 IF (XBY(MTOP+1)=55H.AND.XBY(MTOPt2)=0AAH)

THEN GOT0 370

100 REM110 REM FIRST TIME AROUND, LET'S SET UP MEMORY120 REM WRITE LOGGING ID130 XBY(MTOPt1)=55H  : XBY(MTOPt2)=OAAH140 REM150 REM TWO BYTES FOR STATUS STUFF160 REM (PRESENTLY USING ONLY LS BIT TO HOLD

LAST ON/OFF STATE);;; ;;;(MTOPt7)=0  : XBY(MTOPt8)=0

190 REM SET TP AS POINTER FOR NEXT LOGGINGTABLE ENTRY

200 REM SAVE TP AT MTOPt3&4210 TP=MTOPt9  : 0=3  : GOSUB 320220 REM230 REM TEST FOR END OF RAM240 XBY(TP)=O : IF XBY TP)OO  THEN GOT0 280250 XBY(TP)=OFFH : IF XBY(TP)<>OFFH  THEN 280260 REM270 REM NOW PAST TOP OF RAM, SAVE TP-1 AT

MTOPt5&6280 TP-1 : 0=5 : GOSUB 320 : GOT0 370290 REM300 REM SAVE ADDRESS ROUTINE310 REM USES '0' AS AN OFFSET TO MTOP, SETS

PRESENT VALUE OF TP320 XBY(MTOP+O)=INT(TP/256)330 XBY(MTOPtOtl)=TP-(INT(TP/256)*256)  : RETURN340 REM350 REM LOGGING ROUTINE360 REM FIRST GET OLD (LAST) STATE OF INPUT370 OS=(XBMTOPt7).AND.OlH)380 REM390 REM SECOND, READ INPUT BIT FOR NEW STATE400 NS=(PORTl.AND.OlH)410 REM420 REM IF THE SAME, THEN LET'S GET OUT OF HERE

430 IF OS=NS THEN 730440 REM450 REM IF DIFFERENT SAVE THE NEW STATE460 XBY(MTOPt7)=NS470 REM480 REM GET LOGGING TABLE'S NEXT ENTRY AND END

OF RAM POINTERS490 TP=XBY(MTOP+3)*256+XBY(MTOP+4)500 TE=XBY(MTOP+5)*256tXBY(MTOPt6)510 REM520 REM READ THE REAL-TIME CLOCK REGISTERS FOR

DAY/HR/MIN/SEC530 FOR X=7 TO 0 STEP -1540 XBY(TP)=XBY(OEO3OHtX)550 TP=TPtl560 REM570 REM WHILE LOGGING INFO CHECK FOR END OF RAM580 IF TP=TE THEN GOT0 730

590 NEXT X600 REM610 REM NOW SAVE THE CURRENT INPUT STATE620 XBY(TP)=NS630 TP=TPtl640 REM650 REM CHECK AGAIN FOR END OF RAM660 IF TP=TE THEN GOT0 730670 REM680 REM IF NOT AT THE END OF RAM YET,690 REM SAVE THE LOGGING TABLE'S NEW NEXT ENTRY

POINTER700 0=3 : GOSUB  320710 REM720 REM NOW SHUT THIS SYSTEM DOWN730 PORTl=PORTl.AND.OFDH ( c o n t i n w @

listing 1 -C om piled BASIC wa s fast enough to hand le the deed 

82   ClRCUT CELLAR INK

Page 73: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 73/93

740 STOP : REM SHOULDN'T EVER GET HERE750 REM760 REM PRINTOUT ROUTINE770 REM GET FIRST ENTRY AND LAST ENTRY POINTERS780 TS=MTOPt9790 TP=XBY(MTOPt3)*256+XBY(MTOP+4)800 REM810 REM LOOP AND PRINT OUT ALL 9 BYTE ENTRIES820 FOR X=TS TO TP STEP 9830 PRINT XBY(X)*lO  + XBY(Xtl), - ,XBY(Xt2)*10

t XBY(X+3). : .840 PRINT XBY(X;4)*iO  t XBY(X+5), : ,XBXt6)*10

tXBY(Xt7). - .850 IF >;~YtxtSj=o  THEN  PRIN T "ON" ELSE PRINT

"OFF"860 NEXT X870 REM880 REM EXIT890 GOT0 730

isting  1 - c o n t i n u e d  

one-shot, used as a flip-flop with edge-triggered set andreset inputs, and a couple of transistors for level shifting,and you’ve got a neat little triggerable power controller.See Figure 2.

AND NOW FOR THE CHARTS AND GRAPHS

Figure 3 is a look at the number of sample times

available to us and how they accumulate over time. Howdoes this relate to current consumption? My data loggingprogram written in BASIC takes about 400 ms to execute.I’ll use a 50-mA   current draw as an example. The 9-voltbattery is capable of 550 mAH. If the logger is poweredcontinuously, the system will run for:

The RTCIO expansion board has plenty of TTL and B-

bit analog I/O, but I don’t need any of that here, so I’lldepopulate it. The real-time clock/calendar will serve as

5~o~~  = 11 hours

my Timebase. Not only will this supply time and date= 39,600 seconds

information to the microcontroller for logging, but it willserve as a programmable timebase. The programmability

If a sample takes 1 second, then that’s about 40,000

is somewhat limited. However, the four rates defined will samples. Since my program takes 0.4 seconds to take a

cover almost any need: l/64-second,   l-second, l-minute,sample, we’ll get:

and l-hour intervals.The last section, the “Power Control,” uses a new

device manufactured by Toko: a combination linear regu-lator with a digital on/off switch. Add to this a CD4538

39,600 set

0.4 set/sample= 99,000 samples

Now we’re getting somewhere.

Interval Timer RTCIO   Board

(with unused ICs   removed)(Preprogrammed Interval)

‘ON Source

POWER CONTROL

5V  LINEAR REGULATOR

WITH EDGE-TRIGGEREDON/OFF CONTROL

OPEN-COLLECTORINTERRUPT OUTPUT

9v I

DATA LOGGERRTC52 Board

I  I  I

Battery

(with unused Communication ICs   removed)

.

PI  t *OFF SourceJ

SWITCHED11 OVAC

pt.0

+SVDC GROUND

TTL DATA Input

:

 AC Line Monitor 

OPTOISOLATED 1

 AC DETECTOR   0

Figure 1 --The  we ll-pum p m onito ring system c on sists m ostly 

of o f f -the-shel f c om po nents, but uses som e spec ia lpower-

c ontro l circ uits to e xtend b atte ry li fe .

ONLY WIRING ACCESSIBLE WITHIN PUMP HOUSE

Aug ust/ Sep tem be r 199 1 83 

Page 74: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 74/93

Page 75: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 75/93

Page 76: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 76/93

SILICONUPDATETom Cuntrell

Kynar To The RescueThe Ultima te Senso r? 

K ynar isn’t silicon, but it is still a material of whichevery chip jockey should be aware. After all, our won-drous computers ultimately have to connect with the realworld to do something useful.

The secret of Kynar is the piezoelectronic effect, firstdiscovered in quartz over 100 years ago. In essence the

piezo material itself, like a motor/generator, is able totransform electricity into work and vice-versa. Later, cer-tain ceramics were found to exhibit the piezo (Greek for“pressure”) effect.

Originally Kynar, manufactured by Pennwalt Corp.,was a just another polyvinylidene fluoride (a.k.a. PVDF)semicrystalline resin with main features of toughness andflexibility for use in conduit, pipes, wire jackets, and so on.Yawn. However, in the early’70s,   piezo researchers search-ing for ever better materials discovered that a variety oforganic materials (including human bone) exhibit the ef-

amateur can get it hooked to a computer and do somepretty neat things.

Fortunately, this rather exotic technology is readilyavailable to all in the form of some low-cost evaluation kits.The “Basic Design Kit” at only $50 contains all you need todemonstrate a variety of applications. It also includes a 90-

page technical manual that is quite good, though I mustconfess I only skimmed the portions similar to what isshown in Figure 1. For the more committed, the manualincludes all the details of Kynar’s physical and electricalproperties and example computations.

As mentioned, a piezo material like Kynar can per-form work (i.e., move) in response to an applied voltage.The material reacts in an AC manner with opposite polar-ity producing opposite motion. One obviousapplication isas a speaker. It is quite novel to listen to music emittingfrom what looks like a small sheet of tinfoil . As expected,

feet.  Oh, and by the way, onceexposed to a strongelectric fieldat elevated temperature-a pro-cess known as “poling’‘-topermanently align the mol-ecules, PVDF works far betterthan any other material.

Talk about a market oppor-tunity dropping in your lap!Today, backed by a new ownerand a dedicated marketing andsales arm, Kynar piezo filmserves the glamorous world ofhigh-tech electronics; a far cryfrom its humble “plastic pipe”beginnings.

The rest of the article willdiscuss the key properties ofKynar piezo film summed up

Instead of g et ting in ove r m y hea d , I’ll just try to 

sum up k ind of how Kyna r 

works a nd , m ore 

im p or ta ntly , show yo u that 

even an am a teur c an ge t 

it hooked to a c om pu te r 

and do som e p re t ty 

nea t things.

in Figure 1. Ha ha, just kidding. I have neither the time northe ability (what the heck is “Young’s Modulus” any-way?). I’d just rather think of it in simple terms: you dosomething to the stuff and voltage comes out, you feed itvoltage and it does something.

So instead of getting in over my head (more than Ialready am), I’ll just try to sum up kind of how Kynarworks and, more importantly, show you that even an

such a tiny mass doesn’t yieldmuch low-end punch (Figure 21,

buton theotherhand,cangener-ate frequencies far higher thanaudible (question for stereo buffs:do they still use piezo for tweet-ers?). Anyway, the point is thatpiezo film works fine for chimes,alarms, and tonegenerators withadvantages of light weight, lowpower, and reliability.

Another application alongthese lines is the so-called solid-state fan. A number of Kynarfilmstrips are laminated togethermaking a piezo paddle which isdriven back and forth. The mainadvantages compared to a mo-tor-driven fan are the small size

and efficient, low-power operation.You may have seen the various novelty insect replicas

whose transparent wings flap without apparent mechani-cal input. Yep, piezo film strikes again.

The list of interesting “work output” applications ofpiezo goes on: active vibration damping/noise canceling,ink-jet printer pump, deformable mirrors, optical shutters,and so forth. However, other than use in a “singing mode”

88 ClRCUlT  CELLAR A/K

Page 77: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 77/93

Page 78: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 78/93

Page 79: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 79/93

Figure 4--The  most obvious application of pie20  ilm  is a s u

sw itch . Fushing’  the swi tch g ene ra te s an AC sp ike co rre - 

spo nd i ng t o t he d ow n /up st roke .

Advantages of the piezo motion sensor include full logic to condition and process the signal, producing an

  field of view, small size and weight, and very easy-to-interface TTL-level  “motion detected” output.ow power consumption. For instance, the PIR180  motion

ensor has a 20’ range which is fairly competitive with INTERFACE-A PIE20  CAKE

ypical security light ultrasonic detectors. However, the

iezo-based unit is tiny--only about an inch on a side and Well, enough of this theory, it’s time to fiddle with

weighing less than an ounce-and consumes very little some of this Kynar stuff and see what happens. Armed

ower (2 mA @   5 V). Standard versions feature in-module with various Design Kits, an oscilloscope, and a BASIC-

Professional Quali ty 

80x86 ROM Development ToolsROMable DOS, Only $6 each! ROM Your MS Turbo C Code!Place your programs in PROM with ROM-DOS. Pur-

chased in quantity, this complete ROMable operatingsystem costs only $6 per copy. And its small size-lessthan 32K-helps   conserve valuable target system mem-ory. ROM-DOS was designed as an embedded DOS,

 providing features like power conservation, the abil-ity to run your executables  directly in ROM, andfull access to built-in devices to support anykind of target system. Plus ROM-DOS

 provides the power you’d expect fromdesktop DOS: a full-featuredcommand

 processor, extra utilities, batch filesupport, and more. And now it iscompatible with MS-DOS 3.3. RO

DOS  boots and runs from either disk ROM and can easily be configured to meeneeds. Ask for our free demo disk.

 Now _thru_ROM  eases ROM development with allversions of Turbo-C, C++,  and Microsoft C. New

features include support for Turbo Debug andmote debugging via a ROM socket, which

oes not use a serial port on the targetsystem. _thru_ROM  is a complete

ROM development package contain-ing everything you need to work 

with your choice of compiler and getyour application up and running in ROM  quickly. It includes: a full 80x86 locator 

which outputs in Intel OMF, hex, and binary;ROMable startup code; two choices for remote de-

 bugging (a CodeView-like debugger or the Turboremote debugger); full floating point support; a ROM-

able library (with p r int f ,  ma l l oc etc. ) ; and much more.Call, write, or fax Datalight today for full details.

For more information all Today Toll -F ree l-800-221-6630 

Dat al ight17455 68th Avenue NE, Suite 304, Bothell, WA 98011, USA

l

(206) 4868086l

fax (206) 486-0253

A u g u st / Se p t e m b e r 1 99 1 91

Page 80: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 80/93

SwitchingForce

Piezo FilmInput

Piezo FilmOutKlut

MetalStrip

Highor 

Low

Figure 5-A m od i fica t ion to the simp le sw itc h uses one piec e of f ilm  a s a

“speaker” and a seco nd p ie ce as a ‘m i c rophone . When the button ispressed , the spe aker is mute d a nd no thing is picked up b y the m ic rop hone .

based single-board computer with 8-bit ADC, Iplunged forward.

First, I built a piezo speaker setup whichmainly involves assembling a small IC-basedpreamp. The schematic is included and, an ex-tremely nice touch, the Radio Shack part numberfor each component is noted. After a refreshinglyquick visit to the’shack, the 3”~  6”  foil “speaker’was soon blaring music at which point interest-ing effects associated with various bending/mounting schemes could be heard (I’m told glu-ing it to a balloon works well).

Now, it was time to actually connect a sensorto the computer and see what happens. Figure 6shows that the simplified electrical equivalent ofpiezo film is a voltage generator whose outputdepends on the induced charge (Q)  and filmcapacitance (C,). Hmm.., didn’t I see somethingin one of these data sheets about hundreds ofvolts...? Indeed, under terminal stress, a small(12 x 30 mm) foil can generate 830-1275 volts!

Basic Design Kit items at hand included eightlow-cost sensors (DTl-O28K),  one shielded ver-sion SDTl-028K),   and a sensor (DT2-028K)bonded to a credit card. I choose the latter and,figuring a little care was in order before connect-ing hundreds of volts to my computer, hooked itup to an oscilloscope. Now, I’m no scope jockey,so I spent a lot of time fiddling with the credit

card and the scope dials before finally convincing myselfit was safe to proceed.

Next, I connected the credit card to the controller’sADC which was configured for -5V to 5V operation (re-

member the sensor puts out AC!). Adding a few lines ofBASIC to sample and threshold check the ADC was easyand shortly thereafter, the controller would exclaim“OUCH” as I pounded on the credit card.

But, for analog reasons undiscernible to me, the sensi-tivity was poor, that is, I had to really pound the card andthe generated signal was only a few percent of the ADCfull-scale. Guess I need an amplifier.

Though the manual shows some generic op-amp in-terface circuits, I simply used the little audio amp from thespeaker experiment which worked just fine for fiddlingaround. Soon, I had thecontroller quantifyingitspain with

Figure 6-7he simp l if ied elec tr ic a l eq uiva lent of p iezo f ilm  is a 

vol tage generator whose output dep ends on the induce dc harge (62) a n d ilm  c a p a c it a n c e (CJ .

Reader Service f214

Page 81: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 81/93

Page 82: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 82/93

In fact, checking the film output with a scope showed thatturning the lamp on did induce piezo pulse-pulses witha suspicious 16.6-ms  period. Yes, apparently my “ther-mal” sensor was actually a “60-Hz” sensor. Though a 60-Hz sensor may be neat, the point is that you have to becareful to configure your piezo-based system to measurewhat-and only what-you really want to measure. Turnsout blocking ambient 60 Hz is a primary function of the

shielded version of the sensor (SDTl-028K)  also includedin the kit. Shielding must be a nontrivial task. A basic DTI-028K sells for 50 cents, while the shielded SDT1-028K   goesfor $40

I cobbled up a more conventional interface circuit (Figure7). I’m not sure if it’s ideal, but I figure it isn’t bad for a guymuch more at home with opcodes than op-amps! Now, thecontroller begs for mercy as the flame gets closer.. .

Once the wilder side of piezo-its propensity to take inany signal off the street-is tamed, I think you’ll find thatproducts like Kynar can occupy a valuable spot in yoursensor bag of tricks. a

CONTACT

In real-world piezo design, you’ll find much attentiongiven to sensor isolation and/or signal conditioning toextract the variable of interest from the myriad of noisesources the sensor will otherwise pick up. After all, itwouldn’t do well at all to have piezo sensors that workfine, only as long as lighting, temperature, acoustic inter-ference not to mention vibration are all controlled. Theconcept of common-mode rejection using multiple sensors

is often the only solution. For example, an impact sensormountedinamoving/vibratingenvironmentcanbepairedwith another equal, but unimpacted, sensor. Then, thedifference between sensor readings serves to isolate theimpact signal from ambient vibration.

Atochem  North America(formerly Pennwalt   Corporation)Piezo Film Sensor DivisionP.O. Box 799Valley Forge, PA 19482(2 15) 666-3500

TomCantrell  holdsa  B.S. ineconomicsandanM B A from   UCLA. Heowns and operates Microfuture, Inc., and has been in Silicon Valleyforten years working on chip, board, and system design and marketing.

IRSUltimately, after switching to the shielded sensor, I 425 Very Useful

was able to observe the pyroelectric effect working as it 426 Moderately Usefulshould. Along the way (after yet another trip to the’shack), 427 Not Useful

V25 Power Comes to Embedded Con trol ! 

Micromint’s new RTCV25 is the perfect marriage of a PC-compatible processor, programming convenience, and control l/O

The heart of the RTCV25 is the NEC V25 microprocessor, an all-CMOS, 8088-compatible  device running at 8 MHz. The 3.5” x 5” V25offers engineers 18bit  processing power, large address space, and compatibility with many of the most popular and useful software de-velopment tools available today. The RTCV25 enhances the V25’s power with 40 parallel l/O lines; a-channel, a-bit A/D  conversion; twoserial ports (one RS-232 andone  RS-232/RS/485 ;  up to 384K RAM and EPROM;a  battery-backed clock/calendar; 1 K bit EEPROM,ROMmonitor, and the RTC stacking bus. The RTCV25 is compatible with the full line of RTC peripheral boards and products.

Features Optionsl 8MHz  V25 processor  l i 28 bytes EEPROM

l Battery-backed Clockl 384K RAM and EPROM9 a-channel, lo-bit ADC

l RTC Stacking Bus l ROM Monitor l Small 3.5” x 5” sizel 5-volt only operation

$279.00

MICROMINT, INC.4 Park Street

Vernon, CT 06066

cal l +800- 635-3355

 203)871-6170Actual size

39x5 Fax: 203j   872-2204

Reader  Smvice  175

I C lRCUlT CELLAR NK

Page 83: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 83/93

as

Figure 2- When unskewed a ll the d ist r ib u -

i ions a re c en te red a round 0 .0 .

4)  The Fog Test is used in theautomotive industry to determine thetendency of materials to deposit fogonautomobile windows. Theamountdeposited on the glass is character-ized by the reflectance of its surfaceas measured by a Glossmeter. Thereading can never exceed 100 andhas, in fact, a vanishingly small chanceof attaining that value. Similarly, areading of zero is highly unlikely,and one that lies below zero or over 100 is impossible. Between these lim-its, however, the readings cluster about some value.

To represent such data, the nor-mal curve is sometimes truncated;extreme values are removed and the

inclusive. Within these limits each card has the same ordinates recalculated to return the sum of all the prob- probability of being dealt, so here again the probability abilities to 1 .O. A truncated curve shows appreciable prob-density distribution is rectangular. abilities of measurements at the limits, which may not in

3) The grades on a test given to a group of students lie fact exist, as in example4 above. Extreme values could also between zero and lOOand never outside these bounds. The be removed from the normal curve by raising the x  axisgroup average will lie between those limits. These distri- (that is, subtracting a constant from all probabilities) andbutions   are seldom rectangular. using a factor to adjust the curve, but the probability of 

 249,TERMINAL

Featuring l Standard RS-232 Senal  Asynchronous ASCII Commumcationsl 48 Character LCD Display (2 Lines of 24 each)l 24 Key Membrane Keyboard with embossed graphics.l Ten key numeric array plus 8 programmable function keys.l Four-wire multidrop protocol mode.l Keyboard selectable SET-UP features-baud rates, parity, etc.l Size (5.625” W x  6.9” D x  1.75” H). Weight 1.25   Ibs.l 5 x  7 Dot Matrix font with underlme   cursor l Displays 96 Character ASCII Set (upper and lower case)OptIons-backhghting  for alsplay,  RS-422 110 20 Ma current loop 110

rnfwu~~~wl~~  INC.302 N. Winchester l Oathe.   KS 66062 l 913.829.0600’*   800-255-3739

96   ClRCUlT CELLAR INK  Reader Service I1  ;

Lisa D’Ambrosia  Nanette Traetow49 Walpole Street 242 East Ogden Avenue,

Norwood,  MA 02062 Suite A(617) 769-8950 Hinsdale, IL 60521

Fax: (617) 769-8982 (708) 789-3080

Fax: (708)   789-3082

Barbara Best569 River RoadFair Haven, NJ 07704

(908) 741-7744Fax: (908) 741-6823

Barbara Jones&   Shelley Rainey3303 Harbor Blvd.,

Suite G-l 1

Christa   Collins7640 Farragut Street

Hollywood, FL 33024(305) 966-3939

Fax: (305) 985-8457

Page 84: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 84/93

Page 85: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 85/93

Summarizing Your DataProper f i es of a Bo und ed Pro b a b ility 

De nsity Func tio n 

0 ne mission of Statistics is to

PRACTICALALGORITHMS

Charles P Soeg l i

manage large amounts of data by

summarizing it in various ways. Avail-

able for this work are a number of 

probability density functions whichexperience has shown can represent

various types of data. When data fit

any such function, reasonably confi-

dent assertions can be made not only

about where additional data are likely

to lie, but also about the process that

produced the data,

property, but the great majority does allow finite prob-abilities of greatly divergent measurements on at least oneside of the mean.

Certain distributions, however, are bounded in thesense that no possibility whatever exists that they canexceed certain limits. Here are four examples of suchdistributions:

1)  A computer can be programmed to produce a set ofpseudorandom numbers between, say, 0 and 10. Thoughthe quantity of generated numbers may approach infinity,one that lies below 0 or above 10 has no possibility ofexistence. The distribution of numbers between 0 and 10should be rectangular, if enough numbers are generated;any number between the limits is as likely to exist as anyother number.

2)  If all face cards are removed from a deck and thedeck is shuffled, a single card that is dealt may be anythingfrom one (an ace) to ten. If that card is returned, the deckreshuffled, and another card dealt, the same limitations

apply. The process can be repeated ad infinitum and nocard will appear that does not lie between one and ten

The “normal” population curvedescribes a wide variety of data sets.t implies, in general, that the most

probable value of a dimension lies athe mean (i.e., the average) of all the

measurements. Anotherquantity (thevariance”) denotes how closely the

measurements cluster around themean. If the variance or its squareoot, the “standard deviation,” are

mall, the measurements are for themost part close to each other, while aargestandard deviationindicates the

data spread widely about the mean.The normal curve, irrespective of

he standard deviation, shows smallbut finite probabilities of measure-ments that lie at very large distancesn both directions from the mean.

When thevarianceissmall, these prob-bilities are so small that little is losty ignoring them. Not all the other

tatistical distributions share thisFigure 1 -Severa/  typical disf r ibt i ions  w i t h  fixed k a re show n.

Aug ust/Sep tem be r 199 1    95

Page 86: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 86/93

Page 87: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 87/93

Page 88: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 88/93

PEAK-MEAN DEVIATION

A distribution bounded on both sides must beskewed unless its mean lies midway between the

bounds. To the extent that equation (1) describes

such a distribution, the distance between the mean

and the peak (most probable value) can be foundwith thespreadsheetprogram.Theoperationissome-what clumsy in that a series of adjustments must be

given to the b-kurtosis and b-skew to arrive at any

specifed mean and standard deviation. To surmount this difficulty, a macro was written that

continually adjusts the skew to attain a ‘bogey”standard deviation for any given b-kurtosis. Havingdetermined the skew, the macro then increments theb-kurtosis and repeats the calculation. In this manner,data were derived forvarlousvaluesof b-kurtosisfrom

0.5 to 256 in step-ratios of 2.0, using means from 0.1 to0.45 in steps of 0.5. The accumulated data are plot-ted in Figure I.

With this figure, knowing the *reduced”   mean andstandarddeviations,onecanestimatethe “reduced”peak-mean difference. Finding the most probable

value of the distribution is then merely a matter of adding the difference to the “reduced” mean, and

restoring the values to their original bounds.A similar macro was written for nonparametric

quantities. Figure II performs the same function as

Figure I but uses midquartiles and quartile deviationsinstead of means and standard deviations.

Reduced  standard dev la f l on I:igure  I--The b -kurtosis a nd b-skew m ust b e adjusted  to a t t a in a 

sp ec if ie d  mean and standard devia t ion.

0.3

0.1

0.01

0 .001

Figure II-Similar to a b ov e, b ut using m i d q u a r t i l e s  an d q ua rt iles.

DISTRIBUTION BEHAVIO R SUMMARY

Behavior of these distributions can be summarized innumerous ways. For the purposes of this article, the distri-

bution mean was first used as a parameter. For each meanbetween 0.1 and 0.45, a curve was derived relating thepeak-to-mean distance to the standard deviation. Thesecurves are presented in the sidebar  above. This choice wasmade because of common familiarity with the calculationof the mean, and also because the determination of “cen-tral tendency“ is one primary object of this work. Similar curves have been drawn for nonparametric distributionparameters.

 The mean ordinarily indicates central tendency be-

cause in unskewed normal distributions it represents themost probable value. The bounded distributions consid-

ered here must be skewed except in the trivial case whereb-skew = 0.0. The location of the peak, not the mean,represents the most probable value, as Figure 4 shows. Thecurvesabove can be used to locate the peak when the meanand standard deviation are known.

CALCULATION EXAMPLES

To illustrate the use of the curves, we use a set of reflectance readings from eight Fog tests run on a singlematerial. The readings from the glasses had a mean valueof 82.2 and standard deviation of 4.47. Since these readings

are on a scale of t&100,  the reduced mean is 0.322 and the

.

 The EC 3 TM  is a versatile 8OC3 microcontroller

board. It is ideal for quickly developing products,prototypes or test fixtures.

l 8OC3 microcontroller (8051 compatible)l BASIC-52 or MONITOR-52 availablel Program in C, BASIC or assembly languagel 8 to 92K RAM, EPROM or EEPROMl Breadboard area and expansion busl RS-232 port and 12 digital I /O linesl $100 for 11 MHz, $145 for 20 MHz

Reader Service #lb1

Aug ust/ Sep tem be r 199 101

Page 89: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 89/93

Page 90: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 90/93

CONNEC-TIME

Conduc t ed by Exc e rp ts from fhe C irc uit Ce lla r BBS 

’  Ken Davidson   I

I I

We’re going to deal primarily with simple (or what shouldbe simple) l/O  peripherals in this installment of ConnecTime.  We’ll start with a discussion of some of thequirks of the venerable 8255 PPI fhe astute programmer must be aware of when dealing with the chip. Next, we‘ll

lookat accurately  generating time delays, and finally we’lldiscuss dealing with the dreaded RS-232 connection.

Msg#:37143

From: WALTER CRUDUP   To: ALL USERS   MS@:37257

Quick question. I’ve got an 8255 connected to an 8051 at address

AOOOh  to AOO3h,   and set to mode 0. Will I bc able to read the last

data1 sent to a port configured as output if 1 do a read of this port?

Msg#:37154

From: KEN DAVIDSON To: WALTER CRUDUP

Yes, you can read the state of an output port on the 8255 by simply

reading the port back. Makes a nice quick sanity check to make

sure the part is working.

Msg#:37168

From: WALTER CRUDUP   To: KEN DAVIDSON

Thanks for the info Ken. Right after 1 posted this message I went

 back and read the Intel data book again looking for this info (for 

about the tenth time) and there it was, stating that a read from an

output port will return the data written. It  is truly amazing how

things can be overlooked.

Msg#:37188

From: BOB PADDOCK To: JEFF BACHIOCHI

Toshiba 82C55s  won’t let you read back the command register.

Msg#:37198

From: KEN DAVIDSON To: BOB PADDOCK 

That’s right. None of the 8255s I’ve ever used will allow you to

read back the configuration port; only the I/O ports.

The Circuit Cellar BBS300/  1200/24C O  bps24hours/7 days a week

(203) 87 1  1988Four Incoming Lines

Vernon, Connecticut

Msg#:37231

From: BOB PADDOCK To: KEN DAVIDSON

I know at least one of them did let you, but I don’t remember 

who’s, because that “feature” was in some of our equipment’s

self-test code. And we had to change the code when we foundthat not all of them would work that way. I know that it was the

Toshiba part that brought this to our attention.

From: ED ROBINSON To: WALTER CRUDUP

Beware, I seem to recall having problems with the output port

read if there was a write to the control port. Even if the mode of 

the output port was not changed.

Msg#:37282

From: KEN DAVIDSON To: ED ROBINSON

That’s right, too. When you change thecontrol port, all theoutput

 ports lose their values, even if they are still output ports in the

new control word.

The 8255 can be a strange beast to work with. I guess I‘ve used it

so much that I’ve just taken these idiosyncrasies for granted.

Generatingaccuratetimepeviodscan be trickyin  theworld

of event-driven microcontrollers. Here, we look at someways y  doing if using an 8032   processor.

Msg#:36294

From: AL DORMAN   To: ALL USERS

I am doing a project where I need to set some BCD switches and

tell the microcontroller (8OC31)   to turn on a port pin for O-9

minutes and /or O-90 seconds. In an attempt to not reinvent the

wheel, does anyone have a suggestion on how they have done

this in the past to get an accurate one-second count. I plan on

using the internal timer interrupt and trimming it to get my one-

second interrupt. 1 cannot use the external interrupt because I am

using P3 for switch strobing and external device driving. Pl  is

104   l R U l CELLAR K

Page 91: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 91/93

ed for switch inputs and option switch inputs. Should I use a

ecific crystal? Is the internal timer interrupt stable enough to

erform the timing I  need? Any comments?

rom: SANJAYA VATUK To: AL DORMAN

st how accurate do you wanna be? If you need to be dead nuts,

ou are better off grabbing a zero  crossing from the 60-Hz line

ssuming your widget is line-powered). See Ed’s line-monitor-g thingy in issue #15  of Circuit Cellar INK for details on how to

o this. If you want to bc real close, by all means use the   timer.

therwise, you are probably better off using a 12-MHz   crystal if 

ou don’t need RS-232. This divides down into a l-MHz cycle

equency, which makes calculation -much_   easier: 1 us  per 

ycle. Aside from any inaccuracies in your oscillator, keep in

ind the variability of the 8031’s interrupt response time. At 12

Hz, the latency can vary between 3 and 9 us (7 us  if you don’t

e the MUL or DIV instructions).

terestingly enough, I was just playing around the other day

ying to see how accurate a delay loop I could create using an

  crystal, using nested loops. (All I-really_  needed too was flash an LED for half a second, but I thought I’d try and

 -exactly_ half a second!) I finally got it 99.99+%   accurate,

cluding the call and return. Believe me, 12 MHz is easier!

om: AL DORMAN   To: SANJAYA VATUK 

do have some6-MHz   crystals, so I’ll multiply everything by two

d try that. It doesn’t have tobedcad nuts, but in my application

another coin is inserted, the time accumulates relative to the

asic set time. So if you set the timer for one minute and insert 100

ins, you should get 100 minutes of accumulated time. This

uld accumulate any timing error if it is in the seconds and causeoblems. Microsecond errors shouldn’t be a problem.

nally, we all know the  frustration of trying to get a pair f devices to talk to each other over an RS-232 connection.he last discussion offers   some suggestions for dealingith such difficult situations.

om: CHESTER D. FITCH To: ALL USERS

. Here’s a project idea for all you analog types.

just finished a frustrating job of interfacing two computers

gether through several serial ports. What made it difficult was

at I could not really see the characters fly back and forth

tween systems. I could see SOMETHING get passed between

stems, but I was using a protocol that required that I see what

e characters WERE in order to debug   the software. I eventually

d to borrow a $15,000 network analyzer from someone at work 

order to solve  my problem.

his problem has led me to consider: why can’t we come up with

simple (cheap) analyzer? My thought was that a relatively

inexpensive embedded microcontroller/display board/and se-

rial-line interface would solve this problem. Since I do software

for a living, I see no problems with that end.

What I  would like to ask is: do any of you analog types out there

know of an interface circuit to RS-232? It should be transparent on

the line (i.e., no loading)? While I dabble in digital circuitry a lot,

and can build an analog circuit from schematic with the best of 

them, I do very little (or no) analog design.

I would appreciate hearing from anyone about this. Thanks.

Msg#:37326

From: JIM STEWART To: CHESTER D. FITCH

A friend of mine once wrote a program for a PC that did what you

want. We connected the two receive lines from COMl   and COM2

to the R’S232   line under test and wrote software to display the

transaction on a split screen. It worked pretty slick, although I

don’t have any more information on it other than this. It would

 be a nice thing to have in the public domain.

Msg#:37341

From: FRANK C. SERGEANT To: CHESTER D. FITCH

Regarding snooping on the serial lines, there are a number of 

 possibilities. First, how fast does it have to go? Second, can you

get an extra PC or laptop near the two devices that you want to

monitor?

If these first two tests are passed, here’s what I would do first. I’d

route the two devices’  serial lines *through* the extra PC (it

would need two serial ports). Then the extra PC keeps checking

the two ports. When a character is ready from device A, it reads

it, stuffs it in a buffer, and forwards it to device B. When a

character is ready from device B, it reads it, stuffs it in a buffer,

and forwards it to device A. Providing the timings work out (and

the extra PC is available) this should work like a dream. Perhaps,

you can *make* the timings work out with handshaking.

I presume you want to know not only the characters but the exact

interleaving of them. In this case, stuff characters from both

devices into the same buffer, but with tags attached to indicate

where they came from. A simple polling of the serial ports is

 probably sufficient. (If it’s not fast enough, you might need

interrupt routines for the serial ports in the extra PC.)

So, to summarize, your two devices *think* they are talking to

each other and don’t realize the messagesare relayed through theextra PC. The program running on the extra PC could leave the

characters in the buffer for later display (fastest) or could display

them on the screen as they are received.

Alternatively,   you could tap into the two serial data lines, feeding

them into, perhaps, a 4049 or 4050 CMOS buffer, diode clamped

so they won‘t go negative, and then into a parallel port on any

computer and do the serial decoding in software. Use sockets for 

the 4049s as they are their own fuses. For a test setup, incredibly

sloppy hardware will work just fine! It’s all digital, you don’t

need to worry about analog. (I’ve almost always been able to

drive serial lines with just Oand Svolts-no negativevoltage.)So,

while you might not want to ship a product with “quick and

August/Septem ber 199 1  105

Page 92: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 92/93

dirty” RS232, this should be no problem in your *laboratory*,huh?

On the other hand, if your devices *must* run at 115,200 bps withno handshaking or delays allowed, the second of my two meth-ods might still work if you have a fast enough computer. In mostcases, I imagine, it would be possible to slow down the data ratesto 300 bps or 110 bps to make it easy for the snooper to keep up.

Msg :37412From: ED NISLEY To: CHESTER D. FITCH

Turns out I needed something like that for a Firmware Furnacecolumn I recently completed...

I made up an octopus connector that broke out the transmit andreceive lines between the two devices and sent them to the receivelines of two serial ports.That way the devices could talk normallywhile the two additional ports recorded the conversation in eachdirection.The devices use plain ol’ ASCII, so a terminal emulator worked just fine.

Turned out that the “master” device was COMl on my PS/2,while the two monitors were COM3 and COM4. One of the nicethings about OS/2 is that I could run two copies of REXXTERMto watch COM3 and COM4 while single-stepping the “master” program driving COMl-all  at the same time!

There are commercial PC programs available that do this sort of thing with all manner of bells and whistles (back pages of Dr.Dobb’s Journal and Computer Language have ‘em), so it’s prettymuch a solved problem.

Msg :37713From: PELLERVO KASKINEN To: CHESTER D. FITCH

Although there are already some answers, nobody seems tomention the commercial product that I bought and have beenextremely pleased with: Break-Off II. I bought it from BB Elec-tronics, but think I have since seen somebody else advertise it.The price for an AT (two COM port) version was in the $150range, if I remember. It included the software and a special

SOFTWARE and BBS   AVAILABLE on DISK

Sothvare  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 are

also available on one 360K,  5.25” IBMPCformat  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 public message areas is available on disk in two-monthinstallments. Each installment comes on three 360K. 5.25’ IBM PC-format disksand costs just $15. The installment for this issue of INK (August/September 1991)includes all public messages posted during May and June, 1991.

ToordereitherSoftwareonDiskorCircuitCellarBBSonDisk,sendcheckormoneyorder to:

Circuit Cellar INK Software (or BBS) on Disk

P.O. Box 772, Vernon, CT 06066

or use your MasterCard  or Visa and call (203) 875-2199. Be sure to specify theissue number of each disk youorder. Please add $3 for shipping  outside the U.S.

106   ClRCUlT CELLAR AK

eavesdropping cable. You plug the central body with its twoconnectors into the line between the two communication devicesyou plan to monitor and the two pigtails to one COM port eachof an AT class computer.

You have several choices for the configuration, but the most powerful for my needs has been one where I capture into memorya range of bytes to be analyzed later on. Each data byte isaccompanied by one status byte that tells which port the data

 byte came and all the handshake line status information nor-mally used in the RS-232 type communication. You get the exactorder of the signals in each ditection.  No timing information of course. If I need that, then there is no other way but to hook upa logic analyzer, but its memory length is generally too short for real-life message analysis.

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

IRS431 Very Useful432 Moderately Useful433 Not Useful

The Ciarcia

Design WorksDoes your big-company marketing

department come up with more ideas than

the engineering department can cope with?

 Are you a small company that can’t

afford a full-time engineering staff for 

once-in-a-while ideas?

Steve Ciarcia and the Ciarcia Design

Works staff may have the solution for you.

We have a team of accomplished programmers

and engineers ready to design products or solvetricky engineering problems. Need an optical speed

sensor, personnel tracking system, or 74s drill

controller? The team has done it!

Whether you need an on-line solution for a unique

problem, a product for a startup venture, or just  plain

experienced consulting, the Ciarcia Design Works

stands ready to work with you. Just send me a fax

discussing your problem and we’ll be in touch.

Remember...8 Ciarcia design works! C a l l (2033 tJ75-2199  9  Fax (203)  872-2204

Page 93: Circuit.cellar.022.Aug Sep.1991

8/13/2019 Circuit.cellar.022.Aug Sep.1991

http://slidepdf.com/reader/full/circuitcellar022aug-sep1991 93/93

STEVE’SOWNINK Steve i fci

A Standard Column

I

I ‘ve been doing a lot of work lately, work that has me

thinking about the question of standards. Specifically, I’ve spent

a lot of time with my nose buried in data books trying to figure

out the best components for several boards I’m designing. My job

would beeasier  if I didn’t have to thinkabout changing thcboard

layout every time I look at another DC-DC converter. I  knew that

there were a lot of packaging specifications for analog compo-

nents, but several weeks spent tearing my hair out has broughtthe point home with tremendous effectiveness. It’s also started

me thinking that there must be a better way to get components

from a factory onto my boards.

My first thought (after the fifth or sixth handful of hair) was

that there ought to be strict standards for physical package size

and pinout   configuration. Maybe there could be a huge govern-

ment agency to enforce strict compliance with the standards.

Maybe they could send out commando teams to blow up the

 buildings of any company that produced a stupid proprietary

 package that wouldn’t fi t on my boards! Maybe I’m going

overboard. After all, I don’t really want a lack of choices, I just

want to be able to work on the electrical side of a design withouthavihg   to spend hours on the physical package every time I look 

for an alternate component. Furthermore, the record of stan-

dards imposed from outside an industry is not good.

 Now, there’s an idea. Standards that develop because a lot of 

 people used a particular product or design have tended to be

fairly robust and dynamic standards. Lookat  the IBM PC. In 1981

it was just one of the many personal computer designs floating

around. Now, it’s the de facto standard for personal computing

 because thousands upon thousands of people bought the darned

things. If I could convince a bunch of engineers that they need to

h h i d i h f i ld

were a bit more standardization on general sizes, pinouts,   and

specifications for common components. Sigh.

The more I think about the problem, the more I realize that

the real issue is caught up in the way that the electronic and

computer industries developed. I’m not going to go around

saying that thecomponents companies are the last bastion of free-

form capitalism, but there has been a lot of freedom in the way the

 products came to be. Most products have been the result of an

idea for a new product or improvement. Innovation reigned,

with lawyers standing by to make sure that there was enough

innovation in the new products. Standards happened (or didn’t

happen) by the occasional government action (MIL-spec   parts)

and by committees generally made up of competitors and large

users, each with a particular axe to grind and no strong motiva-

tion for real standardization. Despite all of this, a few standards

have emerged. There arc accepted package sizes for micropro-

cessors, memory   chips, and other ICs.  Likewise, there are com-

mon standards for many of the “garden-variety“ components

like resistors and capacitors. Why, then, has it been so difficult to

establish anything like a standard for anything having to do with power? Transformers, DC-DC converters, inverters, and the like

are all over the spectrum in size and electrical connections. I

know that some of the differences have to do with the physical

requirements of the component, but I refuse to believe that there

are no ways to standardize at least some of the specifications of 

these vital components.

I don’t know what the final answer is. I’ve never served on

a standards committee, so it may be that the metaphysical aspects

of standards represent a truly insurmountable hurdle when it

comes to power components. I have to believe that we would all

b fi if h f hi h i ld