Circuit.cellar.094.May.1998

66
8/13/2019 Circuit.cellar.094.May.1998 http://slidepdf.com/reader/full/circuitcellar094may1998 1/66 T H E C O M P U T E R A P P L I C A T I O N S J O U R N A L ® INK $3.95 U.S $4.95 Canad  #9 4 M A Y 1 9 9 8 The Black Art of Analog Design Antialiasing—Just a Matter of Know-How Selecting the Right Position Transducer Creating Virtual Tools  E  E  E  C                   

Transcript of Circuit.cellar.094.May.1998

Page 1: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 1/66

T H E C O M P U T E R A P P L I C A T I O N S J O U R N A L

®

INK

$3.95 U.S$4.95 Canad

# 9 4 M A Y 1 9 9 8

The Black Art of Analog Design

Antialiasing—Just a Matter of Know-How

Selecting the Right Position Transducer

Creating Virtual Tools

E M B E D D E D P C

Page 2: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 2/662 Issue 94 May 1998 Circuit Cellar INK ®

A Race Well Run

TASK MANAGER

i’ ll never forget my first road race that coldThanksgiving Day 1996. I had to make so many

decisions that morning. What to wear? I didn’t wantto be cold, but it’s terrible to overheat. If I ate, would I

get sick halfway through the course? If I didn’t, would Ihave the energy to finish? Where should I line up? If I was too close to thefront, would I get bowled over by speed-machines? Where was too close?All the contestants looked like they ran hundreds of miles, did weights, andthen biked for leisure.

Looking back on it now, I know I just had a bad case of nerves. I hadbeen running for almost a year. I was ready, and besides, 5 miles isn’t farfor someone running 3–6 miles per morning. It was just the panic of bringingmyself up to the line and having to compete with others who might bebetter. However, despite knowing this, every time I go to race, that knot inmy stomach comes back.

In truth, my reactions are pretty typical. Nearly everybody, when facedwith the opportunity/risk of competing with someone else, feels a littleintimidated. Whether it be a road race, a business proposal, a job interview,or a Design98 submission, you don’t know how you’re going to fare. And,it’s nerve-racking.

As I surveyed the entries when they came in, I noticed this sameanxiety. International competitors wrote cover letters apologizing for theirEnglish, one fellow called up panicking that he’d left his name in the projectin three places, while others wanted to send in countless revisions to this orthat paragraph.

What does all this anxious energy indicate? That a lot of you poured awhole lot of effort into your projects, that you were proud of your designs,

that you really wanted them to win. You didn’t want to be eliminated becauseof your English, the inclusion of your name, a lack of a photo, whatever.

As I watched you turn the first corner and head up the mile-long hill,you were an impressive pack. It was the largest showing we’d ever had. Allpopulated continents were represented, with 16% of the entries comingfrom Europe, 8% from South America, 8% from Canada, and 9% fromAustralia/New Zealand. We even received 2 from Asia and 1 from Africa.And, in the final analysis, 60% of the winners are nonAmerican. Perhapscoincidentally, 60% of Microchip’s sales are from international markets.

As you hustled your way across the finish line, I saw many good solidfinishers who, like myself, didn’t make it to the top ten, but are nonethelessgood designers. (I’m trying to get manuscripts from all the competitors. If wecan’t fit them in INK , we can cover the designs on our Web site.)

And, as you now enter your postrace moments, I hope you sharemany of the same feelings that I experience. I look on those top winnersand marvel that anyone’s legs can cover ground quite as quickly as theydid. Then, I look around me and see the many others that finished at aboutthe same time as I did and I realize that yet again, I finished. I stepped upto the mark, I ran the race, I finished the course. I accomplished what tensof millions of other people would never dream of doing—I went above andbeyond the call of duty. I entered a contest and pitted my own skills againstanother’s.

When you do that and you feel the pride well up within you, then youknow you really won, regardless of what the judges or the clock have to say.And, with that feeling you know without a shadow of doubt that you’ll do itagain, only next time, you’ll do it just a little better and just a little smarter.

T H E C O M P U T E R A P P L I C A T I O N S J O U R N A L

®

INK EDITORIAL DIRECTOR/PUBLISHERSteve Ciarcia

EDITOR-IN-CHIEFKen Davidson

MANAGING EDITORJanice Hughes

TECHNICAL EDITORElizabeth Laurençot

WEST COAST EDITORTom Cantrell

CONTRIBUTING EDITORSIngo CyliaxFred EadyRick Lehrbaum

NEW PRODUCTS EDITORHarv Weiner

ASSOCIATE PUBLISHERSue (Hodge) Skolnick

CIRCULATION MANAGERRose Mansella

BUSINESS MANAGERJeannette Walters

ART DIRECTORKC Zienka

ENGINEERING STAFFJeff Bachiochi

PRODUCTION STAFFJohn Gorsky

James Soussounis

Cover photograph Ron Meadows – Meadows MarketingPRINTED IN THE UNITED STATES

For information on authorized reprints of articles,contact Jeannette Walters (860) 875-2199.

Circuit Cellar INK ® makes no warranties and assumes no responsibility or liability of any kind for errors in these

programs or schematics or for the consequences of any such errors. Furthermore, because of possible variation in

the quality and condition of materials and workmanship of reader-assembled projects, Circuit Cellar INK ® disclaims

any responsiblity for the safe and proper function of reader-assembled projects based upon or from plans, descriptions,

or information published in Circuit Cellar INK ® .

Entire contents copyright © 1998 by Circuit Cellar Incorporated. All rights reserved. Circuit Cellar INK is a registeredtrademark of Circuit Cellar Inc. Reproduction of this publication in whole or in part without written consent from Circuit

Cellar Inc. is prohibited.

CONTACTING CIRCUIT CELLAR INKSUBSCRIPTIONS:

INFORMATION: www.circuitcellar.com or [email protected]

TO SUBSCRIBE: (800) 269-6301 or via our editorial offices: (860) 875-2199

GENERAL INFORMATION:

TELEPHONE: (860) 875-2199 FAX: (860) 871-0411

INTERNET: [email protected], [email protected], or www.circuitcellar.com

EDITORIAL OFFICES: Editor, Circuit Cellar INK, 4 Park St., Vernon, CT 06066

AUTHOR CONTACT:

E-MAIL: Author addresses (when available) included at the end of each article.

ARTICLE FILES: ftp.circuitcellar.com

CIRCUIT CELLAR INK ® , THE COMPUTER APPLICATIONS JOURNAL (ISSN 0896-8985) is published monthly by

Circuit Cellar Incorporated, 4 Park Street, Suite 20, Vernon, CT 06066 (860) 875-2751. Periodical rates paid at

Vernon, CT and additional offices. One-year (12 issues) subscription rate USA and possessions $21.95,

Canada/Mexico $31.95, all other countries $49.95. Two-year (24 issues) subscription rate USA and

possessions $39, Canada/Mexico $55, all other countries $85. All subscription orders payable in U.S. funds

only via VISA, MasterCard, international postal money order, or check drawn on U.S. bank.

Direct subscription orders and subscription-related questions to Circuit Cellar INK Subscriptions,

P.O. Box 698, Holmes, PA 19043-9613 or call (800) 269-6301.

Postmaster: Send address changes to Circuit Cellar INK, Circulation Dept., P.O. Box 698, Holmes, PA 19043-9613.

ADVERTISINGADVERTISING SALES REPRESENTATIVE

Bobbi Yush Fax: (860) 871-0411(860) 872-3064 E-mail: [email protected]

ADVERTISING COORDINATORValerie Luster Fax: (860) 871-0411(860) 875-2199 E-mail: [email protected]

[email protected]

Page 3: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 3/66Circuit Cellar INK ® Issue 94 May 1998 3

I S S U E

I N S I D E

Practical Analog DesignBob Perri n

Antialiasing TechniquesM ike Zerkus

Selecting Position Transducers

Tom A nderson

PostScript FlutterwumpersD on Lancaster

I MicroSeriesEMI G one Technical

Pa rt 4: Transient -Suppression D esign Techniq ue

Joe Di Bartol omeo

I From the BenchRebirth of th e Z8

Part 2: Let Your Micro Answ er All

Jeff Bachi ochi

I Silicon UpdateFPG A Tool Tim e

Tom C antrel l

2

6

8

65

96

E

M B E D D E D

P C

12

26

3460

66

72

78

41 Nouveau PC

edit ed by H arv Weiner

46 RPC Real-Time PCG raphical U ser Interfaces in RTOSs

Ingo Cyl iax

54 APC Applied PCsA New View

Part 1: Virtual Instrumentation

Fred Eady

www.circuitcel lar .com

94 94

Task ManagerJanice Hughes

A Race Well Run

Reader I/O

New Product News

edited by Harv Weiner

Advertiser’s Index

Priority Interrupt

Steve Ciarcia

Design98—A

Marketer’s PICnic

Page 4: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 4/666 Issue 94 May 1998 Circuit Cellar INK ®

READER I/ONO NEED FOR DOOM

Many traf f ic l ights operate on processors that track

th e day of the w eek based on the date. This gives th em

the abili ty to run weekend and “ normal” schedules.

In the year 2000, a lot of these have clock chips

with only two digits of year, and the software will

believe that it’s 1900 (see Scott Lehrbuam’s “ Year

2000 and Embedded PCs,” I N K 90, for a clear exposi-

tion of the problem).

The fix, how ever, is simple. Instead of t rying to

w ork around a tw o-digit year, a l l you hav e to do is

supply a y ear to th e controller w hich is com patible for

the day of the week.

Secondly, th e new standard for all traf f ic l ights ,

digital road signs, traffic sensors, and so forth is calledNTCIP (w w w .ntcip.org). All this equipment is to be

cont rolled via TCP/IP and SN MP . Therefore, the fix

w ill be easy to implement.

Rod Price

[email protected]

INTEL INFO“ MicroBot ” (I N K 92) uses an Int el D 8479H cont rol-

ler, w hic h is con sidered an end-of-life part (developer.

int el.com /design/specenvn /seupdt 2/ind ex.ht m ), an d

th ere is no direct replacement . The suggested upgrade

path is the MCS-51 processor family, but it doesn’t

share the same instruction set and isn’t pin-for-pin

compatib le .

Although the Intel Publication #270646-005 (Em-

bedded Microcontrollers) is mentioned, its current

revision (-010) doesn’t contain information on the

8749. Rather than calling the general switchboard,

readers should contact Intel Customer Support at (800)

628-8686 (Fax : (916) 356-2892). The U RL for in form a-

tion on Intel Microcontrollers is developer.intel.com.If anyone is interested in building MicroBot, they

may be able to find 8749 parts from America II Corp.

(w w w .am ericaii.c om , (800) 767-2637).

Craig Miller

[email protected]

Page 5: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 5/668 Issue 94 May 1998 Circuit Cellar INK ®

NEW PRODUCT NEWSEdited by Harv Weiner

CONFIGURABLE DEVELOPMENT SYSTEMHOT Works, a H ardw are Object Technology development

system, bundles all the hardware and softw are you need to

experiment with configurable computing. HOT Works

includes t he Xilinx XC 6200 reconfigurable processing unit

and t he XC 4000 FPG A. Their open archit ecture and dedicated

microprocessor interface are ideal for rapid partial recon-

figuration from w ithin executable programs. The HOT Works

PC I plug-in board provides a stan dard platform for developing

application s using hardw are objects (digital lo gic designs

translated int o stat ic arrays).

The HOT Works package enables the h ardw are engineer

to im plement an d test designs in real time. The HO T Works

board lets the user examine the XC6200 family through

real-tim e emulat ion. And via a high-level hardw are-de-

scription lan guage, hardwa re-object t echnology, an d plug-in coprocessing board, th e softw are engineer can use this

development system for algorithm acceleration.

The package includes the Lola Program m ing System, w hich

is a simple hardw are-description la nguage for synch ronous

digital circuits, an d Xilinx’s XACTStep-6000, w hich is a m ap,

place, and route t oolset . Also featured is t he XC 6200 VHD L

Elaborator, a third-party t ool for converting VHD L to ED IF,

and t he Hardw are Object Technology Interface for inserting

designs into executable C programs (enabling run-time

reconfigurable computing). WebScope 6200, a Java tool for

real-time design emulation using the PCI-XC6200 board,

and design examples are included as well.Togeth er, the H OT Works PC I plug-in board a nd develop-

ment softw are kit sell for $995. The prototyping daughter-

board is priced at $199.

Virtual Computer Corp.6925 Canby Ave., Ste. 103 • Reseda, CA 91335(818) 342-8294 • Fax: (818) 342-0240www.vcc.com #501

SUPER-FAST 8-BIT MICROCONTROLLER

The SX Seriesmicrocontrollers from ScenixSemicon duct or deliver up to 50-MIPS processing

power at 50 MHz and suit m any applications con-

sidered the realm of 16- and 32-bit M C U s, low -end

D SPs, and cust om ASIC designs. This performan ce

lets designers use virtual peripherals—softw are

im plem entat ions of functions previously requiring

costly dedicated hardw are. This code occupies a

sma ll part of the onboard 2K × 12-bit fla sh m emory ,

requiring relatively few MC U resources for execution.

A four-sta ge (fetch , decode, execut e, writ e back)

pipeline executes one instruction per clock cycle,

yielding a 20-ns instruction cycle at 50 MHz. Afast (12-ns a ccess t im e) embedded fla sh program

memory and a correspondingly fast SRAM register

file give a deterministic interrupt response time of

60 ns for internal and 100 ns for external events.

The SX o ffers a 4-MH z (± 3% accu racy) program -

m able oscillator, program m able three-level brown-out

reset, and pow er-on reset. It has a w atch dog timer

w ith RC oscillator and multi-input w akeups, and

an on -chip analog comparator can be used w ith

hardw ired components or softw are techniqu es to

provide potentiometer or temperature-sensing

capabilities. The SX architecture contains 43 in-struct ions (33 are object-code com patible w ith

PlC16C5x MCUs).

The first production SX Series MCUs—the

SX18AC an d SX28AC—are 18- or 28-pin pa cka ge

(D IP, SSOP, and SO IC), 2048 word (×12) devices

priced at $3.49 in 1000 quantities.

Scenix Semiconductor, Inc.3140 De La Cruz Blvd., Ste. 200Santa Clara, CA 95054(408) 327-8888 • Fax: (408) 327-8880www.scenix.com #502

Page 6: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 6/66Circuit Cellar INK ® Issue 94 May 1998 9

NEW PRODUCT NEWSLOW-POWER C-PROGRAMMABLE CONTROLLER

The LP3100 low -pow er C -programm able controller

from Z -World operates on 3.3 V and con sum es only l6 m A.

Its pow er subsyst ems are independent , so resources can

be shut dow n to con serve power. This feature makes

the LP3100 ideal for operation in mobile or remote

insta llat ions, batt ery-pow ered embedded syst ems, and

OEM applications. Measuring only 2.5″ × 3.5″ × 0.5″,

th e LP3100 can be embedded

into the t ightest of spaces.

The LP3100 features 20

digital I/O lines, four cha nnels

of conditioned 12-bit analog

input , tw o RS-232 serial chan -

nels, an RS-485 port, 512-KB

flash memory, a real-time

clock/calendar, an d an LP Busexpansion port. The unit oper-

ates on input power in the

range of 3.5–24 VD C . The

LPBus expansion port facili-

tat es the addition of user-

designed boards for direct use

w ith t he LP3100 cont roller.

This unit comes equipped with a sleep mode, so it

can shut i tself dow n t o conserve power, reducing the

required current to 200 µA. Sleep mode is in voked by

softw are, and the real-tim e clock can be used to w ake

up the LP3100 at a specified date or time.

The LP3100 is available w ith a development kit t hat

includes a reference manual, serial cables, programming

cable, wa ll pow er supply,

development board, 2 × 20

LCD , and m ounting pla te .

Pricing for the unit s tarts

a t $119 in single quant ities .

Z-World2900 Spafford St.

Davis, CA 95616(530) 757-3737Fax: (530) 753-5141www.zworld.com

#503

Page 7: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 7/66Circuit Cellar INK ® Issue 94 May 1998 11

NEW PRODUCT NEWSMULTICHANNEL DATA-ACQUISITION CARD

The T8ADH provides eight channels of analog and

digital I/O on a credit-card–sized expansion board. All

eight channels are individually configurable as a 0–5-V

12-bit an alog input, a digital in put (w ith in put lat ch), or

a high-sink-current digital out put. D igital output and

analog input functions can coexist.

The T8ADH features five multidrop controllers

(D S2407), w hich prov ide five uniq ue 64-bit regist rat ion

num bers (8-bit fam ily code plus 48-bit serial num ber

plus 8-bit C RC ). These codes assure error-free selection

and absolute identity of t he device—no t w o parts are

alike. This uniq ue addressing m eans th at I/O fu nctions

can be identif ied absolutely , virtually eliminat ing

D IP-sw itch confusion.

The T8AD H has a bu ilt-in RS-232 to one-w ire

int erface, enabling netw ork expansion t o drive up to200 one-w ire devices (e.g., tem peratu re, pressure,

force, hum idity , pH, et c.) over 2000′ of Cat -5 tw isted

pair cable. All necessary pow er is derived from th e

RS-232 port, and all data transfers are CRC 16 error

checked.

An included DD E driver allow s interface to m ost

Window s application s. The T8ADH sells for $119.95.

Point Six, Inc.138 E. Reynolds Rd., Ste. 201Lexington, KY 40517

(606) 271-1744Fax: (606) 271-4695www.pointsix.com #504

Page 8: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 8/6612 Issue 94 May 1998 Circuit Cellar INK ®

Practical Analog Design

FEATUREARTICLE

Bob Perrin

aTime for a refresher

on op-amps? If so,

here’s the article for

you. Bob covers op-amps from the basics

of common op-amp

configurations and

modeling to the more

advanced aspects of

instrumentationamplifiers and complex

circuit designs.

nalog design is

fraught w ith snares

and pitfalls . In all t he

years I’ve been designing

mixed-signal instrumentat ion, I ’ve

made m y share of mistakes, but I ’ve

learned a bi t , too. I w ant to share some

practical circuit designs to m ake your

experiences easier.As you know, m any t exts cover op-

amp modeling in detail. Why? Because

op-amps aren’t simple devices.

A typical SPIC E model for a tran sis-

tor has a bout 30 parameters to describe

the transistor’s behavior. An op-amp

has 30 or more transistors. Imagine

the interaction of all of the various

transistor parameters.

OP-AMP BASICS

While real-life op-am ps are com plexassemblies, we can sti l l get a lot of

mileage out of simple models. I ’ll give

you a refresher course on common

methods for predicting the behavior of

op-amp circuits.

To begin, an op-amp is a high-gain

differential amplifier. The voltage

difference between the noninverting

(+ ) an d inv ertin g (–) inpu ts is a m pli-

fied by t he open-loop gain, Ao.

The m odel show n in Figure 1 pre-

dicts op-amp behavior reasonably well

for most circuits. There are of course

12

2634

60

Practical Analog Design

Antialiasing Techniques

Selecting PositionTransducers

PostScriptFlutterwumpers

FEATURES

Page 9: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 9/66Circuit Cellar INK ® Issue 94 May 1998 13

evaluated at t = 0, π = 3, results in

60,000 V/s or 0.06 V/µs. So, your ch osen

op-amp for this example circuit must

have a slew rate of at least 0.06 V/µs.

Ma ny com m on op-am ps (e.g., LM741,

LM324, OP 497) have slew rates aroun d

0.5 V/µs. Any of t hese would suff ice

here. By contrast, the OPA643 has a

respect able slew rat e of 1000 V/µs.

The out put resistance of the op-am p,

R o, is the f inal parameter I w ant todiscuss w ith respect to the m odel

show n in Figure 1. Ro is often mis-

taken as the out put resistance of the

overall amplifier circuit, Rout

.

In typical amplifier configurations,

the negative feedback desensitizes the

circuit to Ro. Therefore, th e out put

resistance Rout

is not the same as the

op-amp’s Ro.

As seen in Figure 3, the feedback

network attaches to the output pin of

the op-am p after R o. Negativ e feedbackdrives the output pin to the required

level. The circuit’s overall output

resistance is:

R ou t = R o

1 + A ob[1]

The feedback fact or, b , reflects the

att enuation of the output volt age before

i t is fed back into th e inverting input.

For the inv erting an d noninv erting

configuratio ns of Figure 3:

b = R 1

R 1 + R 2

Inverting a nd n oninverting amplif i-

ers have an extremely low output

resistance. However, Rou t

increases as

the frequency increases and Ao rolls

off , which is a result of Ao in t he de-

nominator of equation 1.

Ro l imi ts the m aximum current t he

op-amp can source or sink. Datasheets

most often give a maximum value for

short-circuit current. This parameter

G BP and think of the behavior show n

in Figure 2. By dividing G BP by th e

intended closed-loop gain, you got a

good idea of the bandw idth available

for the application. But, not anym ore.

The G BP in Figure 2 is const ant

anyw here along the slope of Ao. This

feature is wha t m akes G BP a useful

parameter for figuring out the usable

bandw idth. Not all devices have a

cons ta n t G BP .

Current-feedback amplifiers (CFAs)

have open-loop gain charact eristics t hat

depend on th e closed-loop gain. Inst ru-

ment at ion am plifiers (IAs) hav e G BP

characteristics t hat depend on t heir

internal topology and t he circuit gain.

G BPs for C FAs and IAs are horses

of entirely different colors. When you

select an op-am p for a h igh-frequency

application, look at all device param-eters , not just G BP.

For example, con sider Burr-Brow n’s

OP A643 op-am p. The dat asheet for t his

useful, economical w ide-bandw idth

device boasts a G BP of 1.5 G Hz, w hich

means, qualitatively , i t should be

useful at relatively high frequencies.

The device is a voltage-feedback

am plifier (versus a C FA). How ever,

w hen you look at a graph of Ao a s a

function of frequency, the open-loop

gain isn’t as w ell-behaved as that inFigure 2.

The datasheet also indicat es the

OPA643 is a noncompensated device

and only stable for closed-loop gains

greater t ha n 5 V/V. It can serve as a

10-dB video amp but is unsuitable as a

unity -gain follow er in a h igh-frequency

measurement system.

In addition to t he G BP, you need to

consider the slew rate in high-frequency

performan ce, which measures how fast

an op-am p can swing its output volt age.The op-amp m ust be able to sw ing the

output vol tage as fast as the m aximum

derivative of the highest frequency

component of the w ave form. Slew

rate is measured in V/µs.

Consider an amplifier designed to

provide 10 V/V gain fo r input signals up

to 1 Vp-p and 1 kHz. Maximum slew

rate would occur on an output wave-

form of (1 Vp-p × 10 V/V) 10 Vp-p at

1 kHz, right at the zero crossing. So,

ddt

1 0sin 2π1000t = 10 × 2π1000cos 2π1000t

many second-order effects this model

doesn’t taken into account.

Ao is the single most important

paramet er influencing op-am p behavior.

The open-loop gain is generally 106 or

107 V/V at D C . In the most com mon

op-amps (i.e., those that are internally

com pensated), Ao typically begins a

20-dB-per-decade rolloff starting at a

few h ertz. Figure 2 show s Ao as a

function of frequency.

Internally com pensated op-am ps have

a dominant pole at fo and trade open-

loop gain for stability. These are the

easiest op-am ps to design w ith because

th ey’re stable over the w idest range of

closed-loop gains a nd loa d im pedances.

Noncom pensated devices lack a

dominant pole at fo, enabling the ampli-

fier to perform well at higher frequen-

cies. How ever, the designer mu st ensurethe system remains stable. Datasheets

for noncompensated devices indicate

the range of stable closed-loop gains.

Both compensated and noncompen-

sated op-amps oscillate at some point

w hen driving some types of reactive

loads. A slightly capacitive load is

usually th e cause.

Noncompensated devices are most

sensitive to load impedance. Unless

you need good high-frequency charac-

teristics, using compensated devicesmakes life much simpler.

When you’re selecting an op-amp,

especially for a high-speed applicat ion,

i t ’s imperative to know the behavior of

Ao. Manu facturers talk about the gain

bandwidth product (G BP), w hich is the

product of Ao at unity gain (i.e., 0 dB

or 1 V/V) an d freq uen cy f t . The unit for

the G BP is Hz × V/V or hert z (usu all y

in the megahertz or gigahertz range).

In the good old days before market-

ers mu ddied th e w aters , you’d hear of

Figure 1— The first-order op-amp model is simple yet remarkably useful.

Vout

+

+ –

Ro

AoVin

Vin

NoninvertingInput

InvertingInput

A0 in

ft

GBP= 1 107( )V

V

Hz

f0

V

V

=10 MHz

106

105

104

100

10

1

105104103100101

103

107106

Hz

Figure 2—

In internally compensated op-amps, the open-loop gain has a dominant pole at f o .

Page 10: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 10/6614 Issue 94 May 1998 Circuit Cellar INK ®

is forced to th is same potential . Since

the tw o nodes are held at t he same

potential by t he negative feedback, and

that potential is not necessarily zero,

the inputs of the op-amps are said to

have a virtual short across them.

SECOND-ORDER EFFECTSNow that w e have examined op-am ps

at t he circuit level, let ’s go on t o m od-

eling and predicting behavior due to

second-order effects. D eveloping an

intuitive feel for these effects enables

you to select devices best suited to

your application.

Figure 4a show s how to m odel op-

amp input bias and offset currents. Ibias

is the t iny base current (or gate leakage)

the internal transistors need for opera-

tion. This value is orders of m agnitude

smaller for FET-based input stagesthan for BJT input stages [1].

Ioffset

results from the mismatch

betw een t he input transistors . Ioffset

is

typically one order of magnitude

smaller than Ibias

[1].

The polarity of Ibias

is constant and

predictable if th e topology of the input

stage is know n. How ever, Ioffset

may be

of either polarity.

To examine the effect of these

currents, remove the stimulus from

the circuit and look at the V o generatedby the offset currents. With the inputs

grounded, the inverting and nonin -

verting configurations become th e

same circuit. Figure 4b gives you a

glimpse of the circuit , assumin g that

Rcompensation

= 0.

This configuration offers no hope

for nulling offsets introduced by bias

currents , which is why Rcompensation

has

been added. Analyzing the circuit

w i t h Rcompensation

≠ 0 yields:

w here I+ = I

bias + I

offset and

I– = I

bias – I

offset.

To compensate for

the bias currents , s im-

ply set Rcompensation

equal

to the equivalent resis-

tance of R1

in parallel

w i t h R2. However, this

can be used to back calculate Ro fo r

modeling. Simply take the maximum

output volt age and divide it by t he

maximum source current to obtain a

value for R o.

CIRCUIT-LEVEL ANALYSISFigure 3 show s schemat ics and

equat ions for the tw o most comm on

op-amp configurations—the inverting

and noninv erting amplifiers. To analy ze

these, sum the currents at the invert-

ing node.

To simplify th e analysis , assume

Ro is zero. You greatly simplify the

analy sis, yet still obtain useful results.

Ot her nonideal characteristics can beanalyzed separately and, th rough t he

use of superposition, can be integrated

into a n overall circuit m odel.

Figure 3 show s the equat ions de-

duced using the above technique. To

further simplify, let Ao approach in-

f inity to obta in:

G ain inverting = –R 2

R 1

G ain noninverting= 1 + R 2

R 1

Keep in m ind that these

tw o ga in equat ions w ere

derived with much simpli-

fication. They don’t reflect

the effects of the open-

loop gain rolloff. How ever,

these are the most com-

monly used equations for

describing the behavior of

the circuits in Figure 3.

When the frequency

response of Ao is relevant

(e.g., w hen high closed-loop gains are

needed), use the equations in Figure 3.

I recomm end simulation t ools l ike

SPICE or MicroCap w hen you require

highly accurate predictions.

SPICE models take into account

second-order effects like bias currents,

offset currents, and offset volt age. You

can find detailed op-amp models for

virtual ly every comm ercial ly avai lable

op-amp. Most manufacturers supply

the models free of charge on the Inter-

net or on CD .

A common concept used to analyze

op-am p circuits is the idea of a “ virtual

ground” or “ virtual short , ” w hich mean

the sam e thing. The voltage on the

op-am p’s inverting n ode is forced by

the negative feedback to be at the sam e

potential as th e noninverting node.

This concept a ssumes that Ao ap-proaches infinity, therefore requiring

the dif ference betw een the in verting

and non inverting inputs t o approach

zero for Vou t

to be f inite .

As with all approximations, there

are times w hen this one is useful and

tim es when it ’s not. Figure 2 show s

Ao is generally pretty large at low

frequencies. So, the virtual-short idea

is most useful at low frequencies.

In the case of th e inverting am pli-

f ier , the term “ virtual ground” isapplied to the inverting input of th e

op-amp. The noninverting node is

held at ground. Negative feedback

forces the inverting node to be at the

same potential as the noninverting

node (i.e., ground). And, the inverting

input of the amplifier is said to be a

virtual ground.

The phrase “ virtual short” is used

for the noninverting amplifier. The

input signal is applied at t he nonin-

verting node, and the inverting input

Figure 3— Op-amps can be configured as inverting ( a )or noninverting ( b ) amplifiers.

Vout+

R2

Vin

R1

+ –

Gaininverting =

Vout+

R2

R1

Gainnoninverting =

Vin+ –

1 – 1b

1

1 + 1A ob

1b

1

1 + 1A ob

a)

b)

Figure 4a—

Input bias and input offset currents are modeled as separate independent sources.b— R compensation

provides a means of nulling the offset in V out

caused by I bias

.

Vo

+

+ –

Ibias

Ibias

Ios

2

I –

I+Noninverting

Input

InvertingInput

Op-Amp model from Figure 1

Vout+

R2R1

Rcompensation

I –

I+

a) b)

Vo = 1 + R 2

R 1

×

R 1 | | R 2 I – – R compensation × I +

Page 11: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 11/6616 Issue 94 May 1998 Circuit Cellar INK ®

doesn’t compensate for Ioffset

. The over-

all error reduces to:

Vo = 1 + R 2

R 1

–2 R 1 | | R 2 I offset

Since Ioffset

is typically an order of

magnitude less than Ibias

, adding

Rcompensation

(equal to R1| |R2) is usually

suff icient.Other methods to reduce error due

t o Ioffset

are to:

• keep R1| |R2 small

• keep R2 sma ll

Both inc rease pow er dissipation.

The tradeoff may seem simple, but a

quick look at a graph of Ibias

versus dice

tem peratu re reveals the insidious truth .

Man y op-amps, especially those w ith

FET input stages, increase Ibias expo-nentially as a function of t emperature.

D evices w ith superbeta input stages,

like the OP297 and OP497 from Ana-

log Devices, offer a good compromise

between Ibias

and the temperature

coefficient. Superbeta input stages

have moderately low initial Ibias

cur-

rents and do not suffer from

an exponential t emperature

dependence.

Increased power mean s

increased dice temperature.Evaluate the tradeoffs care-

fully .

Ioffset

is related to input

current noise. Intrinsic noise

on the dice creates a small

amount of f luctua t ion in

Ioffset

. This current noise w ill

develop into a voltage across

R1| |R2 and be multiplied

by :

A noise = 1 +

R 2

R 1

The noise gain (Anoise

) is th e same for

both inverting and nonin verting con-

figurations.

The op-amp input current noise is

typically very t iny—subpicoamps.

How ever, the vol tage noise at t he out-

put can become significant as current

noise is developed into a volta ge across

2× R1| |R2 and m ultiplied by A noise.

Op-amp noise is frequency depen-

dent. Datasheets always l is t tabulated

data , and bett er data sheets have graphs.

Anoth er source of error in op-am ps

is th e offset volt age (Vos

). The cause of

Vos

is the unavoidable mismatch of

devices and operating points on the

dice. Figure 5 show s the m odel for

offset voltage.

Vos

is highly tem peratu re dependent.

The polarity is unpredictable and may

reverse over t emperature.Using th e model in Figure 5 with

the circuit topology from Figure 4b

(w ith Rcompensation

= 0), I derive:

Vo = 1 + R 2

R 1

Vos = A noise × Vos [2]

Com pensating for Vos

can be accom-

plished via external nulling (i.e., intro-

ducing an external voltage at on e of

the op-amp inputs) or internal nulling(i.e., unbalancing one of the internal

differential pairs).

External nulling can be accom plished

by using a trimm er, digitally controlled

pot, or DAC to dial in t he required

compensation volt age. Internal null-

ing is accomplished by connecting a

trimm er to the offset pin or pins on

the op-amp. The device datasheet has

trimmer-value recommendations and

suggested configurations.

A common problem occurs when

multiple op-amps are chained in a

circuit. Each op-amp contributes an

offset to t he system. The most com -

mon q uestion asked is, “ D o I null each

op-amp’s Vos

or null the overall sys-

tem at a s ingle point?”

I lean tow ard nulling each op-amp

using internal nulling. I definitely shy

aw ay from nulling the entire system

offset using the int ernal nu lling on a

single stage. The latter is much sim-

pler but unreliable over temperature.

I f you use internal nulling t o intro-

duce a huge imba lance in a single stage

to compensate for the total system

offset, you are assured of temperature-tracking problems. The grossly unbal-

anced op-amp can’t track the overall

system offset.

I f you null each stage internally ,

the system offset remains as stable as

practically possible over temperature.

With the D C offset nulled, let ’s

turn our attention to noise on Vos

. All

Vos

noise, regardless of origin, show s

up in t he am plifier output m ultiplied

by Anoise

(see equation 2).

Intrinsic noise on the dice causesperturbations in V

os, w hich is referred

to as input voltage noise (Eos

). D ata-

sheets give tabulated data for Eos

.

The power supply induces another

Vos

noise. As the pow er-supply volta ge

fluctuates, the int ernal bias points of

the op-amp shift. Because Vos

is the

result of internal bias-point

m isma tch es, pow er-supply–

induced noise is modeled as

noise on Vos

.

The pow er-supply rejec-tion ratio (PSRR) is:

PSRR = ∆ Vos

∆ Vsupply

Another culprit introduc-

ing offset error is the com-

mon -mode voltage on th e

op-amp’s inputs. As the

voltage on the inputs is

raised or lowered, the op-

am p’s internal bias points

shif t and additional Vos

Figure 5— Input voltage offset is modeled by the inclusion of an independent voltage source in the simple model shown in Figure 1.

Vout

+

+ –

Ro

AoVin

Vin+ –

+ –

Figure 6a—

R 2 and C pole form a single-pole filter.b—

A virtual ground exists at the inverting input of U1, so C extra

has a virtual short across it.

+

R2

Sensor

R1

+ – +

– Analog

Mux ADC

OtherSensorTypes

Cpole

U2U1

+

R2

Sensor

R1

+ – +

– Analog

Mux ADC

OtherSensorTypes

Cpole

U2

Cextra

U1

a)

b)

Page 12: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 12/6618 Issue 94 May 1998 Circuit Cellar INK ®

develops. Thus, common-mode noise

can be modeled as noise on Vos

.

The common-mode rejection ratio

(C MR R) is:

C M R R = ∆ Vos

∆ Vcommon–mode

Both PSRR and CMRR generally

roll off w ith frequency. Som e devices—

especially chopper-stabilized amps—

have a notch in the rolloff . Alw ays

refer to graphs of these parameters,

and don’t forget that CMRR and PSRR

are referenced to Vos

.

I t ’s incorrect t o reason t hat i f you

have x VRM S

on your rail and the PSRR

is –60 dB, your out put w ill only see

x /1000 V of n ois e. Wrong!

Instead, you need to think, “ I f I havex V

RM S of noise on my rail , my noise

gain is 40 dB, and my PSRR is –60 dB,

then my output will see x /10 V of

noise.”

Well, the basics review is over. Now ,

let’s look at some real-life examples.

WATCH OUT FOR VIRTUAL SHORTSA num ber of years ago, I wa s devel-

oping a hand-held instrument w ith

optical sensors on a meter-long probe.

The signal paths to the sensor formedlong loop antennae. The functional

geometry for the in strument required

this suboptima l electrical configuration.

In my signal path, I had th e single-

pole low-pass filter/invert ing am plifier

show n in Figure 6a. I needed an addi-

tional pole to provide sufficient band

limiting of noise.

I added a capacitor as show n in

Figure 6b. I expected R2 and C

pole to form

the first pole, and R1 and C

extra to form

the second pole. On t esting the circuit, Ifound it behaved as only a single-pole

(R2 and C

pole) circuit.

After much w ai l ing and gnashing of

teeth (and a lit tle a lgebra), I realized

tha t Cextra

is at tached between a virtual

ground and ground. Cextra

had a virtual

short across it and w as therefore super-

fluous. I added my second pole with a

passive RC on the output an d obtained

satisfactory results.

As it turns out, Cextra

isn’t entirely

superfluous. The virtua l-ground concept

is predicated on t he assumption t hat

Page 13: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 13/66Circuit Cellar INK ® Issue 94 May 1998 19

Ao >> A

closed loop. As A

o rolls off and the

virtua l ground degrades, Cextra

enters into

the equation. The best way to analyze

th ese kinds of second-order effects is

wi th SPICE.

ANTIALIASING FILTER TRADEOFFSThe noninverting amplifier has an

interesting feature—an intrinsic zero.

By virtue of t he circuit t opology, there

is a zero that prohibits the closed-loop

gain from droppin g below 1 V/V (0 dB).The easiest w ay t o see this is to

review at the t ransfer function for a

noninverting amplifier:

Vou t

Vin

= 1 + Z 2

Z 1

Regardless of what Z2 and Z

1 do

(short of going negat ive), t he gain is

alw ays larger than unity . Keeping this

in m ind, let ’s compare the inverting

and noninverting topologies for use asantialiasing filters.

Figure 7 show s four circuits u sed as

ant ialiasing filters. Figure 7a allow s all

high-frequency n oise beyond funity

to be

aliased back into t he pass band w ith-

out att enuation. The circuit in Figure

7b has inverted gain but is vastly

superior to the circuit in Figure 7a at

attenuating high-frequency noise.

The circuit in Figure 7c uses t he op-

amp only as a gain block. A passive

netw ork (LPnet ) provides th e antia lias

function. This configuration doesn’t

att enuate the noise introduced into the

system by the op-am p, but other noise

is band limited by LPnet. The circuit

in Figure 7b is again superior to Figure

7c because Vos

noise is attenuat ed.

The w eakness in t he circuit in

Figure 7c is t he LPnet preceding th e

gain block. You might argue that

LPnet could follow the gain block for

improved noise attenuation.

But this newly proposed configura-

tion doesn’t present a low impedanceto the ADC . The AD C m ay load LPnet ,

thus introducing more error.

For example, the ADC ’s sample and

hol d (S/H ) m ay gul p current o ut o f

LPnet, and enter hold mode before

LPnet can deliver sufficient charge to

bring the volt age sampled up to the

proper value. A good rule of thumb is

to h ave an op-amp driving the input of

th e AD C ’s S/H.

If the Vos

noise (int rinsic, pow er-

supply induced, and com mon mode)in th e circuit show n in Figure 7c m ul-

tiplied by Anoise

is suitably small for

the application, t hen th is cir-

cuit is an acceptable solution.

If signal inversion is impor-

tant and high gain is required,

you can precede the circuit of

Figure 7b wit h a un ity -gain

inv ertin g st age (see Figure 7d).

The new stage introduc es a

small amount of noise. Anoise

fo r

a unity-gain inverting stage is

only 2 V/V.

The filter portion (U2 in Figure 7d)

band-limit s the newly int roduced noise.

As well, anot her pole can be added to

the f i l ter by placing a capacitor in t he

feedback loop of the unity-gain invert-

ing stage.

When you ’re designing filt ers around

a n oninverting amplif ier , a lw ays keep

in m ind the zero that exists as an

artifact of t he topology.

SINGLE-ENDED ANALOG STAGEFigure 8 illustrates a versatile single-

ended analog front end. The op-am p and

ADC can be powered by a single rail

supply while accepting bipolar or

unipolar inputs. Tiny signals can be

expanded to fill 0–Vref

. Large input

signals can be com pressed. The input

signal need not be center around zero.

For example a 4–20-m V range can be

m apped int o 0 – Vref

. If you select the

resistor values and Vref

properly, this

circuit serves almost any application.Input resistance versus gain is the

ma jor tradeoff to consider w ith t his

Figure 7a— The noninverting configuration has an intrinsic zero and does not allow attenuation below 0 dB. b— The inverting configuration permits attenuation below 0 dB. c—

LPnet continues to attenuate noise from V in independently of the op-amp gain stage. d— A two-stage antialias filter can provide high gain, low noise, low R

out , and excellent

frequency rolloff.

( )

Vout+

R2R1

Vin+

C

Z2=R2||C

0 dB

Frequency

f0= 1

2πR2C

Vin

Vout

funity

20 log ( )R2

R1

Z2

R11+Vout= •Vin

Vout+

R2R1

C

Z2=R2||C

0 dB

Frequency

f0= 1

2πR2C

Vin

Vout

20 log ( )R2

R1

–Z2

R1Vout=

Vin+

•Vin

Vout+

R2

R

R

Vin+ –

C

LPnet

+

R

Vin

R

+ –U1

+

R2

R1

U2

C

Vout

Gain –1 Low-Pass Filter

and DC Gain

a)

b)

c)

d)

Figure 8—

This versatile interface maps an arbitrary input range into 0–V ref

.

+

Rg

Vin

Rin

+ –

+V

Ain

Vref

GND

+V

Vout

R2

Voff

R1

ADC

To Micro-controller

Vref

Page 14: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 14/6620 Issue 94 May 1998 Circuit Cellar INK ®

+

–IA VoutRG

REF

circuit . Rin

must be large enough so

the circuit doesn’t load the sensor, but

small enough to allow the ratio Rg/R

in

to supply sufficient gain.

D esigning w ith th is circuit is simple:

• determine the sensor’s output volt-

age range

• determine the ADC’s input range

• determine the required gain (or at-tenuation). Deduce ideal values for

Rg and R

in.

• determine required Voff

. Deduce

ideal values for R1 and R

2.

• select standard resistor values

• verify input range maps to output

range with the selected resistor

values

• repeat the last tw o steps unt il satisfied

Let’s wa lk through t he procedure.

The governing equation is:

Vou t = Voff – Vin

R g

R in + Vof f

[3]

The first step is to figure out w hat

the application gain needs to be:

g = Vref

Vi n m a x – V i n m i n

From equat ion 3, you see that i f Voff

is 0, the circuit gain is:

g = –R g

R i [4]

Now , select Rg and

Rin

. Rin

should be as

high as possible to

avoid loading the

sensor.

Next, determine

Voff

. Note tha t the

circuit is an invert-

ing a mplifier. When

Vinmax

is applied, th e desired Vout

is zero.

Thus from equation 3, you obtain:

0 = Vof f – V i n m a x

R g

R in + Vof f

[5]

Using equat ion 4 an d rearranging

equation 5, you can determine Voff :

Vof f = Vi n m a x

g

1 + g

Now , pick R1 and R

2. R

1 and R

2 form

a volt age divider that dials in Voff

. You

can select R1 and R2 by using:

Vof f = R 1

R 1 + R 2

× Vref

Finally, pick st andard resistor values

and use equation 3 to verify that the

design maps the Vsensor

range in to t he

VAD C

range.

If a pole is needed, you can add one

by placing a capacitor in the feedback

loop.

The circuit i n Figure 8 is show n as

an input int erface. How ever, the same

topology can be used to condition the

output of a DAC. A bipolar output is

possible if a negative rail is available.You can use this circuit to m ap any

arbitrary input range to any arbitrary

output range. This is restricted only by

practical limits of available components.

COST-EFFECTIVE LOW-NOISE RAILTo supply clean pow er to low -noise

analog circuits , you can add a l inear

regulator just for the analog section.

Modern mic ropow er am plifiers don’t

need huge amounts of current. Regu-

lators are bulky, and dropout voltageis alwa ys a concern. In m any cases, a

dedicated regulator is overkill.

In some cases, the nif t y circuit in

Figure 9 m ay be an a lmost free solution.

It uses th e followin g concepts to pro-

vide a low -noi se pow er rail [2]:

• PSRR characteristics of the op-amp

• Ro desensitivity

• th e high input im pedance of the

noninverting node

• l ow Anoise

The op-am ps are capable of sourcing

several milliamperes, which is often

enough current to drive many micro-

pow er analog stages. An op-am p in a

SO T-23/5 pack age a nd a cou ple 0402

passives may occupy less board space

than a bulky linear regulator.

I f the circuit already has an extra

op-am p (e.g., in an existin g dual or qu ad

package) powered from a noisy rail , thetw o resistors and capacitor are all you

need for a low -noise pow er rail for

your quiet ana log section.

INSTRUMENTATION AMPLIFIERSInstrum entat ion a mplifiers (IAs) are

differential. They have a schematic

sym bol similar to op-am ps, but are not

op-am ps. Figure 10 show s its sym bol

and a t hree op-am p implementa t ion of

it. IAs can be built from discrete com-

ponents or purchased as single chips.The voltage betw een t he inverting

and noninv erting inputs is amplified by

the IA’s gain. This gain is usually set

by a single resistor, Rg. Single-chip IAs

are oft en c apabl e of 1–1000 V/V gains.

The IA’s tw o input op-am ps are con-

figured as noninverting a m plifiers. They

provide the IA’s high-im pedance input

charact eristics tha t it ’s know n for. The

output op-amp is configured as a dif-

ferential amp. The overall IA gain is:

IA gain = 1 + 2 R 1

R g

R 3

R 2

Although other

implementa t ions

of IAs exist [1],

the one in Figure

10 is the most

widely known.

The advent of

th e single-chip

monolit hic IA is a

boon to instrumen-Figure 10— Today, $3 can buy a single monolithic chip with a full-blown instrumentation amplifier.

+

+

R3

R2 R3+

InvertingInput

NoninvertingInput

Vout

OutputREF

R1

R2

RG

R1

Figure 9— A spare op-amp can be used as a low-cost voltage regulator.

+

Noisy Rail

C1

+V

QuietRail

R2

R1

Page 15: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 15/66Circuit Cellar INK ® Issue 94 May 1998 21

tat ion engineers. In the not -

so-good old days, a circuit

designer had to build an in-

strumentation amp from

discrete op-am ps and resistors.

It looked pretty good on paper,

but in practice, matching the

discrete resistors w as diffi-

cult a nd perform ance suffered.

For an IA to achieve CMRRs on the

order of 120 dB, th e resistors m ust be

precisely mat ched in value and tem pera-

ture coefficient. The mism atch es associ-

at ed w ith 1% resistors in discrete

designs w ere often una cceptable in high-

precision applications. Also, careful

consideration was needed to keep the

resistor pairs isothermal.

The single-chip IAs offer superbly

matched components. With all the

parts on a single die, everything staysisotherma l. Laser trimm ing of internal

resistors guarantees maximum preci-

sion. Monolithic IAs save board space,

reduce component count , save money,

and m aximize performance.

Some m anufa cturers have single-chip

IAs wit h chopper-stabilized front ends.

These devices are designed to m inim ize

Vos

. For example, the LTC1100 from

Linear Technologies has an admirable

Vos

of 10 µV. This device has a n in ter-

nal oscil lator and internal caps tosupport the chopper stabilization.

Figure 10 show s tha t both in puts of

the IA have a high impedance. Nota bly,

10 G Ω is a fairly comm on equivalent

input resista nce for an IA. This, coupled

w ith high CM RR and a w ide range of

gains, makes the IA an easy-to-use

and v ersati le tool.

IA THERMOCOUPLE CONDITIONERA thermocouple is a junction of dis-

similar metals t hat produces a voltageproportional to temperature. Thermo-

couples typically ha ve an a bsolute

accuracy of only a degree or tw o C el-

sius. How ever, thermocouple mea-

surements are extraordinarily stable

and repeatable.

In a calibrated system, temperature

∆s of 0.001°C ca n be reliably measured

w ith thermocouples. Figure 11a show s

a sim ple therm ocouple (TC ) int erface.

R1 prevents the h igh-impedance input s

from developing sufficient charge to

drift outside of the supply rails.

Figure 11b offers a remedy for noise

induced on t he sensor leads. The ferrite

bead and tw o capacitors form a com-mo n-m ode filter. The tw isted pair

ensures noise is picked up equall y on

both conductors.

Briefly, let’s explore how m uch load-

ing error is introduced into t he measure-

ment by the IA and common-mode

filter in Figure 11b. The leakage resis-

tance of an X7R dielectric ceramic

capacitor is about 10 G Ω. The addition

of the two capacitors cuts the DC

input resistance seen by the thermo-

couple by t w o-thirds, putt ing about a3-G Ω load on t he thermocouple.

Thermocouples are often modeled

as a volt age source w ith a series source

resistan ce, Rs. The size and ty pe of junc-

t ion determine the value of Rs. For my

needs, 10 Ω is a reasonable value for Rs.

The load resistance (3 G Ω) and Rs

(10 Ω) form a volt age divider, wit h th e

tap of t he divider being the actual

voltage observed. The loading error is

only about three parts in a bil l ion.

This is a negligible effect for thermo-couple applications.

Minim al loading of the TC , high

C MRR, high P SRR, and dif ferential

front end are needed to measure tem-

peratu re changes on th e

order of millidegrees

C elsius. IAs provide a

simple and economical

solution for applica-

tions measuring small

temperature changes.

For example, con-

sider a microcalorim-

eter. The ma ximu m expected ∆ is 10°C .

The ty pical output of a t ype-E thermo-

couple is 60 µV/°C. I f the system has

a 2.5-V full-scale ADC, then the gain

on t he IA must be:

2.5

10 × 60 × 10 –6 = 4166 V/V

This is achievable with a single $3

eight-pin IA from Burr Brow n—the

INA118.

CHOP TO NULL SYSTEM OFFSETOffset voltage is still a caveat. IAs

have an offset volta ge much like op-

amps. For many IAs, this offset is

around 100 µV. In high-gain systems

like a microcalorimeter, Vos

can be a

major problem (4166 × 100 µV = 0.42 V

of offset at the output).

C hopping the input is a technique

for reducing offset voltage. Two mea-

surements are made of different quan-tit ies. Since the offset volt age show s

up in both m easurements, a subtrac-

tion drops out the offset voltage.

Many chopper-stabilized ICs make

a m easurement of t he input voltage,

then in ternally measure a ground

potential . The tw o measurements are

subtract ed and presented to th e output.

All of this goes on internally and is

transparent to t he external circuit .

For high-gain applicatio ns, selecting

an IA w i th low Vos is a good start. Twolow -offset n onch opper-stabiliz ed IAs

are Analog Devices’ AD620B and Burr

Brown’s INA118 wit h a Vos

of 50 µV.

The INA118’s Vos

depends on the gain

setting and can be as much as 300 µV

at unity gain. The Linear Technology

LTC1100 is an internally chopper-

stabilized IA wit h a Vos

of only 10 µV.

C hopping externally t o t he IA is an

outst anding and tim e-proven technique

for reducing chan nel offset. Figure 12

show s a signal-conditioning circuit that

uses chopping to null t he system offset.

Figure 11a— A low-cost instrumentation amplifier can provide a nearly ideal thermocouple interface. b— A common-mode filter

and twisted-pair sensor cable clean up induced common-mode noise.

TC +

– VoutRG REF

INA118

Single Ferrite Core

C1 C2

R1

TC+

– VoutRG REF

INA118

R1

a) b)

Figure 12— Chopping the input signal enables the nulling of system offset in software.

Sensor +

RG

REF

Vsens+

+V

–V

IA ADC

AntialiasFilter

+ –

Vsens–

Page 16: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 16/6622 Issue 94 May 1998 Circuit Cellar INK ®

This technique nulls the offset associ-

ated with the entire measurement

channel, not just t he IA Vos

.

The sequence of events in a mea-

surement cycle is:

• the input mux is set such that Vsens+

routes to the noninverting input and

Vsens– routes to t he inverting input

• a measurement is taken with the

ADC: M1 = (Vsensor

+ Vos

) G ain

• th e input m ux is reversed such th at

Vsens+

routes to th e inverting input

and Vsens–

routes to the noninverting

input .

• a measurement is taken with the

ADC: M2 = (–Vsensor

+ Vos

) G ain

• compute:

Vsensor = M 1 – M2

2 × G ain

When M1 – M

2 is computed, the V

os

introduced into th e measurement

drops out.

For chopping to w ork, measurement s

M1 and M

2 should be taken as closely

together in time as possible. Norma lly,

the l imiting factor is the settl ing time

of th e system’s ant ialiasing f i lter .

Burr-Brow n has an excellent app note

on fa st-sett lin g low -pass filt ers [3].

A major advantage of the chopped

input technique is the abili ty to nullthe system offset w ith each m easure-

m ent. In real-w orld system s, syst em

offset voltages drif t with time and

temperature. This technique enables

the system to compensate for the

unpredictable drift of offsets.

IA RESISTIVE BRIDGE SENSORINTERFACE

High input im pedance m akes the IA

ideal for measuring resistive bridge

sensors. St rain gages, pressure transduc-

ers, RTDs, and load cells are common

exam ples of resistive bridge sensors.

Bridge transducers are balanced or

unbalan ced. Balanced bridges use feed-

back to force the voltage on the differ-

ential nodes to be the same by tw eaking

one or more resistive elements in the

bridge. Un balanced bridge system s sim-

ply measure the voltage on the differ-

ential nodes.

Both systems rely on precise mea-

surement of the volt age across the

differential nodes. This work demands

a high-impedance differential ampli-

fier—an IA.

Figure 13 show s a m easurementsystem using an IA as the bridge inter-

face. The IA am plifies th e volta ge across

the differential nodes of the bridge.

The ADC measures both t he output

of the IA and the excitation v oltage on

the top of the bridge.

From these two quantities , the

controller determines the m agnitude

of the physical s tim ulus on t he bridge.

The exact determina tion of t he value

depends on the bridge characteristics.

Typical strain gages have bridgeelements betw een 120 and 350 Ω [4].

The IA has an input impedance a

hundred million tim es greater, and th e

loading effect is negligible.

In a st rain-gage or RTD application,

the full-scale differential out put volt age

m ay on ly be 10 mV. IA gains of 60 dB

(1000 V/V) are t herefo re req uired t o

bring the signal up to typical w orking

levels, but t hat ’s not a problem for IAs

like the AD620.

As w ith high-gain th ermocoupleapplications, V

os m ust be considered in

the system design. For example, the

50-µV Vos

of the AD620 times 60 dB

yields an ou tput-voltage offset of 50 mV.

If the full-scale out put v oltage is 10 V

and m easured wit h a 12-bit ADC , the

offset in trodu ced by t he IA is 20.4 codes

out of 4096. This error is m anageable

and can be removed in softw are.

Bridge transducers are often located

on long cables, w hich tend to pick up

common-mode noise. Multiples of 50

and 60 Hz are the most common.

The high CMRR of IAs effectively

reduces this unw anted noise. Com mon-

mode RF can be signif icantly a tt enu-

ated by ferrite beads (see Figure 11b).

The single-chip IA great ly sim plifies

the job of the analog instrumentation

engineer. M easuring bridge circuits is

still considered somew hat of an a rt. For

most of us, precanned IAs reduce the

problem to the paint -by-num bers level.

PRELOAD COMPENSATIONA sensor preload is a load that is

undesired but necessary for the mea-

surement. For example, a load cell in

a digital scale ma y use a bowl t o hold

th e product being measured. The bow l

is a preload.

One w ay t o null a preload is to

sam ple the sensor wit h the preload and

subtract the preload from subsequent

measurements in softw are. At f irst

glance, this softw are nulling technique

seems like a good solution. But, thetradeoff for simplicity is dynam ic range.

For example, consider a system w ith

a 0–10-V ADC input corresponding t o

a 0–1000-g stim ulus o n t he load cell. If a

500-g bow l is placed on t he load cell, t he

AD C sees a 5-V preload. The rem ain ing

5–10-V range is still available for mea-

surement, but half the system’s dy-

namic range is lost to the preload (see

Figure 14).

If a 1000-g limit is determined by the

system gain settings and not the loadcell’s capacity, you can restore the

dynam ic range of the system via a pre-

load-compensation circuit. For Figure

15’s circuit to w ork, the load cell must

measure the m aximu m expected preload

plus the maximum load due to product .

For the sake of discussion, let’s say

th e system needs to m easure 0–1000 g

of product w ith u p to a 1000-g preload.

So, the load cell must be capable of

measuring 2000 g.

The microcontroller sets the DAC

and m ux to generate a com pensating

Figure 13— Instrumentation amplifiers can measure unbalanced bridge transducers without significant loading.

+

– REF

ADC

Ain0

Ain1

+V

To Micro-controller

Figure 14— ADC resolution and dynamic range are

expensive. Don’t trade them away in a simplistic nulling scheme.

UsableDynamicRange

Preload – ½ of

DynamicRangeWasted

– ½ of ADCResolution

Wasted

Load1000 g

500 g

0 g

Voltageat ADC

10 V

5 V

0 V

1-kg Scale with 500-g preload

Page 17: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 17/6624 Issue 94 May 1998 Circuit Cellar INK ®

volta ge equa l to th e preload voltage on

th e sensor (but of opposite polarit y). The

summ er adds the sensor output and

compensating voltage. Once the DAC

section is set up, the output of t he sum-

m er is zero when t he preload is present.The ADC now sees 0 V when t he

bowl is preloading the load cell. As

product is placed in t he bow l, the load

on the sensor increases and the sum-

mer’s output increases. The ADC sees

a voltage corresponding only to the

product w eight, an d th e full 0–10-V

range is available for measuring prod-

uct. The system’s usable dynamic

range is restored.

This technique differs from gain-

sw itching schemes because the productplaced on the sensor is alw ays m easured

in a z ero to full-scale range for the AD C .

So, regardless of the preload, the scale

always has the same resolution. Using

the full range of the AD C for product

measurement ensures maximum

resolution.

There are l imitat ions to this t ech-

nique based on sensor linearity and

D AC v ersus ADC resolution. Although

I’ve simplified the technique, you can

get a good start w ith t he topologyshow n in Figure 15.

G ain-sw itching schemes can be

combined with this nulling technique

to provide an overall system capable

of incredibly fine measurement reso-

lution while accommodating a huge

preload.

If the G ain block in Figure 15 is

programm able, we could have a high-

gain m ode and a low -gain m ode. For

example, low -gain mode, m ay m ap 0–

1000 g of sensor stimulus to 0 to full-

scale on the ADC. High-gain mode

may map 0 to 1g of

sensor stimulus to 0 to

full-scale on the AD C .

Consider again the

case of t he 500-g bow l

on the sensor. To com-

pensate for the preload:

• the microcalorimeter

selects low -gain mode

• t he 500-g bow l is m ea-

sured, and th e DAC sec-

t ion is set to null the

preload

• the microcalorimeter

selects high-gain mode

• the microcalorimeter tweaks with

the DAC until any remaining pre-

load disappears (th is step assum es

the D AC is very high resolution,

which is a s implif ication)

Next the user places product—e.g.,

25 m g of salt—int o the bow l. In high

gain m ode, the system gives the user

m axim um resolution in th e 0–1-g range.

If the user pours ano th er 750 g of salt

into the bowl , th e system sw i tches to

low -gain m ode and gives a resolution

corresponding to the 0–1000-g range.

The tech niq ue in Figure 15 is a versa -

tile and pow erful met hod of preload

compensation. For applications w here100% of the AD C ’s dynam ic range must

be used, Figure 15 offers a good start-

ing point . For less-deman ding applica-

tions, a combination of gain switching

and pure softw are nulling suffices.

INFO YOU CAN USEI’ve review ed op-am ps, as w ell as

examining some int eresting m istakes

and some excellent interface circuits.

I didn’t discuss PCB-layout consider-

at ions, but th is topic is w ell-coveredelsew here [5].

As you’ve seen, analog design is

full of tradeoffs. Models help, and

SPICE is a great tool. But, not hing

beats gaining insight and int uition by

examining other people’s successes

and failures. I

I R S401 Very Useful402 Moderately Useful403 Not Useful

REFERENCES

[1] S. Franco, “ Pract ical O p-Amp

Limita t ions, ” D esign wi th O pera-

t i onal A m pl i f ie rs and Analog

Int egrated Cir cui ts , McGraw -Hil l ,N ew York, N Y, 188–241, 1988.

[2] C.D. Motchenbacher and J.A.

Connel ly , “ Capaci ty M ult ipl ier

Filter ,” Low N oise Electronic

System D esign , John Wiley & Sons,

N ew York, N Y, 309–310, 1993.

[3] Burr-Brow n, Fast Sett l i ng Low

Pass Fil t er , App N ot e AB-022, 1994.

[4] K. Hoffm ann, “ Selection C riteria

For Strain G ages,” An In t roduct ion

to M easurements U sing Strain

Gages , Hott inger Baldw in Mess-technik G mbH, D armstadt , G er-

many, p. 58, 1989.

[5] B. Baker and J. G raeme, “ System -

atic Approach Makes Op-Amp

C ircuits Resist Radiat ed Noise,”

ED N , 40:15, p. 93, 1995.

Bob Perrin current ly w orks for Z-World.

H e has designed m ix ed signal i nstru-

m entat ion for agronom y research,

food science, harsh-environm ent in dus-

tr i a l comput ing, and emb edded con-

Figure 15— Preload compensation can be accomplished without sacrificing dynamic range.

IA

ADC

Ain0

Ain1+

+

Gain

Op-AmpSummer

AntialiasFilter

+

R

Vout

R

x(–1)

x1

DAC

S e l e c t

Mux

Micro-Controller

+V

SOURCES

OP297 and OP497 op-amps, AD620B

instrumentation amplifier

Analog D evices

One Technology WayN orw ood, MA 02062-9106

(781) 329-4700

Fax: (781) 461-4261

w w w .a na log .com

OPA643 op-amp, INA118 instru-

mentation amplifier

Burr-Brow n C orp.

P.O. Box 11400

Tucson, AZ 85734-1400

(520) 746-1111

Fax: (520) 741-3895

www.burr-brown.com

LTC1100 instrumentation amplifier

Linear Technology Corp.

1630 McCarthy Blvd.,

M ilpit as, C A 95035-7487

(408) 432-1900

Fax: (408) 434-0507

w w w .l inear-tech.com

tro l . You m ay reach Bob at bperr in@

zwor ld .com.

Page 18: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 18/6626 Issue 94 May 1998 Circuit Cellar INK ®

Antialiasing Techniques

FEATUREARTICLE

Mike Zerkus

aTo get rid of aliasing

in an ADC system,

you can use linear

active filters, switched-capacitor filters, ….

You also better know

when a filter isn’t the

answer. So, check

out Mike’s hints for

anticipating as wellas solving aliasing

problems.

liasing can

contaminate any

ana log-to-digita l pro-

cess, but it’s poorly un-

derstood by most engineers. Much of

the time, aliasing causes poor data

quality . In the worst case, aliased data

is accepted and analyzed as fact with-

out an yone ever suspecting tha t t hedata is bogus.

But, t here’s good news, too. Aliasing

can be spotted and eliminated if you

apply a few sim ple rules of thum b.

Aliasing is the creation of a false,

low -frequency signal. The false signal

is the result of an insuff icient sam ple

rate of a high-frequency signal.

Aliasing can take many forms. One

comm on exam ple is the apparent

backw ard motion of spoked wagon

w heels in old w estern m ovies. Thew heels appear to spin backw ard because

the cam era’s fram e rate is slow er than

the w heels ’ angular velocity .

As the wagon s lows dow n, the

w heels apparently change direction,

speed up, s low dow n, and stan d sti l l

until the wagon is s low enough that

the cam era can capture the true mo-

tion of th e w heels . Strictly speaking,

th is is c alled t emporal a liasing [1].

Spatial aliasing is the jagged edge

you som etimes see on lines draw n on

a computer screen. A chord played on

a musical instrument is another type

of aliasing, pleasing to the ear if done

correctly .

Of int erest here, how ever, is aliasing

th at a ffects A/D conversion. In this

article, I assume you have a prior

know ledge of ADC s, a general knowl-

edge of filters, and a desire to cut

through the t heory and get t o a few

helpful tips. How ever, if you need a

refresher, check out Bob Perrin’s “ High-

Resolut ion AD Cs” (I N K 74) or D esi gn

of Acti ve Fi l ters w it h Experim ents [2].

ALIASING IN AN ADC SYSTEMAliasing most often appears as a

very low -frequency roll in the dat a ,

almost indistinguishable from a DC

drift. The aliasing is caused by noise

w hose frequency is greater than t he

Nyquist frequency.The noise is undersampled, and the

difference betw een the noise and the

Ny quist frequency appears in t he

data. The amplitude of the false signal

depends on th e amplitu de of the noise.

THE NYQUIST FABLEThe Nyquist rule says that the

minim um sample rate required to

describe a signal is at least t w o tim es

the frequency of interest [3]. This rule

only works when the signal to besampled has no frequency com ponent

great er tha n h alf t he sam ple rate [4].

In the real w orld, everyth ing has

noise. So, every frequency above half

the sample rate is aliased or folded

back an d appears as low -frequency

components of the signal. The closer

in frequency th e noise is to th e Ny-

quist frequency, the low er the fre-

quency of the contaminat ion of the

data [5, 6, 7, 8].

Now, suppose you’re building anADC system. The signals you’re try-

ing to transduce are between DC and

Figure 1—

This hypothetical A/D system is set up with a 10-Hz signal and 60-Hz noise.

ADC Processor

Sample Rate119.95 samples

per second

SignalDC to10 Hz

60-Hz Noise

+

Page 19: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 19/66Circuit Cellar INK ® Issue 94 May 1998 27

ALIASING AND SOFTWARE

Contrary to popular

belief, it isn’t possible to

remove aliasing wit h soft-

w are. Once th e signal is

acquired, there’s no w ay t o

tease apart t he real low -

frequency com ponents of

the signal and any arti facts

caused by aliasing [8].

Aliased contamination is

sometimes masked by DC

offset in t he signal as w ell

as genuine low -frequency

noise. Keep in m ind th at, in

a system with a sample rate

of 10,000 sam ples per second,

60 Hz is low -frequency noise.

The only real solution t o

aliasing in a typical ADC

system is a good old-fash-ion ed low -pass an alog fil ter [9]. The

filter’s cut-off frequency should be

above the highest frequency t o be

transduced and below t he Nyqu ist

frequency of t he system.

Now , this example may be contrived,but the problem is obvious. In the real

w orld, the noise is never monot onic.

The closer the noise frequency is to

the Nyquist frequency, the lower the

frequency of the al iased contaminat ion.

10 Hz in frequency. Your

system is going to operate

in a room brightly l i t with

fluorescent lam ps, which

are producing 60-Hz noise.

As the sample rate, let’s

choose 119.95 samples per

second. What happens?

Figure 1 show s a block

diagram of the system, and

Figure 2 illustrates the

noise and signal w ave-

forms. The Nyquist fre-

quency of the system is

59.975 Hz. The 60-Hz noise

is undersampled and folds

back.

The beat frequency be-

tw een th e sample rate and

the noise (i.e., 60.000 –

59.975 = 0.025 Hz) appears in thedata. Because 0.025 Hz is in the fre-

quency range you’re transducing, you

aren’t a ble to distinguish betw een t he

aliased signal and a real signal, as

show n by t he graphs in Figure 3.

Figure 2— These waveforms (10-Hz input and 60-Hz noise) are input to the A/D system shown in Figure 1.

0.000 0.050 0.100 0.150 0.200 0.250 0.300 0.350 0.350 0.400 0.500

10.000

8.000

6.000

4.000

2.000

0.000

–2.000

–4.000

–6.000

–8.000

–10.000

Time (s)10-Hz Noise 60-Hz Signal

0.000 0.050 0.100 0.150 0.200 0.250 0.300 0.350 0.350 0.400 0.500

15.000

10.000

5.000

0.000

–5.000

–10.000

–15.000

Time (s)

0.000 0.050 0.100 0.150 0.200 0.250 0.300 0.350 0.350 0.400 0.500

15.000

10.000

5.000

0.000

–5.000

–10.000

–15.000

Time (s)

Figure 3—Here’s the data as seen by the processor shown in Figure 1. a— The wave actually looks like this, with a

10-Hz signal combined with 60-Hz noise, sampled at 300 samples per second. b— This graph represents 0.5 s of a 10-Hz signal combined with 60-Hz noise, sampled at 119.95 samples per second. Note that there is no apparent distortion of the wave. If we don’t know the noise is present, this is exactly what we expect to see. c— This graph represents 25 s of a 10-Hz signal combined with 60-Hz noise, sampled at 119.95 samples per second. The slow roll in the data amplitude, caused by the undersampling of the aliased 60-Hz noise, is only apparent when you view a long data record.

a) b)

c)

Page 20: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 20/6628 Issue 94 May 1998 Circuit Cellar INK ®

frequency of interest is closer to the

Ny quist frequency, an elliptical f i l ter

provides a steeper rolloff. But then,

you have to l ive w ith ripple in the

pass and stop bands.

ANTIALIASING FILTERSThe simplest antialiasing filter is a

capacitor betw een the signal and return.

Strictly speaking, this one-pole RC

filter is not the optim al solution (R is

the out put im pedance of the signal

source).

However, I think it ’s important to

mention this option because there

have been so many times I’ve been

called in af ter a system w as built and

th ere w as no hope of redesigning an y-

thing—and, naturally , the customer

needed the system u p and running

right aw ay. Hey, a capacitor is bett erthan noth ing.

So, use the reactance formulas,

pick the best value, and solder it in.

C heap but effective, a w ell-placed

capacitor can reduce aliasing and

improve system performance. Some-

times, that’s all you can do.

Passive filters introduce the least

amoun t of extra noise into th e signal,

but t here is insertion loss or attenua-

tion of the signal’s DC portion [6].

Passive filters are most appropriate forant ialiasing w here cut -off frequencies

exceed 50 kHz or in situat ions w here

power is un available.

Active filters provide the best all-

around solution because they’re easy

to implement. A variety of active

solutions exist , an d the f i l ter can hav e

gain greater than one.

DO IT YOURSELF…G enera lly , an ADC system has

some type of amplifier sitting be-tw een the signal source and the ADC ,

and th is amplif ier can sometim es

serve as a filter.

There are a lot of implementations

of active filters using op-amps [1, 11].

Figure 5 show s a Sallen-Key im ple-

mentation of a fourth-order Butter-

w orth filter I’ve used wit h good results.

The trick to getting good results

when building up your own active

filters is to prototype and test. By

building your ow n f i l ter , you can save

a lot in parts , but be sure to w eigh

Of course, as w ith all t hings,

there are tradeoffs. In most situ-

ations, a flat-pass band is more

important than a steep cutoff .

But, th at’s only true provided

that there is enough cutoff to

stop the aliasing.

Figure 4 show s pass- an d

stop-band characteristics of

various filter types [10]. The

corner frequencies of the anti-

aliasing f i lter must be betw een

the highest frequency of interest

and the Nyquist frequency.

You want to place the ant i-

aliasing filter as close as possible

to the input of the ADC. Also,

the f i l ter should have as many

poles as possible, wit h eight being a

general , practical l imit for most sys-

tem s. The aliased noise must be below the noise l imit of the system at the

Nyquist frequency.

If you observe th e 10× rule [4],

w here the sam ple rate is chosen t o be

ten t imes the h ighest frequency of

interest, then a Butterw orth f i l ter is a

good all-around choice. If the highest

There are several approaches to

this kind of filter problem. So, let’s

review them.

PASS BANDS AND POLYNOMIALSPeople have w ritten volumes about

w hich f i l ter is the best. What’s th e

bot tom l ine? Go w i th t he f la t tes t pass

band and th e steepest cut off at the

Ny quist frequency that you can afford.

Figure 4— This graph compares typical low-pass filter transfer functions [10].

50

–5 –10 –15 –20 –25 –30 –35 –40 –45 –50 –55

–60 –65 –70 –75 –80 –85 –90 –95

–100

f/fr

A m

p ( d B )

.1 .15 .2 .3 .5 .7 1 1.5 2 3 4 5 7

8-Pole ButterworthLow Pass

8-Pole 0.5-dBChebycheffLow Pass

7-Pole Causer Elliptic

Page 21: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 21/66Circuit Cellar INK ® Issue 94 May 1998 29

These devices are availa ble in several

response curve formats and frequency

ranges. Filter m odules represent th e

easiest, most direct w ay out of an

aliasing problem, but t hey certainly

aren’t the cheapest option.

READING THE VOLTAGEIf the system in question just needs

to read a voltage from time to time,

your frequency of interest is 0 Hz(DC). This means that your sample

rate should be at least 2 × 0 Hz = 0 Hz,

w hich doesn’t m ake sense until you

realize that all frequencies are aliased

in this situation.

Luckily , this is the one situation

w here softw are can help because any-

this against t he added PC B real estate

and added design time.

…OR OFF THE SHELFSome excellent linear active-filter

chips are on the m arket, on e good

exam ple being the M AX275 from

Maxim. As Figure 6 demonstrates,

this eight-pole analog active filter can

be configured for a variety of transfer

functions. Maxim sells a DOS soft-

w are package to help determine t he

proper value of passive components.

Using a linear filter chip can save

design time and provide more consis-

tent results . Another company with a

great line of filters, Linear Technol-

ogy, offers a Window s filter design

program on CD-ROM.

SWITCHED-CAPACITOR FILTERSAnother option—the sw itched-

capacitor filter—is an active filter that

uses electronic swit ching of a capacitor

to imitate a high-order filter. Several

man ufacturers produce sw itched-

capacitor filter chips.

The filt er’s cut-off frequency is

controlled by a clock frequency ap-

plied to th e chip, w hich controls the

electronic sw itch. Typically , t he clock

frequency is 50–100 times the cutoff

frequency of the filter [6, 11].The major advantage of this setup

is that the cut off frequency is easy t o

change. So, if the system requires a

variable sam ple rate, t he ant ialiasing

fil ter can follow along.

The major disadvantage is that a

sw itch ed-capacit or filter is also sub-

ject to aliasing [6, 8, 11]. Eliminating

the aliasing in t he sw itched-capacitor

filter sometimes requires a prefilter in

front of the sw itched-capacitor f i l ter

and a reconstruction f i l ter behind it .Some sw itch ed-capacit or filter chips

have an op-amp linear filter onboard

th e chip t o provide pre- or post-filtering.

C lock feedthrough, w hich is an

extraneous signal that sw itched-ca-

pacitor filters create, can occur in the

signal. This feedthrough resides at 50–

100 tim es the filter’s corner frequency.

The presence of clock feedthrough can

cause additional aliasing problems.

Sw itch ed-capacit or filter designs

w ork best if the avai lable space is

small , th ere is ample time t o debug

the design, and especially if

the cut off frequency has to

be variable.

“ Reducing Noise in a

Swit ched-C apacitor Low -

Pass Filter” i s an excellent

article detail ing m ethods to

better apply swit ched-capaci-

tor filters [12]. Additionally,

The Art of Electronics in -

cludes a detailed example system

w ith a variable cut-off swit ched-ca-

pacitor antialiasing filter [11].

FILTER MODULESA filter module is a prebuilt filter

unit t hat doesn’t require any external

components or adjustments. Filter

modules are expensive, but the results

are almost always good.

Tw o examples of filter modules areth e D 74 series and t he 858 series from

Frequency D evices. These are show n

in Photo 1.

The D 74 series are 16-pin D IP

mo dules wit h a fixed frequency. The

858 series are programmable eight-

pole active filters in a plastic module.

Figure 5— This four-pole Sallen-Key active filter can be built from standard op-amps.

Page 22: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 22/66

Page 23: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 23/6632 Issue 94 May 1998 Circuit Cellar INK ®

Figure 8a— This DC tachometer is connected mechanically to a shaft by a set of gears. The gear on the shaft of the tachometer is eccentric. b— This end view of the tachometer gear train shows the off-center tachometer gear. c—

The output waveform with ripple is caused by gear eccentricity. If the gears are large enough, the ripple could be mistaken for aliasing.

Shaft

Tachometer

Off-Center Gear GearOff-Center

3D View End View

Output of tachometerDC ripple caused

by loping gear

Y

T

+

a) b)

the truth. I ’ll spare you a diatribe on

my disdain for gears and just point

out that the signal looks l ike it may

have alias contamination, but in fact

i t does not.

Be on the lookout for such situations,

especially w here the sensors aren’t

directly coupled to w hatever they’re

monitor ing .

RULES OF THUMBWith these rules of th umb, y ou

should be able to focus your efforts

w hether you’re designing a new sys-

tem or troubleshooting an old on e:

• I f i t is a sam pled data syst em, alias-

ing can happen. Try not to h ang

around people w ho thin k that alias-

ing is someth ing that only happens

to Sigourney Weaver.• When in doubt, filter it out. If you’re

designing a new system, plan on

placing an an alog low -pass filter as

close as possible to the input of the

ADC . The f i l ter should have as

ma ny poles as you can afford, w ith

eight poles being a general, practical

l imit for most systems.

• Cut off frequency. The filter’s cut-

off frequency should be below the

Nyquist frequency and above the

highest frequency of

the input signal.

• Many poles are

good, but a cap to

ground is better than noth ing. Imag-

ine that you’re called in to “ f ix” a

problem in an existing system and

aliasing is the cause, but for some

reason, you can’t install a proper

analog filter.

A properly chosen capacitor

placed between the ADC input l ine

and signal return provides a one-pole low -pass filter. This solut ion

isn’t th e best, but i t ’s usually easy

to install , i t reduces contamination,

and you’ll come out the hero.

• There is no antialiasing filtering in

softw are—unless you ha ve w orked

out the software implementation

for the Houdini-Copperfield Myst ery

filter. Onc e the alia sed low-fre-

quency signal gets mixed with the

real low -frequency signal, separation

is impossible.• Don’t invite trouble. If possible,

choose your sampling frequency to

be something odd. Avoid choosing

the frequency of the predominat e

noise source or its harmonics for

the ADC sample rate.

In other w ords, avoid 60 Hz and

harmonics of 60 Hz. (Believe me, I

w ouldn’t include th is rule here if I

hadn’t seen it done—more than

once.)

AntialiasingFilter

Signal 1

Signal 2

Signal 3

ADC Processor

+

+

+ –

ElectronicMultiplexer

Figure 7— Antialiasing filters can also be used with multi- plexed A/D systems.

c)

Page 24: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 24/66Circuit Cellar INK ® Issue 94 May 1998 33

SOURCES

MAX275

Maxim Integrated Products

120 San G abriel Dr.

Sunnyvale, CA 94086

(408) 737-7600

Fax: (408) 737-7194D74 and 858 series filter modules

Frequency Devices

25 Locust St.

Haverhill, MA 01830

(978) 374-0761

Fax: (978) 521-1839

w w w . f re q de v .com

REFERENCES

[1] C . Watkins a nd S. M arenka,

Taki ng Fl i ght , M&T Books, New

York, NY, 1994, 197–202.

[2] H. M. Berlin, D esign of A ctiv e

Fi l ters w it h Experim ents , Howard

W. Sams & Co., Indianapolis, IN,

1981.

[3] C .T. C hen , System and Signal

Analys is , Saunders College Pub-

lishing, N ew York, NY, 1989, p.373.

I R S404 Very Useful405 Moderately Useful406 Not Useful

[4] D .-W. Jones, “ Linear C ont rol

System P itfalls ,” Embedded Sys-

tem s C onference, Sept. 12–15, 1995.

[5] R. C alkins, “ For the U nw ary,

Aliasing G enerates Problem s in

U nexpected Areas,” Personal

Engineer ing & Instrum entat ion

News , July 1992, 47–51.

[6] R. St eer, “ Selectin g Antia lias

Filters,” Sensors , November 1992,

14–23.

[7] S. Smit h an d C .-S. Pang, “ Anti-

aliasing Filters for D igital D A

Systems,” Sensors , November

1993, 30–33.

[8] D . Po tt er, Programm able Low-

pass Fil t ers for PC-Based D at a

A cquisi t i on Boards , Nat iona l

Instruments, App Note 058, 1995.

[9] H.V. Malm stadt , C.G . Enke, and

S.R. Crouch, Electron ics and In strum ent at ion for Scientists ,

Benjam in/C umm ings, M enlo

P ark , C A, 1981, 406–407, 412.

[10] Frequ ency D evices, Frequency

D evices D esign an d Selecti on

Guide , H av erhill, M A, 1986, 3–29.

[11] P. H orow itz, and H. Winfield,

The Art of Electroni cs , C a m -

bridge University Press, New

York, NY, 1980, 1989, 281–284,

774–777.

[12] R. G alter an d V. May per, “ Re-ducing Noise in a Swit ched-C a-

pacitor Low -Pass Filter,” Sensors ,

13:12, p. 12, 1996.

Thank s to Kat hy H aynes for help

w i th th i s m anuscr ipt . M ost of a l l , I

w ant to th ank m y father, J.M. Zerkus,

for explain i ng the “w agon w heel”

i l l usion to m e.

M ik e Z erkus is a result s-orient ed

entrepreneurial engineer w it h 15

years’ experience in i nstrum ent ati on

and control . Mi k e has w orked in

di verse areas, ranging from vi rt ual

reali ty and space shutt le payl oad

developm ent to w ood products and

bi otechnology. He is the president of

CM Research, a firm special izi ng in

product developm ent and scienti f i c

instrum entat ion. You m ay reach

M ik e at m zerk us@cm research.com .

• Know your noise. Use all the

tricks—shielding, grounding, guard

ring, and so on—you ha ve at y our

disposal to keep the noise out.

• U nderstand system needs. Overkill

is expensive. A design is a series of

tradeoffs betw een conflict ing goals.

• Look at the big picture. Aliasing

most often appears as a slow D C roll .

By looking at a long data record,

you can see the periodic nature of

the shif t .

• Bew are the finger-pointers. Mak e

sure there isn’t a m echanical or

other defect that’s producing an

artifact t hat resembles aliasing.

Sure, aliasing can contaminate the

data collected from an A/D system.

But by applying a few rules, you can

anticipate where and when aliasingproblems m ay occur, and y ou’ll have a

good idea of the solution as w ell .

In the w ords of a w ise friend of

mine, per ardu a ad astra (through

difficulty to the stars). I

Page 25: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 25/6634 Issue 94 May 1998 Circuit Cellar INK ®

Selecting PositionTransducers

FEATUREARTICLE

Tom Anderson

aAre you choosing a

position sensor or

transducer but aren’t

sure how to weighyour options? Check

Tom’s parameter list.

Prioritizing movement,

environment, and

contact requirements

enables you to makethe best decision.

s an application

development man-

ager for a position-

transducer supplier, I get

num erous queries on how to solve a

broad range of position-measurement

challenges.

These inquiries run the gam ut from

the common (aircraft flight-controlsurface movement) to the exotic (For-

mula One racecar suspension travel)

to the seemingly impossible (three-

dimensional tracking of a golf ball in

flight from a fixed position).

These position-measurement chal-

lenges usually share one common

element. They can be solved using a

variety of solutions, but i t ’s not al-

w ays easy to determine the best one.

There are possibly more

options for measuring positionthan any ot her type of sensed

variable. While there may be

more suppliers for pressure

transducers, th e variety of

position-transducer types and

technologies is unm atched.

The 1997 Th om as Register

lists 264 suppliers of pressure

transducers and 229 suppliers

of displacement and position

tran sducers. Ho w ever, th ere

are 13 categories related t o

displacement and position

measurement, compared to just four

categories for pressure measurement.

In this article, I introduce you t o

various position-transducer selection

paramet ers. You’ll also find informat ion

on position-measurement techniques,

technologies, and choices.

BASIC TERMINOLOGYBut f irst , a brief note on semantics :

for ease of commun ication, th is guide

refers to transducers and sensors as

being the same. While not strictly

true, it ’s not generally relevant w hether

you are using a position sensor or

transducer. The goal of both is the

sam e—to find out w here someth ing is!

Man y kinds of transducers exist—

pressure, t emperature, velocity ,… .

Such devices provide position, dis-

placement, and proximity measure-ment s, w hich are defined as [1]:

• position—location of the object’s

coordinates w ith respect t o a selected

reference

• displacement—movement from one

position to another for a specific

distance or angle

• proximity —a critical dista nce signaled

by an on/off output

In this article, I focus primarily ontransducers for position and displace-

ment measurement. And unless oth-

erw ise noted, I use the term “ position

transducer” to refer to displacement

and proximity transducers as w ell .

THE PARAMETERSOn w hat basis should you select a

position transducer? As a starting

point, let ’s look at th e laundry l is t of

Photo 1—

Cable position transducers provide extended ranges in small sizes. Flexible cable allows for easy installation.

Page 26: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 26/66Circuit Cellar INK ® Issue 94 May 1998 35

view of some incremental rotary optical

encoders.

An importan t difference betw een

increment al an d absolute transducers

is tha t incremental transducers typical ly

need to be reinitialized after power-

down by moving the monitored object

to a home position at powerup. This

limitation is unacceptable in some

applications.

Threshold m easurements are on/off

in nature and usually involve l imit

sw itch es or simila r devices. As you

might guess, absolute devices are

usually more expensive than incre-

mental or threshold devices.

Travel, also know n as range, varies

from microns to hundreds of feet (or

more, depending on your definition of

“ transducer” ). The range of ma ny

precision transducers is limited to 10′

or less.

If your application needs to operate

on t he Space Station or some oth er

size- and w eight-sensitive platform ,

you need to specify the m aximum

values for the transducer’s dimensions

and w eight .

The application’s operatin g environ-

ment can have a large impact on y our

technology choice as w ell . You need

to determine what

operating and storagetemperatures the

device w ill be in and

whether you need to

meet commercial ,

industrial , or mili-

tary environmental

requirements.

Also consider

w heth er excessive

humidity , moisture,

shock, vibration, or

EMF w ill be encoun-tered. See if your

environment has

other unique aspects,

such as high or low

pressure or the pres-

ence of hazardous or

corrosive chemicals.

An often-over-

looked parameter is

the method and t ime

required for trans-

ducer installation

and mounting. For

pulleys, levers, electron ics, softw are,

and oth er methods can enable a rotary

transducer to measure l inear mot ion,

and vice versa. Lack of space, cost,

and ease of mount ing are a few rea-

sons for doing this.

Once you decide if you require a

contact or noncontact solution and are

measuring rotary or l inear mov ement,selecting a transducer technology

becomes much easier.

N ext, determ ine if you’re monitoring

one-dimensional or m ultidimensional

motion. I f the motion is multidimen-

sional, see if you need to measure in

multiple dimensions or if the object is

moving in multiple dimensions and

you only have t o measure one of them.

Often, multidimensional motion is

measured w ith mult iple one-dimen-

sional transducers.Also, think about t he type of s ignal

you need to obtain . If you need a signal

that specifies a unique position, be

sure to specify a transducer wit h abso-

lute output.

However, if all you need is relative

position from a prior position or a

simple on/off indicat or, then incre-

menta l or threshold technology is

more appropriate. Photo 2 gives you a

paramet ers show n in Figure 1. While

this list is not all-inclusive, it helps

you begin to decide wha t parameters

are relevant to your application.

Perhaps the first parameter to ad-

dress in any application is whether the

transducer can physically touch the

object being mon itored. If your a ppli-

cation is sensitive to outside influences,

a noncontact transducer may be the

most appropriate. Otherw ise, a con-

tact sensor might offer advantages not

found in a noncont act sensor.

At f irst thought, noncontact trans-

ducers may seem like the superior

solution for all a pplications. How ever,

the decision isn’t that clear cut.

Noncontact products can emit

potentially h arm ful laser- or ultrasonic-

based signals. These product s also rely

on hav ing a clear visual environmentto operate in. Frequency response isn’t

a lways as high as wi th a contact sen-

sor, but costs are often higher. Finally,

operat ing-tem perat ure ranges are

typically not as broad.

Another parameter to consider

early on is w hether you need to m easure

l inear or rotary movement. Note that

using cable position transducers (like

the one show n in Ph oto 1), cams,

Parameter Relevant? Ranking Choices

Contact Yes No Contact Noncontact

Motion Type Yes No Linear Rotary

Dimensions Yes No One Dimensional Multidimensional

Measurement Type Yes No Absolute Incremental Threshold (Proximity)

Range Yes No Less than 1″ 1–30″ Greater than 30″

Physical Size/Weight Yes No Size Restriction_____ Weight Restriction_____

Environmental Yes No Humidity Vibration Corrosion Moisture Temperature Other______

Installation/Mounting Yes No Removable Installation Time Limit _____

Accuracy Yes No Linearity Resolution Repeatability Hysteresis

Lifetime Yes No Cycles_____ Hours of Continuous Operation_____

Cost Yes No Less than $50 $50–$500 Greater than $500

Delivery Yes No Less than 1 Week 1–4 Weeks Greater than 4 Weeks

Output Yes No Analog Voltage Analog Current Digital Sensor Bus_____ Visual Other______

Frequency Response Yes No Less than 5 Hz 5–50 Hz Greater than 50 Hz

Figure 1—

What are your requirements? This table helps you rank your most important parameters and value specifications. Select the relevant parameters, prioritize them, and then choose the appropriate value for the parameters.

Page 27: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 27/6636 Issue 94 May 1998 Circuit Cellar INK ®

0 . 8 o r G r e a t e r

0

. 4

A c c u r a c y ( ±

% o

f f u l l s c a l e )

0 . 0

0 1 o r l e s s

0.03′ 0.3′ 3′ 30′

Price Legend

$ Less than $50

$$ $50–500

$$$ Greater than $500

E n c o

d e r (

$ $ $ )

U l t r a s o n i c ( $ $

)

P o t e n t i o

m e t r i c (

$ )

Cable Position ($$)

Magneto-restrictive ($$$)

Inductive ($$)

Laser ($$$)

In the early stages of transducer

specification, product cost som etimes

doesn’t even make t he list. More often

than not, this parameter gains impor-

ta nce as the project m oves forw ard.

When you’re determining costs,

make sure to look at the initial acq ui-

sition cost as w ell as the cost over the

product’s life. For exam ple, are special

signal-condit ionin g electronics, power

supplies, electrical connectors, hous-

ings, installation tools , or mounting

fixtures required?

Ask the vendor for typical repair,

maintenance, and replacement costs .

And, inquire about the cost of th e

transducer in volume and single-unit

qua nt ities. The cost sav ings (e.g., a

cost of $100 in volume but $600 in

single qua ntit ies) ma y be an important

factor i f sm all-quant ity replacementunits w ill be needed in the fut ure.

Another parameter th at’s occasion-

ally overlooked is the tim e it t akes

the product to be delivered to you

after you order it . The custom nature

of some transducers combined wit h

production processes and ma nufact uring

economics requires lead times of eight

w eeks or more.

This delivery schedule might be

acceptable now, but what about in six

months when you need extra quanti-ties or a spare part? Evalua te w heth er

or not you can afford to be

w ithout a part for an extended

period of time.

Obviously , the transducer

is going to be a part of a

system. So, determine y our

preferred electrical input

and out put requirements.

Com mon output choices

include analog AC and DC

voltage, resistive, current(4–20 mA), digit al, a nd v isual

(m et er).

Increasingly, outputs

using sensor bus protocols

are being offered. M ost posi-

tion transducers require 50 V

or less, and som e are self-

pow ered.

Finally, for fast-moving

applications, determine the

maximum velocity or accel-

eration t hat needs to be

monitored. Ensure that your

Accuracy is typically specified in

absolute units l ike mils or m icrons or

in relative units such as percent of

full-scale measurement. If you are

comparing the accuracy of one device

against anot her, make sure you are

comparing apples to apples.

For example, see if the accuracies

being quoted are at a single temperature

or over a temperature range. If you

need it , f ind out i f t emperature com-

pensation is available.

If you expect to see significant

numbers of cycles or if the transducer

w ill be in service for an extended

period of time, specify the lifetime

and reliabili ty requirement s as w ell .

When choosing the transducer, find

out w hat w arranties are offered as

w ell as how main tenance and repairs

are handled.A transducer that can be repaired

in-house can reduce costs significant ly.

You should also consider w hat type of

periodic recalibration is recommended

and w heth er calibratio n procedures

are provided.

I t ’s a good idea t o ask vendors wh at

type of use their transducers see most

often. Common uses include OEM,

retrofit, industrial control, comm ercial,

and t est a nd m easurement. H opefully ,

the transducer has seen previous usein your t ype of application.

testing applications, t his parameter

may not be so important. However,

OEM and large-volume applications

often require simple installation and

removal to reduce labor costs and

enable easy m aintenance.

See if the transducer can only be

moun ted w ith man ufacturer-provided

special mounting bases or if a variety

of moun ting techniques can be used.

Besides the common threaded-fastener

approach, some other nonpermanent

mounting techniques include suction

cups, magnets, industrial adhesives,

grooved fittings, and clamping.

In going through the previous pa-

rameters, you m ight hav e asked your-

self , “ Hey, w hat about accuracy?”

While accuracy is certainly important

and sometimes critical , i t ’s of ten the

last degree of freedom in the selectionof a transducer.

As you m ay know from experience,

accuracy is not a w ell-agreed-on t erm.

Typically, various components of

accuracy—linearity, repeatability,

resolution, and hysteresis—are quoted

for vendor conv enience or per user

requirements.

With the availabili ty of software

calibration tools today, l inearity isn’t

as important as i t once was. For many

applications, in fact, repeatabili ty isthe m ost important component .

Figure 2— It’s true: you can’t have it all. As with many specification decisions, tradeoffs must be made when you’re selecting a

position transducer. This graph shows the typical performance of some linear position transducers as compared by maximum range, best accuracy, and cost.

Page 28: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 28/66Circuit Cellar INK ® Issue 94 May 1998 37

data -acquisit ion or control

system has an adequate

sampling rate to record

the resulting datastream.

CHECK YOURREQUIREMENTS

Now tha t you’re aware

of the key parameters,

you need to determine

w hich ones are relevant

to your application a nd of

these relevant param eters,

which are most critical .

If you don’t prioritize your require-

ment s, i t ’s going to be diff icult to

make a selection decision. You m ay

come to the conclusion that there is

no transducer that can meet your

needs. This may be true, but it’s more

likely t hat your requirements are toostringent an d that you need to make a

tradeoff to arrive at th e optimum

selection.

For exam ple, an engineer recently

approached our company looking for a

transducer with ± 0.0001″ resolution

over 30′, and he wa nted to keep the

cost under $500. He was adam ant that

all three specifications be met. Our

products didn’t meet all his specifica-

t ions, and we w ere at a loss as to wh ere

w e would refer him.

After som e more discussion, w e

found out that the resolution require-

ment w as only necessary over a l imitedportion of the total range and that the

cost goal , w hile important , did have

some flexibili ty . Hence, in t his s itua-

tion, range was most important, fol-

low ed by resolution, and th en cost.

The moral of this story: focus on

your top requirements. Make the best

decision you can ,

given the specifica-

tions you need. And

keep in mind, you

can’t have every-

thing—unfortunately .

NEXT STEPSIn this article, I ’ve

given you som e param -

eters for selectin g

position transducers.

But in case you hadn’t

noticed, I didn’t provide any inform ation

on w hat t ype of technology you should

select for your position transducer.

The constant change in t ransducer

technology and the dif f iculty in gener-

alizing about a particular technology’s

capabili ties and limitations mean

there’s no w ay I can cover this area indetail here.

Additionally , choosing th e technol-

ogy should come a fter determining

and prioritizing your requirements.

Once your requirements are well-

know n, the choice of technology tends

to be self-selecting.

Photo 2— These incremental rotary optical encoders provide quadrature digital output. Encoder use is increasing as more transducers are being connected directly to digital processing systems.

Page 29: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 29/6638 Issue 94 May 1998 Circuit Cellar INK ®

I R S407 Very Useful

408 Moderately Useful409 Not Useful

SOURCES

Sensors

Dynamic Control Sys tems

7088 Venture St., Ste. 205

Delta , BC

Canada V4G 1H5

(604) 940-0141

Fax: (604) 940-0793

w w w .dy na v i s ion .com

MicroStrain, Inc.

294 N. Winooski Ave.

Burlington, VT 05401

(802) 862-6629

Fax: (802) 863-4093

w w w .m icros t r a in . com

Midori America

2555 E. C hapm an Ave., Ste. 400

Fullerton, CA 92831

(714) 449-0997

Fax: (714) 449-0139

w w w .thom asregister .com/midor iOakG rigsby, Inc.

84 N. D ugan Rd.

Sugar G rove, IL 60554

(630) 556-4200

Fax: (630) 556-4216

www.oakgr igsby .com

Senix Corp.

52 Maple St.

Bristol, VT 05443

(802) 453-5522

Fax: (802) 453-2549

w w w .s e nix . com

SpaceAge Control, Inc.

38850 20th St. E

Palmdale, CA 93550

(805) 273-3000

Fax: (805) 273-4240

w w w .spaceagecontrol.com

Tom A nderson is appl icat ion develop-

m ent m anager at SpaceA ge Cont rol, a

m anufacturer of m ini ature and sub- m ini ature posi t ion t ransducers and

fl i ght t est ai r dat a products. For over

10 years, he has been i nvol ved i n

comput er and instrum ent at ion prod-

uct d esign and developm ent at Pacifi c

Bel l , Apple Com puter, and H ew lett-

Packard. You may reach hi m via

emai l@spaceagecont rol .com.

REFERENCES

[1] J. Fraden, AI P H andbook of M odern Sensors , American Insti tute

of Phy sics, New York, NY, p. 264,

1993, 1996.

RESOURCES

Texts

Schaevitz Engineering, Handbook

of M easurement and Cont rol ,

Penn sauken, N J, 1976.

I. Busch-Vishniac , Electrom echani cal

Sensors and A ctu ators , Springer-

Verlag, New York, N Y, 1998.

Th om as Register D irectory of

Am erican M anufacturers , Thom as

Publishing Co., New York, NY,

1997.

Internet

Sensor’s Buyer’s Gui de ,

www.sensorsmag .com

Th om as Register ,

www.thomasregis ter .com

Photo 3— Laser position sensors have resolutions of 0.1 µ m or better.

For example, just know ing w hether

you require a contact or noncontact

technology can cut your choices al-

most in half . I f you need the latter , alaser position sensor like the one in

Phot o 3 may be a good choice.

To get a feel for the capabilities of

some of the more prevalent linear

position-measurement technologies,

Figure 2 ma ps out how th ese tech-

nologies compare against each other

based on cost , accuracy, and maxim um

range. Note that not all technologies

are shown.

Now, i t may be dif f icult to clearly

define the parameter values you requireas w ell as which parameters are most

important in your application. How-

ever, it can be even more difficult to

obtain these parameters from vendors

and t hen com pare one vendor’s stat e-

ments against another’s .

To get informat ion on products

beyond w hat you see in the vendor’s

product literatu re, review tran sducer-

related publications such as M easure-

m en ts & Con t rol and Sensors fo r

articles on position-measurementproducts and technologies.

Also, be sure to ask your colleagues

about their experiences and recomm en-

dations. They m ay h ave a position

transducer on hand that you may be

able to t est for your application.

Of course, in this day and age,

make an effort to search Web engines

and Internet new sgroups. N umerous

engineering, instrumentat ion, an d

m easurement-oriented new sgroups

can be reached via search engines.

Extensive sources of position-trans-

ducer man ufacturers

can be found in the

Thom as Register and

the Sensors Buy er’s

Gu i de .

Cont act vendors

and request references

of similar applications.

Ask these references

why they selected the

product t hey did and

w hether they’re happy

w ith t heir decision.

Also, f ind out w hat

other options they

considered.

Finally, see if the

vendor has product samples or evalua-

tion un its you can use for testing

before purchase. If th e vendor is h esi-

tant to do t his , offer to provide themwith a test report summarizing your

evaluation. This information may be

valuable to them, and they may be

more w ill ing to assist you. I

Photos 1, 2, and 3 are court esy of

SpaceA ge Cont rol, O akG rigsby, and

D ynam ic Cont rol Systems, respecti vely.

Page 30: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 30/66

Photo courtesy of National Instruments

Page 31: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 31/66 MAY 1998 EMBEDDEDPC 41

N P C

PCNouveauedited by Harv Weiner

SCALABLE CPU TheComplete Scalable CPU module is a highly integrated,

scalable, PC/ AT platform that conforms to the PC/ 104 standard.

Design options, using the CardIO credit-card–sized CPU series by

S-MOS, include an 8086, 80386, or 80486 processor that

features IBM-PC–compatible functions.

The module accommodates up to 16-MB RAM, operates at

clock speeds up to 100 MHz, and

comes in 8- and bus ver-sions. Applications include remote

monitors, ATMs, medical devices,

factory automation, and telecom-

munications.

The Scalable CPU features two

serial ports, one parallel port, LCD/

CRT controller, IDE and floppy

disk controllers, keyboard/ mouse

controller, and IBM-compatible

BIOS. It is available with PC/ 104

industry-standard power and util-

ity connections, and it offers sepa-rate connections for reset, speaker,

and external battery. The unit uses

WEB SOFTWARE DEVELOPMENT KIT TheVoyager Software Development Kit (SDK) enables

QNX developers to build full-featured Internet applications for the

embedded marketplace. It contains all the industry-standard tools

and code needed to develop a complete, customized Web

browser. The SDK includes the source code for the Voyager

browser interface, source code for E-mail, Internet dialer and

newsreader applications, a demo with source code for controlling

the browser with a hand-held remote, configuration files for the

Photon Application Builder, and a Widget Library.

Voyager is based on the QNX real-time operating system and

Photon microGUI (an embeddable windowing system). These

systems, along with the Voyager browser, TCP/ IP stack, and

Internet dialer are functional in under 2-MB flash memory and

40-MB RAM. Voyager SDK supports all the current Internetstandards, including HTML 3.2, frames, tables, proxy servers,

SOCKS, server push, client pull, progressive image display,

animated GIFs, JPEGs, FTP, basic and digest authentication,

printing gopher, cookies, helpers, plug-ins, CGI, POP3, SMTP,

and more. Voyager provides a command-driven interface so the

browser can be controlled from any input device.

Pricing for the Voyager SDK, including source code, is

$10,000. OEM run-time pricing is also available.

QNX Software Systems, Ltd.175 Terence Matthews Cres.

Kanata, ONCanada K2M 1W8(613) 591-0931Fax: (613) 591-3579www.qnx.com #511

RS-232 voltage generation, operates from one

+5-VDC supply, and features low power consump-

tion. A watchdog timer and a socket for M-Systems’ flash

DiskOnChip are also included.

The Scalable CPU is compatible with industry-standard

software applications and development tools such as IBM PC-

DOS, Microsoft MS-DOS, Win-

dows, Windows 95, Pen OSs, Vi-sual Basic, Visual C++, and real-

time operating systems like QNX.

Pricing for the Scalable CPU

starts at $199 (without a flash

module).

The parvus Corp.396 W. Ironwood Dr.Salt Lake City, UT 84115(801) 483-1533Fax: (801) 483-1523

www.parvus.com

#510

Page 32: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 32/66CIRCUIT CELLAR INK MAY 1998 42

N P C

PC/ 104 FLASH MODULE The PCM-3820 is a high-density PC/ 104 flash module

that uses the latest TSOP flash-memory chips for diskless

nonvolatile storage. This bootable, high-speed storage mod-

ule allows programs and data to be read and written

(executed and copied) just like a standard disk drive but with

extremely fast access speed and the reliability of no moving

parts. It is compatible with a wide range of operating

systems. Also, the included TrueFFS software makes it a

simple to use, powerful solution for embedded data storage.

The PCM-3820 features a transfer (read) rate of up to

2 MBps and an average seek time less than 0.1 ms. Its MTBF

is greater than 1 million hours, and its data retention is 10 yearsminimum without a power source. It also features unlimited

read cycles and a minimum of 100,000 write cycles. The

module can be ordered with 1–32 MB of storage space, and

up to 128 MB (four cards) can be used per system.

The 4-MB version of the PCM-3820 is priced at$127 in

OEM quantities.

VersaLogic Corp.3888 Stewart Rd.Eugene, OR 97402

(541) 485-8575Fax (541) 485-5712www.versalogic.com

#513

PCNouveau

DATA-CAPTURE SOFTWAREWinWedge 32 Pro adds serial data-acquisition

and instrument control to any Windows, Windows 95,

or Windows NT applications. It automatically collects data

from instruments or serial devices such as lab equipment, pH

meters, balances, moisture analyzers, bar-code readers and

scanners, titrators, spectrometers, ion meters, radiation counters,

data loggers, and modems.

Real-time analysis, charting, and graphing of your instrument datain popular PC applications can be easily performed. Different instru-

ments can simultaneously send data to different applications or to

different fields within the same application.

TCPWedge is now included at no additional charge. TCPWedge

enables the user to communicate with any TCP/ IP address over any

network directly from any Windows application. So, data can be

collected directly from instruments linked to a PC’s serial ports via serial

cables (up to 100 devices simultaneously on one PC), over an internal

TCP/ IP network (i.e., Ethernet) from any IP address on the network, or

over the Internet from any IP address on the Internet, even at remote

sites. W inWedge 32 Pro can send data and commands out through

serial ports to devices, and TCP/ Wedge can send data out overnetworks to any IP addresses.

WinWedge 32 Pro sells for $495. TAL Technologies also offers

other versions of this software priced between$199 and $395.

TAL Technologies, Inc.2027 Wallace St. • Philadelphia, PA 19130(215) 763-7900 • Fax: (215) 763-9711www.taltech.com #512

Page 33: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 33/66 MAY 1998 EMBEDDEDPC 43

N P C

PCNouveau

PC-BASED CONTROLLER The ADAM-4500 is a fully functional IBM-compatible PC in

a small package. Its built-in ROM-DOS is an MS-DOS-equivalent

operating system, providing the basic functions of MS-DOS

except for the BIOS. As a result, the module can run standard

PC software written in a high-level language like C or C++.

The ADAM-4500 can relieve the host computer of many

controller functions, enhancing overall system perfor-

mance. Additionally, it also permits the automationsystem to be isolated from the host controller.

The unit features an 80188 CPU, 256-KB flash

memory, 256-KB SRAM, two serial ports (COM1

and COM2), real-time clock, watchdog timer,

and a download port. The COM1 port can be

configured for either RS-232 or RS-485,

while COM2 is a dedicated RS-485 port.

Also, 170 KB of flash memory is available

to the user for installing applications via the

download port. An additional 234-KB RAM is

available for running applications or for string

data or results. An installation utility helps

users transfer programs from the

development PC, since appli-

cations must be converted into

80188-compatible code before they

can be installed and run on the ADAM-

4500. The ADAM-4500 is priced at$350 in

single quantities.

Advantech America750 E. Arques Ave.

Sunnyvale, CA 94086(408) 245-6678

Fax: (408) 245-5678www.advantech-usa.com

#514

Page 34: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 34/66CIRCUIT CELLAR INK MAY 1998 46

R P C

R eal-Time PC

Ingo Cyliax

Graphical User

Interfaces in RTOSs

O

Application

GUI API Lib

GUI System

Application

GUI API Lib

MouseKeyboardDisplay

Page 35: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 35/66 MAY 1998 EMBEDDEDPC 47

R P C

×

×

Display

X server Keyboard

OS/Network

Xlib

Xtk

Xaw

Application

Xlib

Xtk

Xaw

Application

Mouse

Page 36: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 36/66CIRCUIT CELLAR INK MAY 1998 48

R P C

Page 37: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 37/66CIRCUIT CELLAR INK MAY 199850

R P C

Page 38: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 38/66CIRCUIT CELLAR INK MAY 199852

Page 39: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 39/66 MAY 1998 EMBEDDEDPC 53

IRS

RPC.EPC

Page 40: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 40/66CIRCUIT CELLAR INK MAY 199854

A P C

A pplied PCs

Fred Eady

A New View Part 1: Virtual Instrumentation

S

Page 41: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 41/6655MAY 1998 EMBEDDEDPC

AP C

Page 42: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 42/66CIRCUIT CELLAR INK MAY 199856

A P C

Page 43: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 43/6657MAY 1998 EMBEDDEDPC

AP C

Page 44: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 44/66CIRCUIT CELLAR INK MAY 199858

A P C

Page 45: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 45/6659MAY 1998 EMBEDDEDPC

AP C

IRS

APC.EPC

Page 46: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 46/6660 Issue 94 May 1998 Circuit Cellar INK ®

PostScriptFlutterwumpers

FEATUREARTICLE

Don Lancaster

i’The sound of

“flutterwumpers”

brings on a sort ofAlice in Wonderland

enchantment that’s

not unlike the

peculiar magic Don

Lancaster pulls out

of PostScript. Listenin on how to make

PostScript move

PIC-powered robots.

m a long-time

fan of the superb,

general-purpose Post-

Script language. For years,

i t ’s been m y f irst and foremost tool

for most of my columns, engineering

designs, and t echnical i l lustrations.I also use PostScript for man y ot her

tasks, ranging from investm ent models

to m agic sine-w ave research, Sm ith

charts, shaft encoders, Web-site traffic

analy zers, and hot-tub controllers. And

as you’ll see, it also lets us explore

some low -end robotics opportun ities.

Unt i l recent ly , you had to w ant to

use PostScript as a language in the w orst

sort of w ay t o be able to do so. In

particular, needing a Post Script printer

to serve as the host com puter washorribly limit ing. PostScript hard drives

were few and far between, as was the

lack of a real-tim e visual display. Even

m ore crippling w as the one-w ay paral-

lel port that nearly al l early PC systems

forced on PostScript users.

But, these l imitat ions are ancient

history. PostScript is now busting out

all over w ith brand-new capabili ties .

For exam ple, the free G hostscript 5.01

clone provides full host-based Post-

Script computing combined w ith full-

screen visuals.

Variations on G hostscript can be

customized for new comm ercial apps.

In fact, Videonics now offers the Pow er-

Script 1000 fully animated video char-

acter generator, thus turning zil l ions

of fonts and all th e standard desktop-

publishing tools loose on video editing.

Originally , PostScript lacked most

transparency features. But, Videonics’

w orkaround redefines the CM YK

color space, w ith K serving as a new

alpha transparency channel.

Host-to-printer interactions have

dramatically improved as well , with

higher speed tw o-w ay parallel comm u-

nications added to serial, AppleTalk,

and Ethernet options. Program apps

such as Download Mechanic simplify

Post Script-as-a-language and printer

interactions.

Meanw hile, Adobe improved itsAcrobat 3.01 PostScript variant, too.

Acrobat greatly revolutionizes th e

distribution of information, both off

and on line.

I f ind it much better than HTML

because it offers exact control of w hat

th e end user w ill see, w ith full-screen

magnif iable displays online and im -

proved antialiased visibility. Acrobat

also features U RL hot l inking, interac-

tiv e forms, w ipes, full text and library

searches, bookma rks, thu m bnails, byterange loading, scan captu re, and pow -

erful h andica pped-access provisions.

A ty pical sin gle-file size is 11 KB per

i l lustrated page, w hich prints equally

w ell to P ostScript and non-PostScript

printers. And one element of Acrobat,

the Distiller 3.01, lets you convert

complex PostScript code into simpler

Acrobat files.

ACROBAT DISTILLER

A PC-, Unix-, or Macintosh-basedAcrobat Distiller 3.01 makes a fairly

pow erful general-purpose Po stSc ript

comput er. At its input, D istiller accepts

PostScript code from a disk text file.

I t can a lso be taught t o read nearly

any f i le format in any language!

At th e output, D isti l ler can gener-

at e its (usually in tended) file or

w rite messages or calculat ed results

to its (usually ignored) file. Al-

ternatively , i t can write any custom-

disk–based text file in almost any

format .

Pick a Peck of PostScript PIC s

Page 47: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 47/66Circuit Cellar INK ® Issue 94 May 1998 61

G hostscript offers one debugging

advantage. Distiller gags on any error,

outputt ing only a s tack dump. G host-

script gives you a visual screen output

up to t he point your error w as made,

thus showing you w here to pin dow n

an obtuse bug.

N everth eless, I prefer D isti ller, per-

haps because I’m an Adobe developer

and beta tester. The use of Distiller

for PostScript-as-language that I am

the most excited about involves…

PostScript FLUTTERWUMPERSA “ f lut terwum per” is my term for

any autonom ous process controller

w hether i t be hardware or software

based. Some examples include printed

circuit drillers, wo od routers, fabric

shears, panel engravers, animation

stands, cutt ers for vinyl, embroiderymachines, shop mills, laser trim m ers,

and box ma kers.

As Figure 1 illustrat es, PostScript

provides a unique w ay of parti tioning

any f lutterw umper, greatly reducing

the cost of dedicated hardw are.

The key is to let PostScript handle

the higher level stuff—managing disks

and other resources, interfacing design

softw are or clip-art libraries, dealing

w ith fonts, doing coordinate transforma-

t ions, m aking tool-path corrections,or converting curves to individual

machine space steps. After the hard

stuff is done, your onboard PIC only

needs to deal w ith t he simplest t asks.

To start this process, use transfer

documents, w hich I call f lutf i les . Tw o

obvious languages for flutfile docum ents

are G erber Format and H PG L. Not e

hidden restrictions, so you h ave

to decide w hether to pick the

quick and dirty “ free” log f ile or

write a custom output f i le .

Let m e go over some of t he log-

f i le l imitations. Adobe Disti l ler

does a flushfile after every new

line, wh ich is nice because you

can see problems as they occur.

How ever , it s lows you down and

causes a lot of disk clatter on

extended outputs.

Also, long strings are truncated to

200 characters in the log file. Carriage

returns are tricky as w ell, and you geta m ix of status, error, and data m essages.

One big gotcha when writing any

PostScript-as-language code that needs

PC disk access: always use “ ” w h en

you mean “ ” inside a PostScript string.

The confusion comes about because

“ ” acts as a directory boundary in

Window s filenam es, w hereas it’s a

fully reserved PostScript string char-

acter. G hostscript gets around this by

substituting “ ” for “ ” in f i lenames.

And f inally , don’t be alarmed if yousee “ Warning: N o PD F file produced.”

I f your primary goal is w riting your

own custom disk f i le , you may not

need a view able f ile at al l .

DISTILLER VS. GHOSTSCRIPTD istiller is am azingly fast a nd 100%

genuine Adobe. G host script, by con-

trast, is s low, klutzy, and not at al l

friendly. G hostscript clearly flaunt s its

U nix heritage, but a new View add-on

provides a graphical interface.Both D isti l ler and G hostscript offer

visual displays. But even with the two

mouse clicks required to sw itch t o

Exchange, Distiller displays are faster

and considerably clearer.

G hostscript lacks some of t he latest

PostScript features, and it has some

unoff icial bugs. How ever, i t can be

customized to ma ke anything you l ike.

G hostscript font additions are a hassle,

but G host script source code is easily

obtained. In short, D isti l ler costs

money; G hostscript doesn’t .

Distiller can easily analyze Web-

site log files or extract special content

from private search-engine internals.

It can also convert file and font forma ts,as w ell as filter all the Fourier trans-

forms from millions of m agic sine

w aves, keeping only those scant few

good ones. It can even design digital

filters or solve h igher order linear

equat ions .

The final results can be displayed

onscreen using Acrobat Exchange,

Reader, or G hostscript. Both Exchange

and Reader let you print to either

PostScript a nd non-PostScript printers.

Let’s go over a simple example thatshows how fast and easy i t is to use

PostScript as a com puting language—

finding the sine of 35.4°. First, c reate

this t ext f i le:

If you drag and drop this file into

D istiller, th e value of 0.579281 should

pop up on your log-file display.D isti l ler obeys the rule that any

print (e.g., or ) commands go

to the file. Write commands

(e.g., or ) are

output to your custom disk output

file. Marking commands (e.g., ,

, or ) go to the gen-

erated file.

The log file is int ended for error and

status messages, but you can write

nearly anything to i t a t any time for

any reason. Unfortunat ely , the log fi le

isn’t quit e transparent. I t ha s a few

PC withAcrobatDistiller

PICMicro x -axis

Stepper

y -axisStepper

PenUp/Down

Home

Sensor

Custom

vinyl cutter,

wood routing,

millingmachine,

animation stand,

awards engraver,

embroidery setup,

circuit board drilling,etc.

Task Feedback

Task Commands

Serial Port

Table 1—

Here’s one possible flutfile command set. The single characters handle elemental tasks.

0 Go one step due east1 Go one step northeast

2 Go one step due north3 Go one step northwest4 Go one step due west5 Go one step southwest6 Go one step due south7 Go one step southeastB Begin sequenceD Pen down or cutter onH Reset to home positionQ Quit sequenceRn Repeat last n – 32 timesU Pen up or cutter offX Breaking debugger% Ignore comments until CR

Figure 1— Flutfile partitioning brings genuine PostScript to PIC flutterwumpers.

Page 48: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 48/6662 Issue 94 May 1998 Circuit Cellar INK ®

east , w hich needs a

positive x step and a

negative y step.

Single lett ers desig-

nate simple actions,

like (up), (dow n),

(ho m e), (breakin g

debugger), a nd (qu it ).

Also, comments are

permitt ed betw een any and t he next

carriage return or line feed.

A repeat is don e via , wh ich means“ repeat the last comm and n – 32 tim es.”

The 32 occurs because I restrict th is

application t o printing ASCII charac-

ters. The ASCII dollar sign has a code

of decimal 36, so means “ repeat

the last command 36 – 32 = 4 times.”

But, it ’s inefficient to use for few er

than four repeats. For more than 95

steps, just repeat .

signif icantly shortens a f lutf i le that

involves mostly cardinal direction

moves and actions.A formal flutfile spec also needs to

include handshaking. Although you

don’t w ant t o l imit the da ta ra te , you

must not overrun your mechanism—

especially on time-intensive homing

or repeats. Handshaking details are

system specific, but buffered and

are often the optima l choices.

FLUTFILE EXAMPLESThe PostScript routines generate

flutf i les , wh ich th en get used by yourrobot system in real tim e or in a deferred

production m ode wh ere the sam e f i le

gets resent once per piece. With such

parti t ioning, you can get by w ith simple

and cheap dedicated hardwa re on the

f lut terwumper .

PostScript is also especially adept

at handling the oddbal l transforma tions

you need for nontraditional-axis sys-

tem s (e.g., rectangu lar t o polar or az -el).

Any terminal program can manage

the communications. Plain old Hyper-

term works just fine.

tha t any G erber or HPG L to f lut f ile

format disk conversion is a t r ivial

task for PostScript.But, let’s create a simple language—a

language that asks as little as possible

in the way of f lutterwumper smarts .

I want to l imit f lut f i le commands

to printable ASC II text ch aracters tha t

use ordinary higher data-rate serial

comm unications. This rate turns out

to be more than fast enough for the

maxim um chomping speed of most

mechanical f lutterw umpers.

I ’l l initially restrict m y f lutf i le

language to one that is immediatelyinterpreted. I ’m not going to use loops

or subroutines, but I want to allow for

comments, a breaking debugger, and a

simple repeat.

Let’s assume a flutterwum per system

tha t requires precise steps in the x and y

directions but only simple up and dow n

actions in the z direction. The system

can use any coordinate system, and

PostScript is in charge of creating x -y –

equivalent motions.

A suitable f lutterwum per metalan-guage comm and set a ppears in Table 1. I

use num erals 0–7 for cardinal directions.

Let’s stick w ith th e PostScript conven-

tion of due east being 0 and positive

degrees going coun terclockw ise.

Thus, ASCII num eral mean s go due

east by generating one positive step in

the x -axis stepper direction. The nu-

meral means to shif t northeast by

generatin g positive x - and y -axis st eps. A

means head north with a single

positive y step, and so it goes around

all the compass points to the south-

This PostScript code:

/inch 72 mul def

0.4 inch 0.6 inch moveto

0 inch 0.8 inch rlineto

1.2 inch 0 inch rlineto

0 inch -0.8 inch rlineto

closepath stroke

Generates the following portion of a flutfile:

BH

121121121121121121121121121121121121121121121121121121121121D

2222222222222222222222222222222222222222222222222222222222222222

2222222222222222000000000000000000000000000000000000000000000000

0000000000000000000000000000000000000000000000000000000000000000

0000000066666666666666666666666666666666666666666666666666666666

6666666666666666666666664444444444444444444444444444444444444444

4444444444444444444444444444444444444444444444444444444444444444

4444444444444444

UHQ

Here is a compressed version of the same flutile:

BH1Rh2R4D2Rp0R]R[6Rp4RRUHQ

Figure 2— Here’s how some basic PostScript code can turn into a simple rectangle.

Page 49: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 49/66Circuit Cellar INK ® Issue 94 May 1998 63

This PostScript code:

/inch 72 mul def

2 inch 2.5 inch 1.5 inch

0 360 arc

closepath stroke

Generates the following portion of a flutfile:

BUH

1101101110110111011011101101110110111011011101101110110111011011

1011011101101110110111011011101101110110111011011101101110110111

0110111011011101101110110111011011101101110110111011011101101110

1101110110111011011101101110110111011011101101110110111011011101

1011101101110110111011011101101110110111011011101101110110111011

011101101110110111011011101101

D222222222222322222223222223222223222322322232232232223232323232

2332232332323233233233233233333233333333333333433334333343343433

3434343343434343434434434434443443444434443444344444443444444443

4444444444444444444445444444454444454444454445445444544544544454

5454545445544545545454554554545545554555555455555555555555655556

5555655656555656565565656566565656566566656656666656666666566666

6665666666666666666666666766666667666667666667666766766676676676

6767676767667766767767676776776776776777677777767777777777777707

7770777707707077707070770707070707007007070707007000070007000700

0000070000000070000000000000000000000100000001000010001001000100

1001000101010101001100101010101101101110111111011111111111111211

1121111211212111212121121212121212212212121212212221221222212221

222212222222212222222222

UQ

Let’s take a look at three simple

PostScript flutfile examples. Since

flutfiles are all resolution dependent,

let ’s assume t hat the required system

resolut ion is 100 steps per inch , or

10 mils per step.

Figure 2 show s a sim ple rectan gle.

First , you home w ith pen or cutt er up.

Then, shift t o th e low er left corner of

the rectangle and drop the pen. Next,

trace the entire rectangular path, raise

the pen, and return hom e.

To get from P ostScript into your

flutf i le, you need a PostScript routine

that intercepts PostScript commands,

finds their path s, converts the paths to

straight-line vectors, resolves these

vectors dow n into m achin e-dependent

steps, and th en creates a flut file. These

tasks are all tr ivial in PostScript.

A PostScript routine builds a flutfileby intercepting the , ,

, and operators.

Since nearly any thing P ostScript can

be redefined at any t ime for any purpose,

all these operators are redirected to

generate t he output f lutfi le comm ands.

Acrobat automatically reduces com-

plex PostScript code into these funda-

mental elements.

The usual way to deal with fancy

artwork is to send it on through the

D isti l ler f irst and t hen print t o disk toextract the elemental PostScript com-

man ds. Those comm ands are then

pasted into a PS flutfile generator. Or,

they are read and inter-

preted directly from a

disk textfile.

Flutfiles can be sent

in real t im e or saved to

disk and reused for pro-

duction. You can also

host-create elemental

flutfile libraries. Severalready-to-use examples

of suitable tools are in

on the

Flutterw um per Library

Shelf at <www.tinaja .

com>.

Note that any existing PostScript

code application can generate all of

your desired paths. Although I prefer

to w ri te custom code in raw PostScript ,

using Illustrator or any PostScript-

compatible drawing program w orks

just fine. In fact, nearly any existing

PostScript or Acrobat program can

aut oma tically generate robotic flutfiles.

This means your robotic system

w ill autom atically speak PostScript

from day one—royalty free and using

nothin g but a PIC or tw o. Figure 2

show s us th e PostScript code for a

simple rectangle.

A version using repeats and rem oval

of unneeded charact ers is also show n,

which dramatically shortens this

particular flutfile. Any positioning

commands now take slightly longer to

execute because they’re limited to 0–7cardinal moves. If you alw ays use

inches as the unit of m easurement,

you can sim ply do a

at t he start of your f i le instead.

Figure 3 show s a 3″ circle. As you

can see, the code is even simpler.

Figure 4 depicts a Palatino R. Again,

you can use any PostScript artwork

creator or these simple raw P ostScript

com m a nds .

One m inor gotcha: The font you

pick must already be ATM resident inyour host. If it isn’t, Courier is substi-

tuted for misspellings or non-Adobe

fonts. A rectangular bounding box is

Figure 3—

This code generates a large 100-dpi circle.

Page 50: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 50/6664 Issue 94 May 1998 Circuit Cellar INK ®

substi tuted for any real but una vai lable

Adobe fonts.

A second m inor point: Not epad has

problems with control char-

acters, so use Wordpad or some other

editor instead.

Above all , i t ’s important to realize

that your f lutterwum per electronics

don’t care about all this fancy st uff. Allyour custom ha rdware has to do is

convert ASCII characters into sim ple

steps, which is something a PIC can

do in its sleep.

IMPROVING RESOLUTIONFlutt erwu m per resolution t ends to be

much poorer than what you see in any

laser printer. Obviously, there isn’t

much point in routing out some large

w ooden display sign closer than , say,1 ⁄

16″ . And, it is real tricky to force

better than 10-mils resolution from

any larger positioning hardware.

A f lutf i le can be set to alm ost any

resolution, so there’s no lim it on how

fine you slice things. But on coarser

systems, there are a few t ricks you can

pull that greatly improves your results.

With practice, you can easily “ sight

read” any f lut f i le and m ake adjust-

ments on-the-fly.

First, retouch any grungy flutfile

elements so t hey look best at your

chosen resolution. For example, the

I R S416 Very Useful417 Moderately Useful418 Not Useful

D on Lancaster is the aut hor of 35 book s

and countl ess art ic l es. Don m aint ains

a U .S. technical h elp lin e at (520)

428-4073 and al so offers books, reprint s,

and consult in g servi ces. You m ay

reach him at don@ti naja.com.

SOFTWARE

To learn m ore about using P ostScript

as a com puting language, check th e

tutorial a t < w w w .

tin aja.com/acrob01.ht m l>. Flutfile

generators and uti l i t ies are at <w w w .

tin aja.com/flut01.htm l>. Inform a-

tion on G hostscript is available at

<w w w .cs.w isc.edu/~ghost >.

SOURCES

Acrobat, Exchange, Distiller

Adobe Systems, Inc.345 Park Ave.

San Jose, C A 95110-2704

(408) 536-6000

Fax: (408) 537-6000

w w w .a dobe .com

Download Mechanic

Acquired Know ledge, Inc.

3655 Nobel D r., Ste. 380

San Diego, CA 92122

(619) 587-4668

Fax: (619) 587-4669

w w w .acquiredknow ledge.com

PowerScript

Videonics, Inc.

1370 D ell Ave.

Campbell, CA 95008

(408) 866-8300

Fax: (408) 866-4859

w w w .v ide onics . com

ini t ia l Pa la t ino R in

Figure 4 looks a little

jaggy and unbalanced.

The retouc hed version

seems somew hat less

“ Pa la t ino-ish” but m ore

suited to a low er reso-

lution f lutterwumper.

Retouch ing is slightly

di fferent than the usual

font hinting processes

for coarse bitmaps

because diagonal paths

are permitted. It’s

especially useful for

character or libraries of

forms or other locations

w here standa rdized code

is reused a lot.

A second resolution-

enhancing t rick is step-per-phase interleaving.

Most steppers employ

four phases or incre-

ment s to com plete a step. Each phase

moves you one quarter of the way

towards your goal .

So, as Figure 5 show s, instead of

jumping a w hole x then y step on a 1-

3-5-7 slant m ove, you do a q uarter x

then q uarter y step. Your paths end up

much smoother and less jaggy.

For low -cost larger systems, y ou canconvert any autom otive al ternator into a

cheap pow er-stepper m otor. Alternat or

conversions often use three, not four,

phase steps, but the concept of stepper

phase interleaving remains the same.

PostScript P.S.So, now y ou have some pow erful

new tools to dramat ica lly low er the

cost, reduce the complexity , and im -

a)

Figure 5a— Normal vector-to-step conversion produces

a quite jagged output. b— By contrast, stepper phase interleaving improves the apparent resolution.

b)

This PostScript code:

/Palatino-Bold findfont 100 scalefont setfont

100 200 moveto

(R) show

Generates this portion of a flutfile:

BUH

1211212112121121121211211212112121121121211211212112121121121211

2112121121211211212112121121121211211212112121121121211211212112

1211211212112121121121211211212112121121121211211212112121121121

2112121121121211211212112121121121211211212112121121121211211212

1121211211212112121121121211211212112121121121211211212112121121

1212112

D

0101010101111111112121222122222222232232333233434343444344444444

4444444444444444444444444444444444444444444444444446666600000000

7676666666666666666666666666666666666666666666666666666666666666

6666666666666665654454444446666660000000000000000000000000070022

2222434332222222222222222222222222222222222222222222222222222222

2222222222222222222222210000000000000700707077766766666666666565

6565555545444445465767767767677677677677676776776776776767767767

7676000000001000022222244343333332332332332332332332332332332323

323323UHQ

Characteras accurately

generated

Characterretouched for

lower res

prove the performance of an y low -end

to midrange robotics you develop.

Just split your m otion-control prob-

lem in t hirds. You only need to use

the simplest dedicated PIC h ardware

on your robot. Have this hardw are

respond to a f lutf i le or similar “ el-

ementa l motions only ” intermedia te

file structure you create in PostScript

by using host-based Acrobat Distiller

or G hostscript application ut il i t ies. I

Figure 4— Flutfiles easily handle shapes as detailed as a Palatino R.

Page 51: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 51/6666 Issue 94 May 1998 Circuit Cellar INK ®

Transient -Suppression D esign

Technique

MICROSERIES

Joe DiBartolomeo

i

EMI Gone

Technical

To tie

together all

his ideas on

protecting against EMI

and transient threats,Joe presents the

protocol he uses when

designing for transient

protection. These

general guidelines

help you stop EMIfrom sneaking through.

P

a r t

of

44

66

72

78

MicroSeries

From the Bench

Silicon Update

DEPARTMENTS

4

n the previousinstallments of

this MicroSeries, I ’ve

given you a look at t he

most common types of transient elec-

tromagnetic t hreats and their associ-

ated w aveforms.

You’ve also become w ell-acqua inted

w ith the components most commonly

used to protect electronic equipment

from these transient threats .

In this f inal article, I take all the

discussion and put i t t ogether as astraight forw ard design protocol. It’s

the m ethod I use when designing

transient protection.

DEFINING THE PROBLEMWhen you’re designing transient

protection—or any EMI protection for

that mat ter—keep in min d the classic

source-path -receptor m odel show n in

Figure 1.

For an EMI problem to occur, you

need three components—a source ofEMI, a receptor susceptible to it, and a

coupling path betw een t he source and

receptor. Although this model is nor-

mally applied on a systems level, i t is

also valid on a circuit level.

4

Figure 1— The source-path-receptor model is often

used as a starting point for detailed EMI designs and solutions.

Source Receptor

Coupling Path

Page 52: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 52/66Circuit Cellar INK ® Issue 94 May 1998 67

The solution to any EMI problem

lies in breaking this ch ain. You can

eliminate the source of EMI, break the

path between the source and receptor,

or as I’ll discuss in this article, design

the receptor so tha t it ’s not susceptible

to t ransient EMI.

At the systems level, the source of

the transient an d the coupling path are

rarely under the control of the recep-

tor designer. So, to protect against

transient threats at the system level,

you have to protect the receptor.

How ever, the situat ion improves

w hen th e transient ent ers or is gener-

ated within the equipment. Inside the

equipment, you have some control

over the coupling path and, in som e

cases, the transient source.

Another thing to keep in mind

w hen designing for transient protectionis that transients are RF problems.

This factor complicates the process.

In RF design, th ings aren’t w hat

they seem to be. A wire is a not a

w ire—it’s a resistor and an induct or.

C omponents such as capacitors vary

great ly w ith frequency , depending on

lead inductance and com position.

For an example of how com ponents

change at high frequencies, take a

look at th e diode in Figure 2a. The

ideal diode blocks the negativ e portionof the sine w ave and passes th e posi-

tive portion.

How ever, many diodes exhibit th is

ideal behavior only at low frequencies.

As the frequency of t he input sine

w ave increases, th e diode junction

capacitance comes into play, as i l lus-

trat ed in Figure 2b.

As a result, at high enough frequen-

cies, the diode passes both the positive

and negative portions of the AC w ave-

form. This nonideal behavior can foolyou into thinking you have protection

w hen you don’ t .

In Figure 2c, an electrostatic dis-

cha rge (ESD ) is applied t o a rev erse-

biased diode. With a risetim e of 0.7 ns,

the ESD ha s frequency components

into the gigahertz. Therefore, the ESD

is coupled across the diode via junction

capacitance.

You can t hink of th e diode junction

capacitance as a hidden element. At

higher frequencies, all components

have them. These hidden elements

can m ake it difficult to design transient

protection. It’s a good idea to draw

out your circuits wit h all the hidden

elements, thereby exposing any hid-

den paths a transient might take.

But please, don’t get int imidated by

RF and EMI and t hink you need to

solve Maxwell ’s equations. Start with

the basics and go from there.

For example, plan the route the

transient current w ill take. D on’t

leave it to chance. Transient currents

are normally routed to ground, so make

sure you have a good RF connection t o

a good RF ground.

Place suppression components as

close to the devices being protected as

possible. Keep leads to suppression

components as short as possible. Basi-

cally, follow good RF design practices.

Now , there are many approaches tohardening a system or circuit to t ran-

sients—probably as many approaches

as t here are designers. Of cou rse, I have

my ow n, w hich I consider fairly simple.

In fact, my approach is more a general

thought process than a technique. I

missed my calling as a philosopher.

The best w ay t o i l lustrate the pro-

cess is by example. Let’s say you’re

designing transient protection for a

piece of test equipm ent—an autom atic

circuit-board tester or oscilloscope.These types of instruments are

normally connected to the mains

(light nin g). Their at ta ched I/O ca bles

are subjected to ESD and electrical

fast t ran sien t s/burs t s (EFT/B).

PROTECTION ZONESMy first t ask is to divide the equip-

ment into three zones or levels of

required protection—interface, inter-

board, and IC—as illustrated in Figure

3. Each zone ha s i ts ow n charact eris-tics an d requirements.

When considering the interface-

protection zone, I am concerned w ith

how as wel l as how much of the tran-

sient w ill enter the equipment .

At the interboard-protection level,I ’m thinking about what happens once

transients enter the equipment and

are distributed via the w iring to t he

PC boards.

And at the IC level, I ’m consider-

ing w hat happens once a transient

reaches the individual IC .

The idea of the three protection

zones is quite simple. Amon g the

th ree, any t ransient w ill be suppressed

because each zone serves a particular

purpose. That is, it handles the por-tion of the transient it’s responsible

for and leaves the remainder for the

other zones.

In general, the components used in

each zone have specific characteris-

tics. These are listed in Table 1.

The components in the interface-

protection z one can h andle the great-

est am ount of tran sient energy, thereby

preventing as m uch of t he transient as

possible from entering the equipment.

They also tend to have slower turn-ontimes and are coarse with high turn-

on voltages.

One example of a component u sed

in the interface-protection zone is the

gas discharge tube. G as discharge

tubes can h andle a great deal of energy,

but their turn-on voltages are far too

high to protect individual ICs.

Even though interface-protection

components are w hat t ransients nor-

ma lly encounter f irst , i t is t he inter-

board- or even t he IC -level protection

components t hat turn on f irst . There-

Figure 2a— The ideal diode blocks the negative portion,whereas the nonideal diode ( b ) passes the entire sine wave due to junction capacitance. c— The very high- frequency components will get coupled across the diode even though it’s reverse biased.

0

0 0

0

0.7 ns

a)

b)

c)

Figure 3— Between the three zones—interface, inter-

board, and IC—an incoming transient is suppressed,with each zone absorbing its portion of the transient.

IC

PCBs

Wiring

Mains orI/O Port

InterfaceProtection

Zone

InterboardProtection

Zone

ICProtection

Zone

Page 53: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 53/6668 Issue 94 May 1998 Circuit Cellar INK ®

fore, an other im portant

function of t he interface-

protection component is

to protect t he interboard

and chip-level transient

suppressors.

The interboard-protec-

tion com ponents bridge the

gap betw een t he interface

and IC-level com ponents. These devices

have tw o primary functions—to turn

on before the int erface components and

to protect the IC-level components.

By comparison, the chip-level pro-

tection com ponents, w hich protect

the individual ICs, have t he fastest

turn-on t imes and low est on-voltages

but t hey handle th e least energy.

Depending on the transient, IC-level

components are the f irst to turn on.

But as I mentioned, IC-level sup-pressors depend on the other suppres-

sion components for protection. On

its ow n, a TVS diode provides little

protection from a l ightning transient.

In Part 3, I presented a table of

specification for each type of transient

suppressor, and in Part 1, I gave the

technical detai ls of the t ransient w ave-

forms. Taken together, they should

make it fair ly straightforwa rd for you

to select suppression components for

the interface, interboard, and chip-level protection zones.

Any component may be required in

any protection zone. For example, at

the interface-protection zone, there

are basically t w o places a transient

can enter the system—the power mains

and th e I/O ports.

The transients that the m ains sees

norma lly differ from t hose encountered

at th e I/O ports. The m ains a re sub-

ject to lightn ing an d EFT/B, w hereas

ESD no rmally isn’t a concern. I/Oports on the other hand, are subject to

ESD, but lightn ing and EFT/B ma y n ot

be of concern, depending on the appli-

ca t ion.

However, take care that the zone

can handle the current generated by

the t ransient. For example, th e w iring

to a gas tube m ust be able to handle

the currents generated by lightning.

If a gas tube is placed on a PC board,

then the tracks of the PC board must

be able to h andle the l ightning’s tran-

sient current.

SUSCEPTIBLE POINTSAfter breaking the system dow n

into three zones, I identify points

within each zone where transients

can enter. I also identify every point

in th e system tha t is susceptible to

trans ients .

I then draw the circuits , as the t ran-

sient w ould see them —from every sus-

ceptible point t o every entry point. For

each schemat ic, I ask several questions:

• w hat a re the transients I expect t o

see at this point, and what do their

w aveforms look like?

• what level of protection is required?

• what protection components are at

my disposal?

• how will the protection component

protect my circuit /system ?

• how will the protection components

affect t he operation of m y circuit/

sys tem?

So, let ’s put all t his information

together and see how it w orks.

Figure 4 depicts a generic

line being protected. At the

interface to the out side world is

a gas tube. A series impedance

leads to the m etal oxide varistor

(MOV) in the interboard zone,

and t he IC-protection zone has

a TVS diode.

G enerally , there are tw o

types of transients—those th at

Figure 4— In this generic protection scheme for an I/O line, each

suppression component handles a specific function. Together,they provide complete protection.

Chassis

GasTube

SeriesZ

MOV TVSDiode

IC to beProtected

Table 1— Suppression components used in each zone have general characteristics.

CurrentZone Capabilities Turn On On Voltage

Interface High Slow HighInterboard Moderate Moderate ModerateChip Low Fast Low

Page 54: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 54/6670 Issue 94 May 1998 Circuit Cellar INK ®

are very fast w ith low

energy c ont ent (e.g., ESD)

and th ose that are slow

but w ith high energy

content (e.g., lightning).

What happens w hen ei-

ther one of th ese tran-

sients hits the system?

In the case of ESD, t he

interface components are

of no use. The transient w ill have

come and gone by th e time t he protec-

tion device turns on.

Recall that a gas tube takes 100 ns

to t urn on, and t he ESD pulse is typi-

cally in the nanosecond range with a

rise time of less than 1 ns. An MOV

turns on in about 50 ns, so i t too is

unable to follow the ESD.

Faced wit h an ESD, only t he board

TVS diodes can provide protectio n.Luckily, t he TVS diode has enough

energy-handling capability to suppress

the ESD on i ts ow n.

In the case of lightning, the rising

edge generally gets by the gas tube

devices. This is known as overshoot.

The MOV can normally follow t he

leading edge of the lightning, and if

anyt hing gets t hrough, there’s sti l l the

IC-level protect ion. How ever, since

MO Vs derate w ith use, i t ’s important

that the series impedance and gastube protect th e MOV after i t has

handled the lightning’s leading edge.

Figure 5 gives an oth er example.

Here you see a typical RX line on an

RS-232 link. The RX line co mes in via

a D E-9 connector and is wired to t he

TX/RX IC. H ow do you protect t he RX

l ine on t he transceiver IC?

D raw th e schematic a t the RX

input to the transceiver. What does

the input to t he transceiver look like,

and what is connected to the trans-ceiver? (D on’t forget t he pow er pins

on the IC.)

Identify transient inputs that can

couple to this point, and draw out the

coupling circuit for each transient

source. Then ask yourself the above

questions.

The RX line coul d be exposed to an y

or all of the comm on transients—ESD ,

EFT/B an d lightn ing. H ow ever, ESD is

m ost likely the biggest threat. C learly,

the pow er lines and the RX line to the

D E-9 w ill be sources of tran sients.D epending on your system, how ever,

more transient t hreats could arise.

Standards require RS-232 lines to

be able to w ithstan d up to 15 kV of

ESD . There are TX/RX IC s th at can

handle transients of this s ize with out

needing external suppression compo-

nents. How ever, the level of protection

required may be more than 15 kV.

Since the RX line is most l ikely t o

see ESD, the protection com ponents

are limited to the TVS and perhapszener diodes. If it w ere m y ch oice, I ’d

go w it h TVS diodes (see Pa rt 3).

Place t he TVS or zener diode in shunt

w ith t he RX line, and protect th e RX

line by diverting the transient current

to ground. The capacitance of the TVS

diode or the zener w on’t affect t he edges

of t he RS-232 line, but f or higher speed

l inks, you should consider the shunt

capacitance of the protection devices.

GET THE DETAILSD etai l ing every point in t his manner

may seem a little obsessive. Surely,

some points can be ignored. How -

ever, even w hen it seems t hat

transient protection is w ell under

control , detail ing i t points out

potential problem spots.

Figure 6 illustrates a simple

power supply I designed using tw o

commercial bricks. The external

brick converts the AC to DC, and

an int ernal brick provides D C -D C

conversion.

Figure 6— To avoid EMI problems, designers may buy off-the- shelf power converters. However, you need to ensure that the

EMI specs of the commercial converters meet the EMI specs of the final system.

AC to DC

+V

Chassis

DC to DCConverter

±VI

±Vn

ACLine

Figure 5a— Here’s a standard RX line interface. b— The addition of the hidden components

make it much easier to design for transient suppression. You should repeat this technique at every transient-susceptible point.

RX LineDE-9

PC Board

TX/RX ICRX Line

DE-9

+V

–V

Zin

a) b)

I R S419 Very Useful420 Moderately Useful421 Not Useful

Joe Di Bart olom eo, P. Eng., has over 15 years’ engin eeri ng experi ence. H e

currentl y w ork s for Sensors and Soft-

w are and also runs his ow n consult -

ing com pany, N orthern Engineer ing

A ssociat es. You m ay reach Joe at

jdb.nea@sym pa t i co .ca or by t el eph on e

at (905) 624-8909.

With this setup, I

avoided a lot of the tran-

sient-protection details.

The designers of the

bricks took care of it,

right? Oops, this could get

me int o a lot of trouble.

There’s no doubt the

designers of t he bricks

provided transient pro-

tection, but just because the transient

protection w as suff icient for th eir

needs doesn’t mean it’s sufficient for

mine. I need to reask myself the ques-

tions I asked above.

N orma lly, ESD isn ’t a pow er-port

problem because the m ains are wired

into the uni t . ESD is most common

when a person comes in contact with

the system/circuit . How ever, wit h th e

external brick, ESD becomes a problemthat I ’ll have to address.

Well, there you hav e it—my approach

to transient design. As you see, I take

a general approach filling in t he details

on a case-by-case basis. Why? Because

the interaction betw een a t ransient

and a system or circuit depends as

much on th e system or circuit as i t

does on the transient.

HEADS UP

On a related note, a new version ofthe generic immun ity sta ndard for

residential, commercial, and light

indust ry is n ow in place. EN 50082-1:

1997 repla ced EN 50082-1:1992 and

came into effect March 1, 1998.

I f you ship to the European C om-

munit y, be aw are that t he new standard

expands the im mun ity tests . For more

information on EMI tests, please refer

to m y M icroSeries in I N K 79–83. I

Page 55: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 55/6672 Issue 94 May 1998 Circuit Cellar INK ®

FROM THEBENCH

Jeff Bachiochi

y

Rebirth of

the Z8

Want to

see the

future?

Jeff’s

project

merges a piece of the

past (remember your

old Magic 8-ball?)

with Zilog’s new OTP

processors. It’s

crystal clear how

easy it is to implement

one of these new Z8s.

ou can’t do any-

thing useful in

0.5 KB. I used to hear

tha t a l l the t im e.

Now adays, we know better. There

are plenty of sma ll tasks out there that

can be performed adequat ely by the

new generat ion of sma ll processors.

Last mont h, I ta lked a bit about

Zilo g’s new O TP line of processors

using the proven Z8 core. This time, Iw ant to base a project on Z ilog’s bot-

tom -of-th e-line device, th e Z 86C 02.

This 18-pin DIP or SOIC device has

11 I/Os plus t hree inputs, w hich can

be either digital/interrupt or com parator

inputs. The single timer can be exter-

nally clocked or gated. What could I

possibly do wit h t his l i t t le beastie?

And then it rolled right in front of

me. What’s black and

round, looks like an en-

larged billiard ball, andansw ers all th e great ques-

tions of t he young? I had

one as a child. My youn g-

est now plays w i th one .

And it looks like the Magic 8-ball has

survived anot her fall to t he ground.

For those of you w ho aren’t famil-

iar w ith th e 8-ball, it is a liq uid-filled

sphere that has a small clear w indow .

You ask th e 8-ball a yes/no q uestion

as the ball is agitat ed.

One side of a polygon wit hin th e

liquid then sett les against t he clear

w indow , revealing the 8-ball’s remark-

able prophecy. What bett er introductory

project for this Zilog processor than

the My stic Z8-ball shown in Phot o 1?

This project requires an LCD, a

couple of swit ches, and a few bat ter-

ies. The smallest single-line LCD I

could f ind w as an eight-character

display. That’s too small because I

w ant t he w hole message to be dis-

played at once.

I settled on a 1 × 16 character display.I also w ant ed to have at least 16 separate

messages. So let’s see, 16 messages

times 16 characters, that’s 256 bytes

of text. Wait, that’s half the available

code space! This doesn’t look good.

HARDWARED espite th e queasy feeling in m y

stomach, I went ahead and drew up a

schematic, show n in Figure 1. Not ice

th at SW1 applies th e pow er to the

circuitry . This m icrosw itch is locat edjust inside the Z8-ball’s base. It closes

w hen th e ball is l i fted from th e desk,

coffee table, or other flat surface.

The second sw itch , SW2, is a m er-

cury sw i tch tha t opens when the LCD

(mounted in the base) is tilted up and

closes w hen it ’s flipped back over (or

agitated).

Penlight (AA size) batt eries pow er

Part 2: Let Your Micro Answ er All

Photo 1— I used a plastic ceiling globe for the Z8-ball. It’s slightly larger than the original 8-ball. The circuitry is

barely larger than the 1 × LCD module.

Page 56: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 56/66Circuit Cellar INK ® Issue 94 May 1998 73

the processor LCD and

backlighting for the dis-

play. Although the

display’s backlight is by

far the highest current

draw, t he on-tim e is char-

acteristically short, so the

batteries should last a

long time.

Most parallel LCDs

can be set up to run w ith

either an 8- or 4-bit data path. Having

plenty of I/O pins ava ilable, I opted

for the simpler 8-bit mode.

Handshaking wi th the LCD can be

accom plished via t he RD /*WR control

l ine. The LCD signals that i t ’s busy

processing data by holding the busy

data bit h igh until i t ’s again ready for

more data .

But, this particular feature can’t beused during the reset sequence. The

reset sequence is regulated by strict

minimum data-to-data timing. Since

the abili ty to handle this timing must

be incorporated for the reset sequence,

you can use this minimum t iming as

a guide to the readiness of the LCD

without getting into a more compli-

cat ed test for busy/not busy.

Very few dif ferent LC D controller

chips are used on LC D s. And, the

ones that are used are so flexible theycan interface w ith m any glass formats,

alone (for small LCDs) or expanded

w ith a dditional segment drivers.

But, th is f lexibili ty doesn’t com e

for free. The cost is an initialization

that must be performed to configure

the processor for the format of the

display it will be driving.

Most controllers adhere to a de

facto standard. The controller must

know th e data pat h w idth (8- or 4-bit),

the format of the ch aracter generator(5 × 7 or 9 × 11), and th e num ber of

lines to the display (1 or 2).

Next, t he controller needs to know

if you want i t to shif t the characters

(scrolling) or t he print position (sw ip-

ing). Finally, you need to enable and

disable the display as w ell as indicate

w hether or not th e cursor should be

invisible, blinking, or steady.

Other commands sent to the pro-

cessor clear the display and enable the

cursor to be positioned any w here on

the display. All these comman ds are

carried out by communicating with

the control register.

To print a character to the display,

you need to communica te w i th the

data register. The character passed to

the data register is used as an offset

into the character generator’s table.

The t able stores the 5 × 7 character

ma trix. This ma trix is the row /column

pixel array w hich, w hen transferred tothe display position, is a picture repre-

senting the character being sent.

SOFTWAREI alw ays l ike to m ap out my strategy

w ith some simple flow chart s. Figure 2

show s th e direction I expected to

take. A study of t he reset con ditions

of the Z86C02 processor identifies the

registers that need to be initialized

prior to getting an y real w ork done.

The code I start ed out w ith u sedonly direct register addressing–that is,

calling out the full 8-bit address of

every register I used. No shortcuts on

this first pass.

After initializing all th e

regist ers (an d I/O po rt s), I

turn my a t tent ion to the

LCD initialization. The 8-bit

LCD mode le ts me commu-

nicate twice as fast as with

th e 4-bit m ode, but speed

here isn’t an issue. Only fivecontrol bytes need to be

passed to the LCD processor

to complete i ts initialization.

There are eight services

you can instruct the LCD

processor to do. These are

discerned by the number of

zero bits preceding th e first

one bit in the control word

sent to t he LCD processor.

Not all of these services

need to be used. At a mini-

mum , it ’s necessary t o set up

the function

set, the

shif t set,

display set,

entry set, and

clear set

(see Table 1). The ’s

are bit selections for

choosing the set-up

parameters for that

service (e.g., cursor

on/off).

Since I w asn’t going to do any soft-

w are-busy ch ecking, I needed to pay

attention to time. All commands are

finished in less than 20 ms. Most t ake

less than 50 µs.

I chose 2 ms as m y standard w ai t ing

period (clear screen takes 1.64 ms). So,

I can clear and print a m essage in under

50 m s. The w ait rout ine is done as soft-w are loops instead of using the tim er.

Even though it might be easier (and

a lot more accurate) to use the timer, I

ma y not have the code space available

to set up t he tim er for each individual

tim e spec. Besides, th is w ay I can let

the t imer free run t o give me a pseudo-

random nu mber w henever the user

moves the Z8-ball and closes SW2

w ithout having to set i t up to free run

each time I need a random message.

Once t he user asks a question ofthe M ystic Z 8-ball and turns up th e

LCD, SW2 opens and the timer is

read. The lower four bits of the timer

Figure 1— Zilog’s OTP processor needs little external support for this simple application.

Function Set = 001dnfxxwhere d = data width 8/4 bits

n = 2/1 display linesf = 5 × 10/5 × 7 character fontx = no parameters

Shift Set = 0001wdxxwhere w = display/cursor shift

d = shift left/rightx = no parameters

Display Set = 00001dcbwhere d = enable/disable display

c = enable/disable cursorb = blinking/steady cursor

Entry Set = 000001iswhere i = increment/decrement position

s = shift/no shift display window with cursor

Clear Set = 00000001(no parameters)

Table 1— The position of the leftmost 1 determines the control register written to within the LCD.

Page 57: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 57/66Circuit Cellar INK ® Issue 94 May 1998 75

Poweron

RegisterInitialization(and enablefree running

timmer)

Callinitialize

LCD

Point tosign-on

message

Calldisplaymessage

Callwait

SW2open?

(displayup)

Callinitialize

LCD

SW2 open?(display up)

Calldisplaymessage

Read timerand use lower

nibble asoffset into

message table

No

Yes

No

Yes

InitializeLCD

RS = controlregister

Callwait

Send controldata

Return

No

Yes

Sent allcontroldata?

Displaymessage

RS = dataregister

Send it tothe LCD

Return

No

Yes

Sent allcontroldata?

Wait

1-ms Loop

Return

No

Yes

Finished #of requested

loops?

Offset = lownibble of

timer × 12(# of characters

to display)

Get acharacterfrom table

offset

Add offset tothe messagetable pointer

are m asked (num ber of possible mes-

sages to choose from) and the result is

shifted (multiplied by 16, the number

of possible characters in a display

m essage) to give an offset to t he begin-

ning of the chosen (random) message.

The actual message table address is

then a dded to the offset so t he block

move loop can f ind the m essage and

pass each character to the display. I

chose not to use the canned mult iply

routine, although Zilog has a num ber

of useful canned routines available.

After displaying the m essage on th e

LCD , the program jumps back in

ant icipation of another earth-shattering

question. Turning over or agitating

the Z8-ball closes SW2, blanking the

display, and the process begins again.

MASMWith th e moment of t ruth a t hand,

I load my code into Z ilog’s MASM,

pop a C oke, and w atch for the inevi-

ta ble error m essages to appear. Sure

enough, they scroll off the screen and

end wi th the m essage “ too many

errors.”

OK, i t couldn’t identify some of

the register names I used. A little

more research corrected most of these

errors.

Another pass through MASM and abunch m ore errors with the f inal m es-

sage “ not enough space in ROM for

code.” Ouch. A view of the file

show ed the code filling the 0.5 KB of

space about halfw ay int o the m essage

t a bl e. H m m … .

The I/O port registers I needed t o

w rite to w ere in the first w orking regis-

ter ba nk (the first group of 16 registers),

so I m apped t he registers I needed int o

th at space. The Z 8 has 16 groups of

w orking registers , w ith t he controlregisters residing in t he upper bank.

By changing from direct register

addressing t o in direct register address-

ing, I could save a byte on each of

those instructions. By sett ing the

w orking register group number in th e

RP register, I can call out registers of

interest using a nibble (indirectly)

instead of a byte (directly). This im-

provement m ade a big dent in t he

code space needed, but it w asn’t enough.

A look at each of the routines

showed the LCD ini t ial izat ion requiring

Figure 2— Drawing a flowchart helps me organize my thoughts when I’m beginning a project.

a big chunk of code. Each control

w ord w r it ten had a lot in common.G iven th e millisecond-loop setu p, I

could move the data strobing into the

millisecond loop wh ere it w ould take

up minim um space. True, th at’s not

w here it belongs, but I could still

jump into the middle of that wait

routine and avoid strobes w hen I w as

tim ing things other than the period

between LCD wri tes .

Now, I was able to assemble the

code and stay within the bounds of

the Z86C02’s available mem ory.

How ever, a successfully assembled

file does not necessarily make a logi-

cally correct process.

Z8 ICEBOXI don’ t w ant t o guess how much

this ICEBox costs Zilog to produce,

but for $99, it’s a real deal. G ett ing

these things into engineer’s hands is

bound to help Zilog get designed in,

and that’s really the bottom line.

There are a nu m ber of jum pers on

the Z 86C C P00ZEM in -circuit emula-

tor. I t certainly pays to read the docu-

ment ation before trying to use this

board.

Page 58: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 58/6676 Issue 94 May 1998 Circuit Cellar INK ®

I R S422 Very Useful423 Moderately Useful424 Not Useful

Jeff Bachiochi (pronounced“BA H -key-

A H -key”) is an electri cal engin eer on

Circuit Cellar INK ’s engin eeri ng staff.

H is background i nclud es product design

and m anufacturing. He m ay be reached

at jeff .bachiochi@circui t cel l ar.com .

SOURCEZ8, ICEBox

Zilog, Inc.

210 E. Hacienda Ave.

C am pbell, C A 95008-6600

(408) 370-8000

Fax: (408) 370-8056

w w w .z i log .com

The ’ZEM has typical windows

softw are for keeping track of general-

purpose and control registers, timers,

I/O, and t he like. The debug wi ndow

permits single-stepping, step-over, and

breakpoint entries. You can run your

code in real-time or animation (auto-

matic single stepping) mode.

I found myself missing the reset-

table execution counter found on

other tools. This counter enables you

to take accurate t imings of specif ic

routines.

In place of a cycle counter, I often

flip an unused output bit going into

and out of t he routine in question.

With a scope, i t ’s easy to m onitor th e

bit and get an accurate reading of the

routine’s timing.

After sett ing up the ’ZEM, at taching

my circuit w ith the included 18-pin

cable, and dow nloading the assembled

code, I clicked . The display jumped

to life by printing eight 5 × 7 blocks.

Well, these blocks are typical for a

display t hat hasn’t been initialized.

So, not only was the initialization

code not w orking, but only t he f irst

half of the display w as w orking.

A look at the LCD’s datasheet

revealed th e w ords “ 16 character ×

1 line.” I wa s sett ing it up right, right?

I seem to remember that, many

tim es, the display isn’t exactly as i tseems. The 20-character × 4-line dis-

plays I used were in fact 40 charact ers

× 2 lines. The last half of each line

w as chopped off and placed under th e

first t w o lines.

So, i f you didn’t con trol th e posi-

tioning, th e message started out on

the f irst l ine, continued on th e third

line, jumped up to the second line,

and contin ued on the fourth l ine.

C ould the dat asheet be misleading?

A look at th e LCD ’s block diagramindicated tha t the processor could

handle tw o 64-byte segments. C ould

this display be 8 character × 2 lines?

I had to append the

(see Figure 3) routine to include

a t est for the nint h cha racter. When

the nint h character wa s encount ered,

the cursor had to be repositioned to

the 40H byte before the final eight

charact ers w ere displayed.

U nfortunately , th is added enough

source code to put me back over thetop again. Arrgh.

A second look at t he tim ing rou-

tine simplified the code enough for an

assembly w ithin bounds (tw o bytes

shy of full). By u sing a sin gle-byt e

loop register as the minimum time

increment (750 µs), I could u se a byt e

pair (w ord) as an out er loop count er

(that’s up to 50 s).

The instruction lets the reg-

ister pair be decremented (it takes

care of the byte boundary carry task),

saving a few instructions over the

Figure 3— Adjustments to the display routine were

required because the 1 × 16 LCD turned out to be a 2 ×

8 display.

DisplayMessage

RS = DateRegister

Add offset tothe messagetable pointer

9thCharacter

Return

RS = DataRegister

No

Yes

Offset = lownibble of

timer × 16(# of characters

to display

Get a characterfrom table

offset

Send it tothe LCD

AllCharacters

Sent?

No

Yes

Position

cursor to 40H(beginning ofnext line)

RS = DataRegister

CallWait

th ree-byt e, th ree-nested loop routin e I

used previously. Success at last.

I ’m nearly done. As I look over the

display routine, I see that I set up the

routine to use any n umber of random

choices. I t so happens th at I ’m limited

in this program to 16 choices.

Instead of multiplying my low er

timer nibble (1 of 16) by 16 (the num-

ber of charact ers in a m essage), I could

have just used the (nibb les)

instruction and saved a bunch of rotate

instructions. Oh, w ell . There’s alw ays

room for im provement!

JUST ASK!Presentation is a big part of th is

project, and finding the right spherical

container can be a challenge. For the

best effect, try to make it resemble

th e original 8-ball a s closely as possible.Then, you’re ready.

Pick up th e Z8-ball and t urn it

over, and the backlit LC D reads “ Mystic

Z8-ball .” After a few seconds, another

m essage appears, “ Ask and shake me.”

Asking th e mighty know -it-all ,

“ D o you truly have psychic powers?”

I shake it w ildly . Without a second

thought, t he Z8-ball answers, “N o, I

doubt i t .”

Ahh. I guess this seeing into the

future doesn’t w ork af ter all . But w aita sec… if the Mystic Z8-ball knows it

doesn’t hav e psychic pow ers, doesn’t

that mean it does? I

Page 59: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 59/6678 Issue 94 May 1998 Circuit Cellar INK ®

SILICONUPDATE

Tom Cantrell

l

FPGA Tool Time

It’s fine to

have a

low-cost

FPGA,

but if the

tools cost a mint,

you’re still in trouble.

However, Tom’s

found some bargain

basement tools just

as far away as your

local Internet

connection.

a s t m onth , w e

looked at Xilinx’s

Spartan l ine of FPG As.

The premise behind their

(and com petitors like Altera, Actel, and

Lucent) bargain-priced chips is simple.

If you buil d it (and t he price is right),

th ey (high-volum e designs) w ill com e.

Sounds good, but hold your horses.

There’s the sm all m at ter of tools needed

to turn a blank FPGA into somethingoth er th an a high-tech paperweight. In

fact, the performan ce-at-any-price image

of FPG As is as much a by-product of

expensive, complex tools as t he cost of

the chips themselves.

Hist orically, FPG A suppliers hav e

seemed more interested in making

money on the tools than promoting

chip design-ins. For many years, Xilinx

kept tight control over their place and

route technology, giving new m eaning

to t he concept ofone-stop shopping.

Without access to

internal P&R tech-

nology, a w ould-be

FPG A tool supplier

faces a situation

akin to w r i t ing a C

compiler for a chip

with a secret in-

struction set.

Fortunately ,

FPG A suppliers

have realized that

you’ll probably sell more blades if you

don’t charge $10,000 for the razor. A

bit of browsing in th e tool departm ent

finds w ider selection, m ore function-

alit y, and low er prices.

DIALING FOR DEVELOPMENTSYSTEMS

Phil Freidin, local FPG A guru, turned

me on to a great programmable-logic

Web si te. Poke around w w w .optim agic.

com/low cost.htm l, and you’ll f ind

your w ay t o a bunch of good deals.

For instan ce, the Foundat ion toolset

from Xilinx is a shrink-w rap total

solution that runs on PCs or worksta-

tions and inclu des everythin g you need

to enter, s imulate, and implement a

design. H ow ever, at $3995 ($5995 w ith

VHDL synthesis), it doesn’t exactly

encourage casual experimentation.But look closely. You’ll find they’re

offering a promotional version for $95

that ’s ful ly functional but restricted to

8k gates. Better yet, head on over to

Associated Professional Systems (w w w .

associatedpro.com) and you find the

Xilinx promo package bundled wit h

PC -plug in evaluation boards starting

at $340.

Bleeding-edge ASIC designers in creas-

ingly use FPG As to prototy pe their gate

arrays before signing that big, noncan-celable PO. Sy nopsis leverages the t rend

w ith FPG A Com piler, a version of

their popular Design Compiler ASIC

synthesis tools that run under Unix.

They also offer FPG A Express, spe-

cif ically targeting FPG As and running

on P C s (assuming your box is up to

snuff; 64-MB RAM is recommended).

A free evalua tion v ersion (1k-gat e limit )

of FPG A Express can be had at w w w .

syno psys.com /product s/fpga_pc.ht m l.

Figure 1— A virtue of FPGA signal processing is that it allows designers to tune price and performance tradeoffs optimally for their particular application.

100

90

80

70

60

50

40

30

20

10

00 50 100 150 200 250

8 × 8

12 × 12

16 × 16

12 × 1210 × 10

8 × 8High Speed

Area Efficient

CLBs

M H z ( 4 0 0 E - 1 )

Page 60: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 60/66Circuit Cellar INK ® Issue 94 May 1998 79

I N K 68). For instance, confronted

with the seemingly innocuous:

the synt hesizer creates a lat ch t o re-

member the previous value of

to k now w ha t to ou tput on w hen

.

While a bit of headscratching is the

price to pay for explicit cont rol over the

hardw are implementa tion, ot her dis-

turbing gotchas hide in th e gap betw eentoo l and chip. It’s a tw o-edged swo rd,

imposed by t he inabili ty of synt hesis

tools t o both insulate designers from,

and grant access to, the specifics of

the un derlying FPG A architecture.

As an example of the former, the

obvious w ay t o code a 16-bit barrel

shifter is as sixteen 16:1 multiplexers

as show n in Listing 1a. Of course, you

could get t r icky and come up wit h a

t w o -tier sch em e (see

Listing 1b) comprisinga 0-, 1-, 2-, or 3-bit

rotat e follow ed by a 0-,

4-, 8-, or 12-bit rotate,

but that seems dumb.

Or is i t? I t turns out

tha t for Xilinx chips the

latter design is a better

fit. It consumes less

than half the CLBs (32

vs. 80) and even runs

faster (3 C LB delays vs.

4) than the “ obvious”

design option.

XilinxCore CLBs Supplier

8051, 6502, 500+ (est.) VAutomation, Virtual IP Group, Z80-compatible CPU Mentor GraphicsV8 8-bit CPU 268 VAutomation with 64-KB addr. spaceTX400-series CPU (scalable) 120+ T7L16450-type UART 130 Comit SystemsMultimaster I2C 137 Memec Design ServicesHDLC controller 200 CoreEl Microsystems146818-type real-time clock 100 (est.) Virtual IP GroupPCMCIA interface library 20–30 Digital Objects Corp.USB funct ion, hub controllers 600–960 Mentor Graphics

Table 1— Mining IP gold starts with a core sampling. The emergence and growth of third-party IP providers enables FPGA system-on-a-chip aspirations.

approach t o hardw are develop-

ment . The problem: schemat ics

would eventually run out of

gas, w ith designers buried

under thousands of pages.

Was I right? HDL tech-

niques are now widely used

for com plex chips. However,

the life of schemat ics has been

extended by the development

of macros that bury many

gates into a single symbol,

and they remain many designers’ first

choice for low er gat e-count designs.Though describing hardw are in HD L

is much like programming, there are

fundamental differences. For instance,

softw are types generally needn’t be

concerned about t he difference betw een

statements l ike:

X = A + B + C + D

and

X = (A+B) + (C + D )

How ever, these statements certainly

don’t generate equivalent circuits in

HD L. The former cascades three adders

in series, w hereas th e latter pairs tw o

adders feeding a third, so it’s faster.

Watch out for inferred memory—

latches created by s ta tements

w i thout a n clause (a subject I

discussed in “ Pick a Peck of PLD s,”

Exemplar, now a subsidiary of EDA

Mentor G raphics, is known as one of the

early pioneers of FPG A-optimiz ed syn-

thesis. Their G alileo tool autom atica lly

infers technology-specific RAMs,

eliminat ing the need to man ually force-

f i t a particular FPG A’s scheme and

maximizing device portabili ty .

Similarly, their module generation

approach (MO D G EN) autom atically

detects many comm on ar i thmetic and

relational operators and synthesizes

technology-specific solutions rather

than random logic. An entry-level

package, G alileoFSxi, specifically

ta rgets Xilinx FPG As and includes

VHDL or Verilog tutorials. Check out

demo deals at www.exemplar.com.

Although it ’s a relative newcom er,

Synplicity is garnering a reputa tion for

quality output and fast compile timesw ith t heir Synplify package. If your PC

is a bit pokey (Synplify is one of t he few

packages that runs on Window s 3.1 as

w ell as 95, NT, and w orkstat ions) and

you get t ired of hour-long coffee breaks,

check out their 20-day evaluation

package at w w w .synplify .com/dow n-

loads/platform.h tm l.

Other big players and good deals

include OrCAD w ith t heir Express NT-

based VHD L package (get a free demo

CD via www.orcad.com), Accolade’sPeakVHD L and PeakFPG A (w w w .acc-

eda.com), and Minc (recently acquired

Synario from D ata I/O) w ith their

$495 VHD L Easy (w w w .minc.com/

ht ml/vhdl0.htm l).

SYNTHESIS GETS REAL?Hard to believe it was way back in

1990 w hen I w rote my f irst article on

the subject of logic synthesis (“ VHD L—

The End Of Hardw are,”

I N K 17). G uess I’ve beenhaving fun because the

time’s sure f lown.

The article introduced

VHDL, an Ada-like lan-

guage originally designed

for simulat ion but called

into duty for chip design

(like that other popular

HD L, th e C -like Verilog).

Back then, I predicted

that typing in a chip using

HDL would replace the

traditional schematic

Photo 1— Configurable library modules,like this Xilinx filter, insulate designers from the gory details of FPGA-specific architec- ture and optimization.

Page 61: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 61/6680 Issue 94 May 1998 Circuit Cellar INK ®

different tha n any oth ers. But,

as we saw las t month, m od-

ern FPG As do understand

the difference, offering dedi-

cated pins, routing channels,

buffers, and so on.

Treat clocks and reset like

any other signal in your HDL

code, and you’ll end up w ith

some w impy connect ion

routed hither and yon , lead-

ing to all kinds of headaches.

Yes, it ’s possible to get a round

the problem with nonstand-

ard, device-specific hacks in

your HDL, but you’ll have to

keep track of two versions of

your code—one that synthe-

sizes and one that s imulates.

The myriad details are

hard to learn, and they va ryacross different vendors’

architectures. H ow ever, for

big chips, there’s really no ot her choice.

Echoing Winston C hurchill ’s com-

ments about capitalism, synthesis

may be a terrible system, but i t ’s the

best there is.

JUST DO IPU ntil synt hesizers get to t he point

w here they understand w hat should be

done, rather than just doing w hatever

you tel l them t o do, a solution comes in

the form of IP (Intellectual Property).

It comes from t he vendor and encapsu-

lat es device-specific know -how .

D on’t w rite your ow n barrel-shifter.

Just pop in a canned one that’s already

been tested and optim ized. Xilinx offers

a spectrum of IPs under the umbrella

of CO RE Solutions, w hich is composed

of reference designs, LogiBLOX, Logi-

CORE, and AllianceCORE.

Reference designs comprise a collec-

tion of application notes describing

techn iques a nd/or specific designs for

comm only used functions like the afore-

mentioned barrel shifter, counters,

FIFOs, PWMs, and so on. Note thatthese, like typical application notes,

aren’t w arranted or supported. But the

price—free—is certainly right.

LogiBLOX goes one step furth er,

w rapping generic functions in a G UI

that al lows easy m odificat ion of param-

eters such as counter, shifter, decoder,

On t he other side of the coin, syn-

th esizers’ high-level pretensions often

mean they’re oblivious to nit ty-gritty

details. For instance, to a synthesizer,

signals like clock and reset are no

Figure 2— The V8 from VAutomation is the first in a wave of new CPU cores designed specifically for the IP market.

RESET

SET_P[7:4]

CLR_[7:4]

INT[7:0]

READY

DATAIN[7:0]

V8_REGS16 × 8 Dual-Port RAM1 Read/Write, 1 Read

OP_DCDOP CODE DECODE READ

WRITE

OP_FETO

REG A

REG B

V8_ALU

8-BitALU

PSR[7:0]

DATAOUT[7:0]

ADDR[15:0]

V8_ADDR

AddressGenerationLogic

16-Bit PC16-Bit Stack8-Bit Temp

Page 62: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 62/6682 Issue 94 May 1998 Circuit Cellar INK ®

or multiplexer width, as w ell as memory

ty pe (ROM , RAM, du al-port RAM) and

size. So, rather than having to juggle a

library of, for in sta nce, 6-, 7-, an d 8-bit

counters, the one you need is alway s

just a few point and clicks away.

LogiBLOX also bridges the gap

between schematic and HDL design

styles. Module lookup and configura-

tion can be invoked directly from third-party schematic editors (e.g., Aldec,

View logic, Ment or Graphics, Ca dence,

etc.), creating a placeable symbol.

Alternatively , m odules can be instan-

tiated into an HDL design for simula-

tion (both behavioral and gate level)

and synthesis .

While LogiBLOX is included w ith

basic developm ent-tool packages, Logi-

C OREs are higher level, extra-cost fun c-

tions sold and supported directly by

Xilinx. For example, a P C I core enables

designers to integrate P C plug-and-play

w ith applicat ion-specific logic.

Deliverables include schematics,

netlis t , and both VHD L and Verilog

simulation models . Options such asinit iat or/ta rget, burst tran sfer tim ing,

and FIFO size are easily customized to

tun e performan ce from 20 to 100 MBps.

The oth er ma jor LogiCO RE offering

is the D SP C ore G enerator, a l ibrary

of parameterized D SP funct ions. Like

LogiBLOX, the DSP functions (adders,

accumulators, and even com-

plete filters) are configured

w ith point and click dialogs

as you see in Photo 1. They

also deliver output for both

schematic a nd H D L design regimes.

DSP applications are an especially

good mat ch w ith Xil inx FPG As, thanks

to distributed-arithmetic algorithms.

For instance, a filter distributes coeffi-

cients across multiple CLBs, using the

LUTs as “ ROM.” Sample bits are pro-

cessed serially, but all taps of the

filter are processed in parallel.

Furthermore, unlike a “ have it ourw ay” standard DSP, the precision of an

FPG A-D SP can be tuned to exactly

w hat ’s required. Need a 19-bit m ulti-

plier instead of t he usua l 16 or 24 bits?

N o problem. In fact, a m yriad of choices

are available, everything from 6 × 6 t o

32 × 16 in both speed- and area-opti-

Photo 2— Whether silicon or IP, a CPU needs good support tools including evaluation boards such as these from VAutomation ( a ) and T7L ( b ).

a) b)

Page 63: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 63/66Circuit Cellar INK ® Issue 94 May 1998 83

mized variants. Figure 1 gives you an

idea of what I mean.

ROLL YOUR OWN RISCXilinx’s AllianceCORE program

recognizes one of the most interesting

and potentially profound trends—

third-party IP cores that boost FPG A

design option s w ith a bu y-versus-

make alternative.

As illustrat ed in Table 1, IP cores

include CPUs, peripherals, and sup-

port logic. Buy w hat y ou need and

s t i tch i t together wi th your own ap-

plication-specific functions. Voilà,

instant FPG A system on a chip.

The idea of putting a CP U in an

FPG A is particularly intriguing, in-

spiring one to question conventional

design-parti tionin g w isdom. Just w hat

is the difference betw een hardwa reand softw are anyw ay , and which

should do what ?

One of the earliest references

(1994) I found o n t he FPG A-C PU

subject w as an application not e writ-

ten by Ken Chapman of Xilinx [1].

C onstrained by yesterday’s s il icon, he

came up wi th a minimal is t mult i-

MIPS programm able stat e machine in

a mere 50 CLBs.

Ken reports t hat s imply porting the

original design to new chips boostsperformance 3×. Additionally , opti-

mizing t o take advant age of the new

synchronous dual-port RAM cuts

logic and doubles performance.

That’s a 6×+ performan ce boost in

three years—I love this business! It’s

the march of s i l icon that makes IP

cores, formerly an academic curiosity,

increasingly viable for volume com-

mercial a pplication.

Today, designers can choose from a

w ide selection of m ainstream control-ler cores (standbys like the ’51, 6502,

and Z80). These are obviously useful

w hen compatibi l ity w i th exist ing

softw are and tools is paramount , as

w hen sw eeping a board’s w orth of

logic into one chip.

There are also brand n ew cores

emerging. Freed of compatibility bag-

gage and reflecting the latest architec-

tu re trends, th ese devices offer great

potent ial for new designs.

C heck out th e V8 from VAutoma-

tion diagrammed in Figure 2. It’s a

Listing 1— Be careful what you wish for. The straightforward implementation of a 16:1 mux in VHDL ( a ) con- sumes more silicon and runs slower than a less obvious version ( b ) that better matches the FPGA archi tecture.

a)

(continued)

Page 64: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 64/6684 Issue 94 May 1998 Circuit Cellar INK ®

b)

Listing 1— continued m idrange 8-bit , 64-KB a ddress loa d/store

m achine w ith a concise set (33 opcodes,

4 addressing m odes) of variable length

(1–3 byte, 1–7 clock) instructions.

D elivered in either VHD L or Verilog,

th e V8 comes w ith a quiver of periph-

erals including timer, UART, I2C , a nd

D MA. U SB and 1394 cores are available

for extra cost. Before you go overboard,

keep in mind t he CP U core alone con-

sum es 268 Xilinx C LBs (remember t heir

Sparta ns ran ged from 100 to 784 CLBs).

Once a CPU is in an FPGA, the

temptat ion is to tw eak it w i th applica-

tion-specific add-ons. The V8 accom-

modat es such desires with tw o spare

opcodes that can ha ndle operations like

512-/1024-bit m at h ops fo r cry ptogra-

phy , mult iply and accumula te w i th

satu ration for DSP, block move, search

and sort for netw orking, and so on.Multiple register sets can be tailored

to provide superior int errupt response.

The TX40x series from T7L takes

customization to the l imit. The cores

show n in Table 2 comprise varian ts of

a base architectu re in which t he process-

ing power (ALU w idth, nu m ber of regis-

ters), program and data address space,

and instruction set are all scalable.

Performan ce is impressive w ith

Harvard design and a three-stage pipe-

line executin g fixed-length sin gle-w ord(i.e. 10–24 bits, depending on th e m odel)

instructions at up to 33 MHz. Entry-

lev el m odel s (e.g., 8-bit TX401) are in

th e 120–170-C LB range, w ell w ith in

the m eans of today’s FPG As.

But, cores need all the support and

debug tools of a regular CP U. Both

VAutom at ion and T7L cover the basics

w ith PC -based softw are tools (ASM and

C ), evaluat ion boards (see Photos 2a a nd

2b, respectiv ely), an d t est an d verifica-

tion info. Obviously, tools for IP coreshave to measure up for the concept to

take off.

LET’S MAKE A DEALThe idea of IP-based FPG A system -

on-chip is starting t o get real, but don’t

get t oo st arry-eyed. Further adv ances in

FPG As are required for even bett er

price/performa nce t radeoffs, especially

w hen it com es to on-chip RAM.

Tools will m ature and improve as

they deal w ith the increasing design

and verification challenges posed by

evermore gat es. It w on’t be easy, but

technology w ill inexorably march on.

Nont echnical IP business and legal

issues mustn’t be overlooked. For

instance, how should a core be sold?

Fixed price, royalt ies, by site, by project,

percent of die size? Source code or net-

lists? Service, support, customization?

C ore prices may vary from a few

thousand (netlist only) to hundreds of

thousa nds (source, customiza tion ser-

vices, etc.). For now , all IP deals in -

volve a lot of individual negotiation.

What about patents, especially in

the case of IP clones of existing chips?

On e article I read describes how C a-

dence is establishing design centers in

offsho re law yer-free zones [2]. C heck

your IP fine print carefully.

As questions are answ ered, the pace

of FPG A system-on-chip development

w i l l quicken. So, stay t uned… . I

Tom Cant rel l has been w orki ng on

chip, board, and system s design an d

m arketin g in Si l icon Val ley for m ore

Page 65: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 65/66Circuit Cellar INK ® Issue 94 May 1998 85

REFERENCES

[1] K. C hapm an, Dyn amic M icrocon-

trol ler in an XC 4000 FPGA , Xilinx,

App note, 1994, w w w .xilinx.com/

appnot es/m icrocn t.pdf.

[2] R. G oering, “ C an Scot land build

system-chip ha ven?,” EE Ti m es ,

D ecemb er 15, 1997.

SOURCES

Spartan series FPGAs, Alliance CORE

Xilinx Inc.

2100 Logic D r.

San Jose, CA 95124

(408) 559-7778

Fax: (408) 559-7114w w w .x i l inx .com

16450-type UART

Comit Sys tems

1250 Oak mead P kw y., Ste. 210

Sunnyvale, CA 94088

(408) 988-7966

Fax: (408) 988-2133

w w w . c o m i t . c o m

HCDL controller

CoreEl Microsystems

46750 Fremont Blvd., Ste. 208

Fremont , C A 94538

(510) 770-2277

Fax: (510) 770-2288

www.coreel .com

PCMCIA interface libary

Digital Objects Corp.

3550 Mow ry Ave., Ste. 101

Fremont , C A 94538

(510) 795-2212

Fax: (510) 795-2219

w w w .digi ta lobjects .com

16450-type UARTMemec Design Services

I R S425 Very Useful

426 Moderately Useful427 Not Useful

819 S. D obson R d., Ste. 203

Mesa, AZ 85202

(602) 491-4311

Fax: (602) 491-4907

w w w .m e m e cde s ig n .com

USB function, hub controllers,

Galileo FSxi

Mentor G raphics

Inventra Business U nit

1001 Ridder Pa rk D r.

San Jose, C A 95131-2314

(503) 685-8000

Fax: (408) 451-5690

Synplicity, Synplify

Synplify, Inc.

624 E. Evelyn Ave.

Sunnyvale, CA 94086

w w w .s y npl i f y . com

TX40x

T7L Technology, Inc.

780 Charcot Ave.San Jose, CA 95131

(408) 321-9728

Fax: (408) 383-9613

w w w . t 7 l . c o m

V8

VAutomation

20 Trafalgar Sq., Ste. 443

Na shua, N H 03063

(603) 882-2282

Fax: (603) 882-1587

w w w . v a u t o m a t i o n . c o m

8051,6502,Z80-compatible CPU,

146818-type RTC

Virtual IP G roup

1094 E. Duane Ave., Ste. 211

Sunnyvale, CA 94086

(408) 733-3344

Fax: (408) 733-9922

w w w .virtua l ipgroup.com

Data Width Data Address Width Inst. Width Inst. Address WidthTX Series (bits) (bits) (bits) (bits) #Inst.

TX401 8, 10 8, 10 10, 12 10, 12 47+TX402 8, 10 10, 12, 14 12, 16 12, 14, 16 80+TX403 12, 16 12, 14, 16 12, 16 14, 16, 18 47+TX404 12, 16 12, 16 12, 16 14, 16, 18 80+TX405 12, 16 12, 14, 16 12, 16 14, 16, 18 140+TX406 24, 32 24, 32 16, 24 18, 24 80+

TX407 24, 32 24, 32 16, 24 18, 24 140+

Table 2— Shades of bit-slice! The T7L architecture is fully scalable in terms of processing power and address space.

than ten years. You m ay reach hi m by

E-m ai l at t om.cantrel l@circui t cel l ar.

com , by t elephone at (510) 657-0264,

or by fax at (510) 657-5441.

Page 66: Circuit.cellar.094.May.1998

8/13/2019 Circuit.cellar.094.May.1998

http://slidepdf.com/reader/full/circuitcellar094may1998 66/66

PRIORITY INTERRUPTDesign98—A Marketer’s PICnic

i f you hang around me long enough, you learn that I tend to use a lot of metaphors when I’m trying to make a

point. Invariably, when I’m talking about the evolution of embedded control, I eventually get to a comment that,

someday, even toasters will contain microprocessors. Of course, I’ve been saying this to emphasize how far

embedded processors have come both in application and cost effectiveness. In truth, it’s just a metaphor and I’ve never

really looked to see if any toasters use them.

Well, I guess I have to coin a new metaphor. I’ve finally seen a design for a microprocessor-controlled toaster oven. Mind you, this

is no schlock control scheme. It’s a serious demonstration of surface-mount technology, with a platinum RTD temperature sensor, 2 × 8

LCD display, rotary-encoded input dial, and RS-232 interface!

No, I didn’t whip this up in the cellar. It was one of the designs submitted among the tremendous volume of entries we received for

Design98, the Circuit Cellar/Microchip PIC design contest. Probably the best part about these contests is the richness of design ideas

that are presented. Here was a group of people who had solved engineering problems and they wanted to tell the world about it.

And tell about it they did. We received projects on RF remote control, video digitizing, motor controls, image scanning, security keys,

energy management, electronic games, a single-chip Internet server, smart switches, I/O expanders, data loggers, rocket telemetry,

fuzzy-logic buck conversion, a taxi meter, and assorted transmitters, receivers, programmers, interpreters, etc., etc., etc. And, oh yes,

there was a toaster-oven controller.

While everyone could not be a winner, they all were worthy of winning. And no doubt, they’ll be rewarded in the marketplace. Of

course, certain projects really caught my eye. In the necessity is the mother of invention category, there was the Great Highland Bagpipe

Chanter. Apparently, learning to play the bagpipe is a demanding physical task. It’s equally demanding on anyone who’s around you when

you’re practicing. The only volume control on a bagpipe is distance! With the addition of a few buttons and a 12″ PVC pipe, this ingenious

entrant made a PIC-based electronic bagpipe simulator so his students could practice without creating a riot.

In the proverbial 10 pounds in a 5-pound bag category, we had a couple graphing data loggers. The first was a weather monitor with

a built-in 128 × 240 LCD. It monitored, stored, and displayed pressure and temperature as a continuously updated scrolling graph

showing the present conditions as well as the previous 48 hours of weather data. The second project was an x -y graphing data logger with

eight 12-bit ADC inputs, 20 KB of data space, and a 200-hour battery life. Using a Casio graphing calculator as the display (64 × 128

LCD), the combined system performed sophisticated analytical and statistical math processing on the analog data.

In the it’s better to see you category, I loved the electronic automobile sun-visor project. This one answers the question, what do

you do (besides swear a lot) when the sun isn’t blocked by the usual flip-down sun visors? This circuit uses two CCD linear arrays to

continuously track the sun’s x -y position. With that information and some neat calculations, it automatically blocks the blinding sun from

reaching the driver’s eyes by darkening the appropriate pixels on a 24 × 64 pixel (0.4″ × 0.6″ each) optically clear automotive LCD sun

visor. When can I get one?

Finally, in the why didn’t I think of that category, there was an X-10 Remote Temperature Sensor. The circuit used a Dallas digital

thermometer and 2 × 16 LCD (as a local display) combined with a TW523 X-10 transceiver as you might typically expect. Without usingX-10 extended data, however, designers tend to resort to using a whole bunch of house and unit codes to represent the wide range of

potential temperatures. This circuit relied instead on the host controller and a single house code. The sensor decodes two consecutive On

commands to ask a specific comparison temperature value The sensor responds with an On command if the comparison temperature is