cc_2001_07-132

98
7 9 25274 75349 07 > CIRCUIT CELLAR ® www.circuitcellar.com THE MAGAZINE FOR COMPUTER APPLICATIONS $4.95 U.S. ($5.95 Canada) # 1 3 2 J U L Y 2 0 0 1 EMBEDDED PROGRAMMING Build a Keyless Entry System An Animatronic Reprogramming Project Adding USB Connectivity Ultrasonic Distance Measurement

Transcript of cc_2001_07-132

Page 1: cc_2001_07-132

7 925274 75349

07>

®

T H E M A G A Z I N E F O R C O M P U T E R A P P L I C AT I O N S

# 1 3 2 J U L Y 2 0 0 1

Build a Keyless Entry System

An AnimatronicReprogramming Project

Adding USB Connectivity

Ultrasonic DistanceMeasurement

Page 2: cc_2001_07-132
Page 3: cc_2001_07-132

FLASH + SRAM

Up to 6 MByte

THE BASIC TIGER™

USA: Kg Systems Inc., (800) 292-4303, Fax: (973) 515-1033, [email protected] • Saelig Company, 1-888-7SAELIG, Fax: (716) 425-3835, [email protected]: Premier GPS Inc., (403) 295-8879, Fax: (403) 274-3021, [email protected]

Australia: JED microprocessors, +61 (3) 9762 3588, Greece: Electrotechnic Hellas S.A., +30 (221) 43 602, India: ICON microcircuits, +91 (44) 432 1857, Italy:Daniele Oboli Engineering, +39 (382) 577 987, Korea: Sample Electronics, +82 (2) 707 3882, Netherlands: Embedded Technology B.V., +31 (488) 431 855,Uganda: Uganda Electronics & Computer Ind. Ltd., +256 (41) 348 708, Intnl: Wilke Technology GmbH, Box 1727, 52018 Aachen, Germany, +49 (241) 918-900,Fax: +49 (241) 918-9044, email: [email protected]

OEM

and

Dis

tribu

tor

Inqu

iries

wel

com

e! -

Pric

es d

o no

t inc

lude

app

licab

le ta

x an

d sh

ippi

ng c

osts

. Pric

es a

nd p

acka

ges

may

be

diffe

rent

out

side

the

U.S.

TIN

Y Ti

ger™

and

BAS

IC T

iger

™ a

re T

rade

mar

ks o

f Wilk

e Te

chno

logy

License-free multitasking system Complete computer systems in tiny modules Compact DIP-type modules with 28 - 92 pins Fast high-speed multitasking BASIC Economical cut consumption (50mA @ full speed),

cut components, cut system cost Streamlined super-fast development cycles

Digital, analog and serial I/O channels in module Expansion Bus for up to 4,096 I/O lines 160 kB ... 6 MB FLASH + SRAM, RTC, Watchdog

BASIC Tigers™ are tiny, high-precision,multitasking computer modules that areideal for your project development andseries product applications. They areavailable in a wide range of module sizesat surprisingly reasonable prices.

BASIC Tigers™ deliver what developers and manufacturersreally want:

Hundreds of pre-engineered and ready-to-use functions,device drivers for flexible I/O interfacing, high productreliability and code stability, high-speed vector & pixelgraphics, easy expandability, fast integer and double-precision floating-point math, virtually unlimited programsize and more.

Sound good? You bet! Test the Tiger at no risk today .Contact your local dealer:

http://www.wilke-technology.com

$59from

Qty 1

Page 4: cc_2001_07-132

Digital Oscilloscopes

• 2 Channel Digital Oscilloscope• 100 MSa/s max single shot rate• 32K samples per channel• Advanced Triggering• Only 9 oz and 6.3” x 3.75” x 1.25”• Small, Lightweight, and Portable• Parallel Port interface to PC• Advanced Math options• FFT Spectrum Analyzer options

DSO-2102S $525DSO-2102M $650Each includes Oscilloscope,Probes, Interface Cable, PowerAdapter, and software forWin95/98, WinNT, Win2000and DOS.

• 40 to 160 channels• up to 500 MSa/s• Variable Threshold• 8 External Clocks• 16 Level Triggering• up to 512K samples/ch• Optional Parallel Interface• Optional 100 MSa/s Pattern Generator

LA4240-32K (200MHz, 40CH) $1350LA4280-32K (200MHz, 80CH) $2000LA4540-128K (500MHz, 40CH) $1900LA4580-128K (500MHz, 80CH) $2800LA45160-128K (500MHz, 160CH) $7000

www.LinkIns4.comLink Instruments • 369 Passaic Ave • Suite 100 • Fairfield, NJ 07004 • (973) 808-8990 • Fax (973) 808-8786

Logic Analyzers

• 24 Channel Logic Analyzer• 100MSa/S max sample rate• Variable Threshold Voltage• Large 128k Buffer• Small, Lightweight and Portable• Only 4 oz and 4.75” x 2.75” x 1”• Parallel Port Interface to PC• Trigger Out• Windows 95/98 Software

LA2124-128K (100MSa/s, 24CH)Clips, Wires, Interface Cable, ACAdapter and Software $800

All prices include Pods and Software

Page 5: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 3

The Lighter Side of ProgrammingHow to Improve a Singing Fish Marsette Vona

Keyless Entry Control SystemSteve Hsiung

USB, FTDI StyleJeff Pollard

A New ViewAn Award-Winning 3-D Telemeter ProjectRobert Lacoste

Inductive SensorsGeorge Novacek

Put Telepathy to the TestTom Napier

Steplocked Magic Sine WavesDon Lancaster

I APPLIED PCSTuning the Data RadioWireless Data CommunicationFred Eady

I FROM THE BENCHThe Missing (Wireless) LinkJeff Bachiochi

I SILICON UPDATE Liquid Crystal DelightTom Cantrell

12

20

28

32

38

44

60

COLUMNS

ISSUE

Task ManagerRob WalkerAre WeThere Yet?

New Product Newsedited by Rick Prescott

Test Your EQ

Advertiser’s IndexAugust Preview

Priority InterruptSteve CiarciaTrade Show Paradigms

6

9

81

95

96

132

54

66

74

FEATURES

Page 6: cc_2001_07-132

ChipCenter

ASKU S

THE ENGINEERS TECH-HELPRESOURCE

Let us help keep yourproject on track or simpli-fy your design decision.Put your tough technicalquestions to the ASK USteam.

The Ask Us researchstaff of engineers hasbeen assembled to shareexpertise with others.The forum is a placewhere engineers cancongregate to get sometough questionsanswered, or just browsethrough the archivedQ&As to broaden theirown intelligence base.

Test Your EQ8 Additional Questions

ALL ABOARD THE CLEAN ENGINE

Automotive Emissions and Onboard Diagnosticsby John West As efforts are made to keep our environment pollution-free, automobiles are being put to thetest with even stricter standards. To meet these emissions requirements, manufacturers haveturned to more electronically controlled systems using sensors. Strategies are getting morecomplicated and require more control code. John sees a future where automotive microcon-trollers will start to look more like desktop systems in terms of bandwidth, "evolvingfaster than you can step on the gas." June 2001

PORTING MICROC/OS-II TO THE TS-2800 EMBEDDED PC

by Robert BowenAs his designs started getting more complicated, and he found they were not reusable fromsystem to system, Robert began to turn his focus to new development programs.Demonstrating the advantages of using an embedded PC and real-time kernel, he tookadvantage of open source programming tools and searched for a real-time executive. It allmakes for more capability, complex I/O, and high-speed data acquisition. June 2001

USING A WELL-DESIGNED BOOT MONITOR IN EMBEDDED SYSTEMS

Part 2: Building on the Basicsby Ed SutterLast month, Ed got us started with the exception handlers in place and basic flash interfacesinitialized. Picking up where he left off last month, this time around he starts the process ofbreaking away from just being a simple boot monitor. Moving forward, you can now overlay aformat on the section of flash memory to be allocated to the tiny flash file system. Thedesign goal is to provide a good amount of flexibility without overdoing it. June 2001

AND THE LIST GOES ON…

Putting Together Parts Lists Lessons from the Trenches—by George MartinWith promises of fame, George tries to entice you into submitting an entry to Trinity's FireFighting Home Robot Contest. But before you build that bot, you're going to have to buy theparts. It may seem like a daunting task at times, but whatever you do, you need the parts todo it. The simplest way to go about it is to create a list and a purchase order. Fromthere, you can start cashing those winning checks. June 2001

ESCAPE TO SF

Silicon Update Online—by Tom CantrellThe Embedded System Conference always provides a lot of food for thought, and Tomshows us that this year's event was no exception. Having outgrown San Jose, San Fran isnow home to ESC, with a whole new wave of applications opening up. Voice recognition gearwas probably the hottest item on the scene, along with web-enabling and listening chips. Willthe spoken word replace keyboards? Watch and listen for the answer. June 2001

AN ELECTRIC LITESHOW DISPLAY

Part 1: The Electronics Behind the Lights Technically Speaking—by James AntonakosJames has a fascination with electronics, mainly flashing lights on and off. His LiteShow dis-play of 384 lamps makes for an interesting article this month. By putting groups of lampstogether, you can create letters, words, and graphics, all individually controlled by only threesignals from the PC printer port. Working with some students, he shows them how todesign their own version of a printed circuit board. June 2001

RETRO HUMOR CIARCIA STYLE

Part 3—by Steve CiarciaWay back at the dawn of the microcomputer age, Steve Ciarcia was blazing a trail (some-times literally) through the hardware and software issues of the era. At the request of manyof our readers, we've brought back a series of articles, written by Steve, chronicling thedesign adventures of those early days in the Circuit Cellar. This month, it's chapterone from Take My Computer, Please! June 2001

RESOURCES• Internet Phones

Rick Prescott• DVD-R, DVD-RAM,and DVD+RWBrant Schroeder

• Wireless NetworksBrant Schroeder

Page 7: cc_2001_07-132
Page 8: cc_2001_07-132

6 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

EDITORIAL DIRECTOR/PUBLISHERSteve Ciarcia

MANAGING EDITORRob Walker

TECHNICAL EDITORSJennifer BelmonteRachel HillJennifer Huber

WEST COAST EDITORTom Cantrell

CONTRIBUTING EDITORSIngo CyliaxFred Eady George MartinGeorge Novacek

NEW PRODUCTS EDITORRick Prescott

PROJECT EDITORSSteve Bedford Bob PaddockDavid Tweed

ADVERTISINGADVERTISING SALES MANAGER

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

ADVERTISING SALES REPRESENTATIVEElyshia Gottier Fax: (860) 871-0411(860) 875-2199 E-mail: [email protected]

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

ADVERTISING CLERK Sally Collins

CONTACTING CIRCUIT CELLARSUBSCRIPTIONS:

INFORMATION: www.circuitcellar.com or [email protected] Subscribe: (800) 269-6301, www.circuitcellar.com/subscribe.htm, [email protected]: [email protected]

GENERAL INFORMATION:TELEPHONE: (860) 875-2199 Fax: (860) 871-0411INTERNET: [email protected], [email protected], or www.circuitcellar.comEDITORIAL OFFICES: Editor, Circuit Cellar, 4 Park St., Vernon, CT 06066 NEW PRODUCTS: New Products, Circuit Cellar, 4 Park St., Vernon, CT [email protected]

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

CIRCUIT CELLAR®, THE MAGAZINE FOR COMPUTER APPLICATIONS (ISSN 1528-0608) and Circuit Cellar Online are publishedmonthly by Circuit Cellar Incorporated, 4 Park Street, Suite 20, Vernon, CT 06066 (860) 875-2751. Periodical rates paid at Vernon, CTand additional offices. One-year (12 issues) subscription rate USA and possessions $21.95, Canada/Mexico $31.95, all othercountries $49.95. Two-year (24 issues) subscription rate USA and possessions $39.95, 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 Subscriptions, P.O. Box 5650, Hanover, NH03755-5650 or call (800) 269-6301. Postmaster: Send address changes to Circuit Cellar, Circulation Dept., P.O. Box 5650, Hanover, NH 03755-5650.

For information on authorized reprints of articles, contact Jeannette Ciarcia (860) 875-2199 or e-mail [email protected].

Circuit Cellar® makes no warranties and assumes no responsibility or liability of any kind for errors in these programs or schematics or for the con-sequences of any such errors. Furthermore, because of possible variation in the quality and condition of materials and workmanship of reader-assembled projects, Circuit Cellar® disclaims any responsibility for the safe and proper function of reader-assembled projects based upon or fromplans, descriptions, or information published by Circuit Cellar®.

The information provided by Circuit Cellar® is for educational purposes. Circuit Cellar® makes no claims or warrants that readers have a right tobuild things based upon these ideas under patent or other relevant intellectual property law in their jurisdiction, or that readers have a right to con-struct or operate any of the devices described herein under the relevant patent or other intellectual property law of the reader’s jurisdiction. Thereader assumes any risk of infringement liability for constructing or operating such devices.

Entire contents copyright © 2001 by Circuit Cellar Incorporated. All rights reserved. Circuit Cellar and Circuit Cellar INK are registered trademarks ofCircuit Cellar Inc. Reproduction of this publication in whole or in part without written consent from Circuit Cellar Inc. is prohibited.

CHIEF FINANCIAL OFFICERJeannette Ciarcia

CONTROLLERHoward Geffner

CUSTOMER SERVICEElaine Johnston

ART DIRECTORKC Prescott

GRAPHIC DESIGNERSNaomi Hoeger

Mary Turek

STAFF ENGINEERS Jeff Bachiochi

John Gorsky

QUIZ COORDINATORSDavid Tweed

Michael Smith

EDITORIAL ADVISORY BOARDIngo Cyliax

Norman JacksonDavid Prutchi

TASK MANAGER

ot only are those some of the most well-knownwords of summer, but these days, you don't hear

them coming only from the kids who are sick of riding inthe backseat. Just listen to yourself the next time you're

waiting for your dial-up connection to download new software or e-mailattachments. We've become extremely "connected" via wireless devicesand other technology that allows us to save valuable time. Interestinglyenough, one of the most common complaints about our digitally-enhancedlifestyles is not having enough time to get things done and relax.

Soccer moms and financial analysts have a host of gadgets that allowthem to stay connected to the people and events that are important to them,but those gadgets didn't evolve from a pile of components in someone'spart drawer. Every new feature on every new gadget is the result of around-the-clock efforts by engineers and design teams who have been given thetask of making sure that the latest and greatest has their company's logo onthe gadget or inside the box. No pressure, especially because the currentdownturn of the economy means that not hitting that mark could mean thedifference between having a job and having to find one.

So, if you're feeling the pressure, we understand, after all, Circuit Cellarhas to keep up with the people (engineers) who have to keep up with thepeople (soccer moms and financial analysts) who claim to never have timeto keep up with people (friends and family). I can't promise that this issuewill relieve stress, lower blood pressure, or help make time to unwind, but Ihope you'll find the projects in this month's issue refreshing and enjoyable.

You can probably find some information in Marty Vona's article (p. 12)that will help you at your day job, but once you start reading, I'm pretty surethat your day job will fade to black. After all we're talking about program-ming an off-the-shelf animatronic fish to say anything you want! A projectlike that is 99% pure fun. If you're looking for bigger fish to fry, RobertLacoste (p. 32) introduces us to his Scan 3-D device that functions as a 3-Dtelemeter when connected to a PC. Robotics enthusiasts take note becausethis project would make a great addition to your latest mobile robot. And lastbut not least, what could be more relaxing than performing scientific experi-mentation on your family, friends, or neighbors? Tom Napier's telepathy testsystem (p. 44) is another off-the-beaten-path project that could help you fig-ure out whether someone you know (e.g., spouse, mother-in-law, boss…) istelepathic or just coincidentally prone to bothering you every time you try torelax. (Wired copper helmet and tie-down hospital bed sold separately.)

For those of you looking for hands-on R&R opportunities, this month wekick off the Texas Instruments Ultra-Low Power Flash MCU MSP430 DesignContest (p. 17). Get started on your MSP430 gadget and you could be onyour way to claiming your share of thousands in cash prizes! And everyoneknows how relaxing it can be to claim cash prizes.

[email protected]

Cover photograph Ron Meadows—Meadows MarketingPRINTED IN THE UNITED STATES

nAre We There Yet?

Page 9: cc_2001_07-132

T H E W O R L D L E A D E R I N D S P A N D A N A L O G

The red/black banner is a trademark of Texas Instruments. 43-4128 © 2001 TI

F413

16-bitRISCCPU

TestJTAG

MAB

MDB

FLASH8 kB

WatchdogTimer

ACLK

SMCLK

16-bitTimer

A3Comp_A

BasicTimer

2 x 8 bit

LCDDriver96 seg.

RAM256 B

PORSVS

I/OPort 1/2

I/OPort 3/4

I/OPort 5/6

SystemClock

Oscillator

Contact us for the MSP-FET430P410

Flash emulation tool for only $99 or a free

MSP430F413 data sheet.

Mixed-Signal Controllers

Break the 1-µA barrier and extend the life of your power-sensitive application. Texas Instrumentsintroduces the first member of the new F4xx family, the MSP430F413. It is the industry’s first 16-bitMCU to break the 1-µA barrier in standby mode. Its ultra-low power consumption and integratedhigh-performance analog peripherals make the F413 ideal for cost-sensitive, battery-powered measurement applications that require display capabilities such as utility metering, intelligent sensing and portable measurement. On-chip emulation and in-system programmable ultra-low-power Flash reduce development time. See for yourself how the MSP430F413 sets the benchmarkfor low-power, high-performance mixed-signal microcontrollers. Order your development tool today.

www.ti.com/sc/f413

MSP430F413: Industry’s first Flash MCU to break the 1-µA barrier.

MSP430 Road Map

FlashLCD Driver

Flash

OEM ROMLCD Driver

1998 2000 2002

Perfo

rman

ce

Ultra-low-power MCU integrates Flashmemory and LCD driver on one chip

Power consumption <1-µA standbymode at 2.2 V (typ.) extends battery life

Integrated analog comparator ideal forprecise mixed-signal measurement

On-board SVS combats brownout and lockup conditions

16-bit RISC architecture enables new applications at a fraction of the code size

In-system programmable Flash permits flexible code changes and field upgrades

MSP430F412 4 K $2.55MSP430F413 8 K $2.90

1-800-477-8924, ask for ext. f413

F413

F413

Page 10: cc_2001_07-132
Page 11: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 9

NEWSNEW PRODUCT NEW PRODUCTEdited by Rick Prescott

SCALABLE HALF-BRICK DC/DC CONVERTERThe Kilo, Mega, and Giga series of half-brick units offers

designers a fully-scalable range of DC/DC converters cov-ering a wide output current range of 20 to 60 A. The linesinclude output voltages from 1.5 to 15 V. All units drawpower from a 48-V nominal input (35- to 75-V range) anddeliver 20 to 40 A of output current or 75 to 150 W of out-put power.

An important benefit for designers is the scalabilityafforded by the full line of half-brick modules. Because allthe converters use the same topology, circuitry, pin-out,and footprint, you can be assured of complete plug-and-play compatibility when moving among different powerlevels within the industry-standard, half-brick format.

The half-brick converters use synchronous rectificationand a patented topology to achieve high efficiency andhigh current.

The standard modules in 1000-unit quantities cost $82for Kilo, $99 for Mega, and $129 for Giga.

SynQor(888) 567-9596Fax: (978) 567-9599www.synqor.com

TWO-AXIS MAGNETIC SENSORThe HMC1052 is a two-axis sensor on one chip for com-

passing and position-sensing applications requiring ultrasmall size, low power, and high performance. Theseinclude handheld wireless appliance applications such asmobile phones, personal digital assistants, walkie-talkies,watches, and GPS receivers. Advantages of this newpatented design include nearly perfect orthogonal two-axissensing in a 3 × 3 × 1 mm 10-pin miniature surface-mountpackage (MSOP).

The sensor has a sensitivity of 1 mV/V/Gauss, a widefield range up to ±6 Gauss, and can operate on a supplyvoltage as low as 1.8 V. Nearly perfect orthogonal two-axissensing and matched sensitivity on both axes improve theperformance and accuracy of this sensor. Patented on-chipset and reset straps eliminate the effects of temperaturedrift and stray magnetic fields.

Sensors are available in packages of five starting at $100.

Honeywell Solid State Electronics (800) 323-8295www.magneticsensors.com

20-BIT CONFIGURABLE BUS SWITCHThe FST16450 is a 20-bit configurable bus switch with

selectable level shifting and the FSTUD16450 is a 20-bitconfigurable bus switch with undershoot protection andselectable level shifting. Both devicescan be configured as 4-, 5-, 8-, 10-, 16-,or 20-bit switches. These devices offersignificant space savings, design flexibil-ity, and part count reduction.Additionally, you can replace severaldevices while maintaining the board’scurrent communications protocol.

The bus switches both include selec-table voltage level shifting to allow

designers to translate 5-V inputs to 3-V outputs using aselect pin. These bus switches also include all standardfeatures such as 4 Ω between ports, zero bounce in flow-

through mode, propagation of only0.25 ns, and 3-µA ICC. The FSTDl6450and FSTUD16450 are available in TSSOPpackaging. Pricing in volumes of 1000 is$2.10 and $2.25, respectively.

Fairchild Semiconductor(888) 522-5372Fax: (972) 910-8036www.fairchildsemi.com

Page 12: cc_2001_07-132

The system controller also incorporates diverse-redun-dant microcontrollers, in this case to monitor the STB

outputs to determine when theychange state, if both STBs changesimultaneously, and if there areany controller or machine feed-back faults. The system meetssafety category four requirementsof EN 574 Safety of Machinery.The system also meets Type III Crequirements of EN 574 Safety ofMachinery.

The DUO-TOUCH SG kit ispriced at $437.

Banner Engineering Corp.(888) 373-6767Fax: (763) 544-3213www.bannerengineering.com

NEWSArticle-teplet.qxd

10 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

NEW PRODUCTTWO-HAND CONTROL SYSTEM

The new DUO-TOUCH SG two-hand control systemcombines two ergonomic self-checking touch buttons(STB ) with a 22.5-mm (0.9″) wideDIN-mount controller. The sys-tem is designed to provide safemachine cycle initiation and helpeliminate the repetitive stressinjuries common among machineoperators.

The touch buttons incorporatediverse-redundant microcon-trollers that continuously checktheir internal safety-critical func-tions. If a fault is detected in anSTB, its microcontrollers will holdthe outputs in the OFF state andflash a fault LED to alert an opera-tor. The STB outputs (one normal-ly open and one normally closed)are monitored by the device’s con-troller.

Page 13: cc_2001_07-132

716-425-3753 • Fax: -3835

www.saelig.com • [email protected]

Saelig

! "#$%&&' !'" $( $")"!& &"' "& "' *+ "

We are noted for ourgreat after salessupport. , &1-888-7SAELIG -' -! " ' ' ' " $

• Over 50 different DIN-modules for:analog i/p & o/p, thermocouple i/p,digital i/p, relays, on 2000m network!

• Plug directly into PC— self powered!

• Drive any RS422 or RS485 devices.

• Send control and data 100s of feet!

K422/K485, 25pin > 9pin . . . $69K422-99/K485-99,

9pin > 9pin . . . . . . . . . . . $69Isolate RS232/422/485 signals

Kxxx-ISOL 25pin self-powered . . . . . . . . . $139

Make PCstalk I2Ceasily!

ISA PCI p-port

RS232 to RS422 &RS485 converters

• Store analog/digital data on PC FlashATA cards

• > 100 readymadesoftware functionmodules—finish quickly.

• 8ch 10bit A/D, 33 I/Os, I2C, 2 xRS232, interrupts, sleepmode,pre-emptive multitasking, easy toattach LCD or keypad.

• CANbus adapter—recompile or logdata over huge network!

osziFOX$129

Self-contained in2" x 3" plastic box,2-year battery-powered analog anddigital dataloggersfor storing events,

voltages, currents orpressures for days to weeks.

Download detailed time and datavia RS232 port and review your results with graphic software or PC spreadsheet.

Turn yourPC into a

scope!

HandheldPenScope

2-Year Dataloggers

PCMCIADatalogger TDS2020D

lowpower PCcard logging

Remote control & dataacquisition without power!

PC InstrumentsADC-10 8-bit $79 through ADC-216 16-bit $799—displayscope, spectrum and meter simultaneously. Connect to PC

parallel port and startgathering/displaying dataimmediately!

• EnviroMon temperature logging/alarm system standalone or with PC.

• TH-03 thermistor-to-PC converter

• TC-08 8x thermocouples

NOW!

GP S

Logg ing

see what’s new at www.saelig.com!

Industry-standard card for PC’s . . . . . . . . . . . . . $299• Master, Slave or Bus monitor

• Control or program I2C devices

• Low volt ICA93LV for 3V ic’s . . $399• PARALLEL PORT VERSION

NEW - PCI VERSION!

BIT®

CANboards

SMD PCB adaptersfor prototyping

by Janzfor all computers

www.abidata.be for details.

“How to I2C”

www.saelig.com

DrDAQ plugs into a PC for usefuldatalogging at school, college,industry. Built-in sensors for light,sound, temp. or add pH sensor andrun one of the many suggestedscience experiments! - only $99!

2-wirecontrol network

power & information on 2-wires!

CANbus Starter PacksBoards for PCI/ISA/PCMCIA/PC104/VME/compPCI

Drivers for WIn95/98/NT,VxWORKS, pSOS, Lynx,

Linux, OLE, HPVee, LabView, etc.

DrDAQEducationalDatalogger

built-in sensors!www.drdaq.com

," '. , ) / 0,1 2 0 2 *+ !3' 4 5 6"- 7 "'4 + !8#87 '

new!

Page 14: cc_2001_07-132

12 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

uring the sum-mer of 1999, I was

living in Hanover,New Hampshire with my

roommate Ben Guaraldi. One quiet,sunny morning I woke up late andwalked into the living room to findBen dozing on the couch. At thesound of my entrance, he opened oneeye and we looked at each other for amoment, each of us still experiencinga post-sleep stupor. In an uncommonepiphany it was clear to me that Icould communicate to Ben the entirecontents of my just-barely-awakemind with one single word: pork!

Yes, indeed, the other white meat.Try it, even if you don’t dig swine.You might find that a whole world ofhuman experience can be expressedwith this one simple word. Even ifyou don’t agree, Ben did. So, on thatquiet, sunny morning in Hanover,New Hampshire, we had an entireconversation using only the word“pork.”

As time passed, we becamemore impressed with the dynamicrange of the p-word. And, we gotcreative about how we communi-cated it. While shopping at thelocal drugstore, I stumbled upon atalking bass. For those of you who

don’t know what I’m talking about,the Bass is one of several “talkingfish” toys that have cropped up duringthe last few years. It looks like a life-size stuffed fish, complete with wall-hanging plaque. When you press thesmall, red button on the front, thefish comes to life and talks to you. Iam serious. In this article, I’ll discussthe Big Mouth Billy Bass (see Photo1), made by Gemmy Industries,because it seems to be the most wide-ly available toy of this type.

These Bass are nothing short of lit-tle animatronic wonders. Now who’sput two and two together? Pork. Bass.Talking Bass. Christmas was fastapproaching and I didn’t have a giftfor Ben yet.

TEACH A FISH A NEW TRICKIn case you haven’t gotten it yet,

these three ingredients should com-plete the picture:

• WECA’s ISD 1420P solid-stateChipCorder voice record/playbackchip [1, 2]

• Atmel’s AT89S8252 microcontroller[3–7]

• Motorola’s MC34119 audio amplifi-er [8]

The recorder chip stores 20 s oftelephone-quality voice. It has non-volatile RAM, in-system recordingcapability, and comes in a 28-pin DIP.The microcontroller has 8 KB of flashmemory, 2 KB of EEPROM, andcomes in a 40-pin DIP.

After removing the screws that holdthe back of the Bass’s plaque, I discov-ered that there’s plenty of room foradding special circuitry. Clearly, I did-n’t want to destroy the existing cir-cuit. I wanted to hijack its powerdrivers for the motors. And besides,

FEATUREARTICLE

What’s the best partabout being an engi-neer? Playing with allthe gadgets! And, wesee a potential projectin almost anything,right? Well, Marty’shere to share hisvision for an embed-ded applicationinspired by a singingfish and a love forpractical jokes.

The Lighter Side ofProgrammingHow to Improve a Singing Fish

d

Marsette Vona

Special sub-mode SW1 SW2 SW3

Record Voice Short Short ShortRecord Mouth Open Open ShortRecord Head Open Short OpenRecord Tail Short Open OpenPlay (button only) Open Open OpenPlay (button or motion) Open Short Short

Table 1—There are six sub-modes to choose from when theBass is in Special mode. Set switches one, two, and threeaccording to this table to pick the one to use.

Page 15: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 13

the messages it comes with are hilari-ous, especially after you’ve heardthem a hundred times.

An investigation with an oscillo-scope revealed that control of theBass’s head, tail, and mouth isextremely simple. Energize the corre-sponding motor, and the head turnsout and the tail extends or the mouthopens. De-energize the motor, and thecorresponding body part returns (by aspring) to its rest state. We have bina-ry actuators here, folks. And, it wasclear that I could tie into the gateinputs of the motor drivers with sim-ple diode OR circuitry (see Photo 2).

After I got the circuits built anddebugged, it took only a few minutesto record my message. First, there’s5 s of silence during which the tailflops around, the head moves out andpauses for 0.5 s, and then the Basssays “Pork!” Then, the head movesback in, followed by 5 s more ofsilence with its tail flopping.

I wrapped the fish in its original

packaging, with the mode switch leftat “special” and the batteries inserted.Ben’s reaction when he pressed thatbutton was nothing short of priceless.

DESIGN DETAILSIf you envy Ben and want your own

hacked Bass, you’re in luck, becauseI’m going to tell you exactly how I didit. The hack adds a 20-s re-recordablespecial message to the Bass. Themovements of the head, tail, andmouth are also re-recordable (storedin EEPROM in the ’8252), and theoriginal factory messages are stillavailable.

Figures 1 and 2 show the circuitthat I added. Figure 2 is based on aWindbond datasheet and applicationbrief. [1, 2] Photos 3 and 4 show thetop and bottom sides of the mainadded circuit board.

As you see, I added four switches.SW4 toggles the Bass between Normaland Special mode. In Normal mode,the Bass should behave as it always

has. In Special modes, operationdepends on the settings of SW1…3,which set the current sub-mode.Currently there are six sub-modes:Record Voice, Record Mouth, RecordHead, Record Tail, Play (button only),and Play (button or motion).

The Record Voice mode records anew message up to 20-s long. Onlyone special message is supported at atime. When the button on the front ispushed and held in, any sound will berecorded until the button is let out or20 s passes. New special messages canbe recorded as often as you like; doingso will erase the existing special mes-sage and reset all head, tail, andmouth movements.

You can record mouth movementswith Record Mouth mode. Press andrelease the button on the front tostart playback of the special messagealong with any existing recorded tailand head movements. While the mes-sage is playing, press and hold thebutton to open the mouth. Release

Figure 1—This is the first half of the Billy Bass Hack schematic, show-ing the microcontroller, sensor, and actuator circuits.

Page 16: cc_2001_07-132

14 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

the button to close it. The mouthmovements recorded will be playedback subsequently whenever the mes-sage is played in Play, Record Head, orRecord Tail modes.

It can be difficult to get the timingright, so it helps to have a digitalstopwatch on hand. And, you can, ofcourse, rerecord the movements asmany times as you like. Rerecordingthe movement does not erase the cur-rent audio or movements of the otherbody parts.

Record Head mode allows you toprogram movement of thehead (either flat against theplaque or turned to faceyou). Operation is similar toRecord Mouth mode.

Record Tail mode recordstail movements. And again,operation is similar toRecord Mouth mode.

When the button ispushed and released duringPlay (button only) mode,the currently stored mes-sage is played back alongwith any recorded head,tail, or mouth movements.

The last sub-mode, Play(button or motion), is thesame as the button-only

mode except the motion sensor willnow also trigger playback. For this towork, the original Big Mouth BillyBass motion sensor enable switchmust be on.

If you build the circuit according toFigures 1 and 2, the Special modeswitches work as shown in Table 1.

There is also a knob for adjustingthe volume in Special mode (visiblejust above the ’34119 in Photo 3) andan LED (useful during software devel-opment). It’s possible to use thespeaker as a microphone, but to keep

things simple I added a separatemicrophone to the Bass to supportrecording sound.

POWER SUPPLYThe Bass is designed so that it can

be either powered from four onboardC cells or a wall wart power trans-former. The Bass actually comes withbatteries and a female coaxial powerjack for the wall wart.

I originally planned to use a 7805regulator to supply power to myadded circuit from either the batteries

or wall supply. But, I quicklydiscovered that the 6 V fromthe batteries does not leaveenough voltage headroom fora regular 7805, especiallywhen the motors are ener-gized (because the high cur-rent drain causes the batteryvoltage to dip significantly). Itmay be possible to circum-vent this issue by using a(low dropout) LDO regulator,but I didn’t have one.

It turns out that a regulatoris unnecessary for this circuitwhen powered by the batter-ies. Be careful though becausethe specified maximum oper-

Figure 2—This is the second half of the BillyBass Hack schematic, showing the audio andpower-supply circuits. [5, 6]

Figure 3—This is theschematic for the AtmelAT89S8252 parallel port pro-grammer.

Page 17: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 15

ating voltage of the ’8252 is 6.6 V, andsome freshly charged cells may sur-pass this. However, unless you get aregulated wall wart (which is lesscommon than the unregulated vari-ety), regulation is necessary whenusing the wall wart.

So, I moved the 7805 to the wallwart jack. This way when the wallwart is connected, the Bass is sup-plied through the regulator. But whenthe wall wart isn’t present, the juicecomes directly from the batteries. Ifound a 9-VDC, 500-mA wall wart

from JDR (part TR09-DC)that works well. Polarityisn’t standardized for allwall warts. Be careful to useone that agrees with theBass (center positive).

Internally, the coaxialjack has three terminals.One carries positive voltagein from the wall wart, oneis system ground, and theremaining one is batteryground. The termi-nal with the lone

black wire going to the nega-tive side of the battery packshould be battery ground.The one that connects to theouter conductor on the coax-ial jack should be systemground. And the remainingterminal should be +VIN (ithad a pink wire attached inmy Bass).

The jack has a switch thatautomatically connects aux-iliary ground to systemground when the wall supply

plug isn’t inserted and disconnects itwhen the supply is inserted. Thiseffectively isolates the batteries whenthe wall supply is connected. Be care-ful not to mangle this switch; doingso could inadvertently cause the wallsupply to drive current through thebatteries, which would be a bad thing.Before and after you finish your work,verify the proper operation of theswitch with a continuity tester: Whenthe wall wart is inserted, there should

Photo 2—The innards of the Big Mouth Billy Bass look like this afterthe addition of Special mode.

Photo 1—The Big Mouth Billy Bass from Gemmy Industries providesthe basis for a fun project.

Page 18: cc_2001_07-132

16 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

be no continuity from thenegative terminal of the bat-tery pack to system ground.

Of course, as in any mixedsignal circuit, keep separatepower and ground nets for theanalog and digital portions.Keep them separate until asclose to the supply points aspossible. If you have audionoise problems, especially ifthey occur only when themotors are energized, checkyour supply voltages.

The special circuit drawsabout 13 mA when powered.However, the ’8252 is pro-grammed to shut downeverything after about 25 sof inactivity. In this Low-Powermode, the special circuit draws onlyabout 0.3 mA. C cell batteries typical-ly have capacities around 5000 mAH,so the Bass should be able to sit idlefor months before it drains its batter-ies. And, when you do need to changethe batteries, you’ll be happy to knowthat both the memory of the ’1420

and EEPROM of the ’8252 are non-volatile. So, you’ll lose neither theaudio nor motions of your carefullyrecorded message.

PROGRAMMING THE ’8252The AT89S8252 is mostly back-

ward-compatible with the original’8052 microcontroller. All of the code

that runs on the ’8252 iscontained in the assemblylanguage file bass.asm (avail-able online).

I used the freely availableassembler as31 to producean Intel format hex file(bass.hex) from the assem-bly code. [6] Well, sort of.Actually, before I ranbass.asm through as31, Ipassed it through the C pre-processor. One reason I didit this way is because itallowed me to define bitaddresses as named sym-bolic constants (which as31does not handle well).Another reason is that it

allows for conditional assembly,although I’m not using this yet.

However, the C preprocessor is notan ideal solution. Unmatched singleor double quotes anywhere inbass.asmwill make the C preproces-sor choke (except if enclosed in Cstyle: /* code comments */).Comments on the same line after

Photo 3—With a top view of special circuit board, you can see the chips. The largechip is the ’8252, the medium-sized chip is the ’1420, and the small chip is the’34119.

Page 19: cc_2001_07-132

!

"#$

!"#

$ %& ' ( ) $

!"# * + )) , -

.$ /0(1 2' $ $

)- -)) $

34 $ !"# $ ( ) & (

-)-5 -1

$ 4 -4 4 ) 4

+4 +) -))3(

61+ 171/849##/

Page 20: cc_2001_07-132

improvements. For example,now the timing is independ-ent of the machine you run iton, and it runs under DOS aswell as Linux. For Linux, youneed Linux kernel or higher2.0. The DOS version runsunder most versions ofWindows, but not NT.

Source code (89prog.c) andcompiled executables (89progfor Linux and 89prog.exe forDOS) are provided with thedesign documents on CircuitCellar’s web site. Hook up

your programmer to the parallel port,insert your ’8252, and power up theprogrammer. Run 89prog, feeding ityour Intel hex file like this:

> 89prog bass.hex

If your parallel port is not at thecommon address of 0x378 you need tospecify the address explicitly on thecommand line. Run 89prog withoutarguments to get a usage message thatexplains how to do this.

Sometimes my programmer failswith an “invalid checksum” errormessage. Reinserting the ’8252 a fewtimes often fixes the problem, trying89prog each time. (I haven’t gotten tothe bottom of this yet, so please letme know if you have any ideas.)

CONSTRUCTION NOTESIt’s tricky to mount the toggle

switch, mode switches, LED, andmicrophone. You need to get creativehere. I recommend trying to mounteverything on the rear surface of theBass’s plaque, so that from the front

18 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

#define statements will misbehave.And when you get an assembler error,the line number reported actuallyrefers to the post-C preprocessed file(bass.p.asm). And, take a look at thelast few lines of bass.asm for a laugh.A more generic preprocessor like M4probably would be a better choice.

The good news is that I provide amake file with the design documents,so if you’re on a Linux system, all youneed to do to build bass.hex (afterinstalling as31) is type:

> make bass.hex

It also should be possible to buildbass.hex from bass.asm on any systemin which both the C preprocessor andas31 run, however I’ve tried it only onLinux. You can probably get the codeto build with a different assembler ifyou make some syntax adjustments.

Of course, if you’re not interestedin playing with the code, you shouldbe able to use just the Intel hex file,which you can send directly to a pro-grammer. Don’t have a programmer?No problem. It’s easy to build onethat connects to a PC parallel port.That’s the major reason I chose theAT89S8252 for this project (I didn’thave a programmer either). Get your-self a 40-pin ZIF socket for the ’8252and connect it as shown in Figure 3.

Now, you need a program to run onyour PC that twiddles the bits on theparallel port so that the contents ofyour Intel hex file get transferred tothe ’8252. A few searches on theInternet turned up a guy named RobMelby who wrote such a program,called 89prog, for Linux. I added some Photo 5—Use this mounting technique for SW4.

Photo 4—Here’s a bottom view of the special circuit board.

Page 21: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 19

the Bass doesn’t appear to be modi-fied. Be sure to have some gap-fillingsuperglue and hot-melt glue on hand.

When attaching things that stickout the back of the plaque, keep inmind that if you want to be able tomount the Bass on a wall, whateveryou attach needs to protrude less thanthe mounting feet do. This can com-plicate things. For example, in orderto mount SW4, I ended up soldering astiff wire loop to its knob so I couldmount the switch parallel to the backplate of the plaque (see Photo 5).

As shown in Photos 2 and 3, I useda JALPC-3 perfboard that can be sol-dered from Hosfelt Electronics tobuild most of the circuit. Point-to-point wiring is used throughout. Usesockets for each of the ICs, and com-plete all soldering and check every-thing twice before you insert them. Ifyou plan to modify the code, you maywant to get an additional 40-pin ZIFsocket to install in the Bass. Just plugit into the regular 40-pin socket thatyou have for the ’8252. This way it’seasier to move the ’8252 between theprogrammer and Bass while doing theassemble-burn-test dance.

You’ll find that there are manywires to connect the circuit boardsand other parts together. Use strandedhook-up wire, and be careful aboutstrain-relieving it at each end. Forexample, when attaching a wire to theadded board, you may want to slightlyenlarge one of the holes, pass the wirewith insulation through the enlargedhole (from the component side to thesolder side), and then solder the wire.When connecting the head, tail, andmouth control wires to the originalboard, use plenty of hot-melt glue forstrain relief. In fact, you should alsoput big blobs of hot-melt glue aroundthe solder points of the original wires.

It’s likely you’ll do a lot of rearrang-ing and it would be annoying if duringall this you overstress and break offsome wires. It’s also annoying if youaccidentally allow superglue to wickits way to the inside of your switches.

FUTURE WORKI hope you find that your hacked

Bass has all the functionality youneed. However, if you’re looking for a

[4] Intel Corp., MCS 51 Microcontroller Family User’s Manual, 272383-002, February 1994.

[5] Atmel Corp., “8051 Flash Microcontroller Data Book,” 0522B-12/97/65M, December 1997.

[6] P. Stoffregen, Paul’s 8051 Tools, Projects and Free Code Offerings,www.pjrc.com/tech/8051/#as31_ assembler.

[7] ———, “AT89S8252 In-System Programming,” December 1997, www.atmel.com/atmel/acrobat/doc0898.pdf.

[8] Motorola, Inc., “Low Power Audio Amplifier,” rev. 1, MC34119/D, 1996, e-www.motorola.com/collateral/MC34119.pdf.

SOFTWAREThe design documents, a parts list,and code files are available on theCircuit Cellar web site.

REFERENCES[1] Windbond Electronics Corp.

America, “ISD1400 Series Single-Chip Voice Record/Playback Devices, 16- and 20-second durations,” April 1998.

[2] ———, “Stand-Alone/Parallel Interface Products: Good Audio Design Practices.”

[3] Atmel Corp., “8-bit Microcontroller with 8k Bytes Flash—AT89S8252,” rev. 0401E, February 2000, www.atmel.com/ atmel/acrobat/doc0401.pdf.

Marsette “Marty” Vona is a graduatestudent in Electrical Engineering andComputer Science at MassachusettsInstitute of Technology. His researchis in the field of precision metrologyfor mechatronic systems. You mayfind him on the Internet atwww.ai.mit.edu/~vona.

SOURCESAT89S8252 Atmel Corp.(408) 436-4270Fax: (408) 436-4314www.atmel.com

Big Mouth Billy BassGemmy Industries, Inc.(972) 550-7979Fax: (972) 550-0495www.gemmy.com

JALPC-3Hosfelt Electronics(800) 524-6464(740) 264-6464Fax: (800) 524 5414www.hosfelt.com

IC distributorJDR Microdevices(800) 538-5000(408) 494-1400Fax: (408) 494-1420www.jdr.com

MC34119Motorola, Inc.(847) 576-5000Fax: (847) 576-5372www.motorola.com

ISD 1420PWindbond Electronics Corp.America(800) 677-0769(408) 943-6666 Fax: (408) 544-1789www.windbond-usa.com

challenge, consider trying to imple-ment one or more of the followingfeatures: in-system programming,serial interface, or multiple messages.

An Atmel application note containsuseful information for people whowant to make their projects in-systemprogrammable. [7] This note also is agood read for general informationabout serial programming the ’8252.For ISP, the main issue is that youmay need to externally latch the out-puts of the ’8252 that connect to theBass and ’1420 during programming.

Currently, the ’8252 has a UARTthat you aren’t using. So, you canhook up a MAX232 level converterand a connector to communicatedirectly with the Bass from a PC.

As it is, only a single 20-s or lessspecial message is supported. Becausethe ’1420 is addressable, it should beable to support multiple messagesthat add up to 20 s or less.

Please let me know if you completeany of these modifications or if youthink of any other fun ones to tackle.Good luck and happy hacking! I

Page 22: cc_2001_07-132

20 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

roviding safetyand security for a

home or businessprobably is a major con-

cern for many of you. Replacing stan-dard locks and keys, keyless entrysystems have changed the securitymarket. In this article, I’m going totell you about an entry control sys-tem design that’s based on Motorola’sMC68HC11 microcontroller.

This system covers all of the bases.People are identified by their namesand personal access codes, which areread by a magnetic stripe on a 4 × 4keypad. If the access code and nameare correct, the relay will be energizedto open the door. Otherwise, a warn-ing signal will be displayed on aninteractive LCD. A real-time clockchip tracks the history of date andtime. An external 8-KB serial EEP-ROM records the history of all activi-ties with a time stamp on the securityentry system. And, a DB-25 connectorinterface to a PC parallel port gainsaccess to the recorded history.

MC68HC11Two circuits on two separate boards

comprise the system. The first circuitis the RS-232 loader (see Figure 1a).This uses MC145407 (marked as U2),

an EIA-232 transmitter and receiverthat downloads the application codefrom a PC to the microcontroller sys-tem board through Motorola freewarecalled PCBUG11 V.3.42. PCBUG11runs under DOS and WIN NT but notWindows95/98. It programs the appli-cation code to the internal EEPROMor EPROM of the ’68HC11. Theloader circuit uses the ’68HC11’s SCIthrough a DB-25-to-DE-9 cable to thePC serial COM port.

The second circuit is the ’68HC11,marked as U1 in Figure 1b. This sec-tion has different jumper settings fordifferent applications (see Table 1).

The normal procedure to load appli-cation code to the microcontroller’sinternal EEPROM or EPROM has fivesteps. First, power the system’s boardwith 5 V and connect the loader cir-cuit to the system board with a four-pin connector cable. Connect theloader circuit to the PC COM portusing a DB-25-to-DE-9 cable. Second,at the DOS prompt type:

PCBUG11 –ECONTROL BASE HEX

Third, enable Write mode to theinternal EEPROM by setting J5 topins 1 and 2 and J6 is ON. To useEEPROM, set J4 to pins 1 and 2 andtype EEPROM B600 B7FF. To useEPROM, set J4 to pins 2 and 3 andtype EPROM D000 FFBF. You also needto apply 12.25 V to C3 for EPROMprogramming. (You can download alist of the various EEPROM maps of’68HC11s from Circuit Cellar’s website).

Then, for step four, manually dis-able the EEPROM protection atBPROT ($1035) address by typingMM 1035 10. And, fifth, load the appli-cation code to the designated EEP-ROM or EPROM area by typing LOADSfilename.S19.

The loaded application code can beexecuted by PCBUG11 by typing “GOstarting address” or simply discon-necting the loader circuit, changing J5jumper to pins 2 and 3, J6 jumper toOFF, and pressing the reset switch.You can download PCBUG11 and adetailed description of available com-mands from Motorola’s web site.

FEATUREARTICLE

A simple magneticstripe can tell a lotabout a person. Italso can serve tokeep your loved ones,personal belongings,or office equipmentsafe. Steve talks shopabout a keylessapproach to securitythat’s inexpensive andappropiate for justabout anywhere.

Keyless Entry ControlSystem

p

Steve Hsiung

Page 23: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 21

PB0 = 1 enables the display ofASCII code on the LCD module. ThePB1 to RS line selects the LCD mod-ule’s instruction or data register. ThePB2 to E line provides the enable sig-nal for the LCD module’s internal reg-isters. You can download the LCDmodule’s instruction register settingsfor various display functions and for-mats from Circuit Cellar’s web site.

Take a look at Listing 1, whichpresents the algorithm used to initial-ize the LCD module. You may repeatthe three steps shown if necessary forany message display. To alter the dis-play format, write to the instructionregister with the proper code (RS = 0).

A 16-key keypad is connected toPort C of the MC68HC11. Port pins 0through 3 are configured as inputs forreading any keystroke. And, pins 4through 7 are configured as outputsfor scanning any key action. All pinson Port C are pulled up through 10-kΩ resistors to eliminate floatingnoise, as shown in Figure 2. Listing 2states the algorithm that performs thesoftware scanning and debouncing.

REAL-TIME CLOCK CHIP Motorola’s MC68HC68T1 real-time

clock chip keeps track of the entrycontrol system’s date and time passed.The chip uses an SPI interface to the’68HC11 for both direction communi-cations (see Figure 2). PB3 = 1 is usedto activate the SPI interface logic ofthe ’68HC68, otherwise the chipwould be in a high-impedance state.The date and time information is dis-played on the LCD in a format ofyear, month, day, hour, and minuteand is updated each minute.

To write to the MC68HC68T1(RTC), first provide the address of thebyte to be written, then follow with awrite to the data byte. To read fromthe MC68HC68T1 (RTC), first pro-vide the address of the byte to beread, then follow with a dummy writeof $FF. The desired data bits areclocked out at the same time as thedummy bits, but on the differentclock edge.

There is only one routine neededfor both reads from and writes to thisreal-time clock chip. The routine ispresented in Listing 3.

Listing 1—The regular initialization steps for the LCD module usually are used once at the beginning of theLCD module implementation. The display format can be changed by writing to the instruction register with theproper code, RS = 0.

Enable LCD Display ;PB0 = 1Set RS=0 ;PB1 = 0Send $38 to Instruction Register ;Set for 8 bit data transfer & dual line displayPulse E Line ;PB2 = 1 then PB2 = 0Time Delay ;CPU Delays for m SecSend $0C to Instruction Register ;Set display on, no cursor, no blinkingPulse E Line ;PB2 = 1 then PB2 = 0Time Delay ;CPU Delays for m SecSend $06 to Instruction Register ;Address counter increment after each displayPulse E Line ;PB2 = 1 then PB2 = 0Time Delay ;CPU Delays for m SecSet RS=1 ;PB1 = 1Send ASCII Byte to Data Register to Display

;Display the letter in ASCII formPulse E Line ;PB2 = 1 then PB2 = 0Time Delay ;CPU Delays for m Sec

Listing 2—This pseudo-code describes the 4 × 4 keypad scanning, decoding, and debouncing.

Set PC0-3 as Input, PC4-7 as OutputSet Index Pointer to Beginning of Table ;Table has all 16 keys key codesAGAINSend $EF to Port C ;Scan 1st column on PC4CALL CHECK_KEYSend $DF to Port C ;Scan 2nd column on PC5CALL CHECK_KEYSend $BF to Port C ;Scan 3rd column on PC6CALL CHECK_KEYSend $7F to Port C ;Scan 4th column on PC7CALL CHECK_KEYGOTO AGAIN

CHECK_KEY ;Check any row = 0Set Counter = 4 ;Use counter for 4 rowsSEE_COLIf Column Bit = 0 ;If any row = 0, take data from pointer

Take Data from Table via Index Pointer and save to MemoryDEBOUNCERead Port C ;De-bounce all 4 rows till no zero readIf PC0 = 0 ;Check row 0 at PC0GOTO ADJ_STACKElse If PC1 = 0 ;Check row 1 at PC1GOTO ADJ_STACKElse If PC2 = 0 ;Check row2 at PC2GOTO ADJ_STACKElse If PC3 = 0 ;Check row3 at PC3GOTO ADJ_STACKElse GOTO DEBOUNCEADJ_STACKSP =+ 2 ;Adjust Stack Pointer due to subroutine callGOTO MAIN_PROG ;Exit the keypad scanning routineElse Counter =- 1 ;Reduce counter ready for next rowIndex =+ 1 ;Move index pointer along in the tableIf Counter = 0 ;If no zero found in row go back to scanning routineRTSElse GOTO SEE_COL ;Check for next rowMAIN_PROG ;The main program that will use the key pressed

INTERFACINGInterfacing the ’68HC11 with an

LCD is accomplished with an SPI viaa 74164 shift register. Serial data fromthe SPI is converted to parallel for-mat, which is needed to connect to

the LCD’s data port in 8-bit interfaceform (see Figure 2). Because the soft-ware is implemented in one-way com-munication (write) and reading of theLCD status register isn’t necessary,the R/W line is always grounded.

Page 24: cc_2001_07-132

22 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

MAGNETIC STRIPEREADER

Mag-Tek’s MT-211 mag-netic stripe reader is con-nected in the bit bangingmethod on Port E (PE0 =Data and PE1 = Strobe) forreading user personal iden-tification. An interruptconnection from theCARD PRESENT signal tothe ’68HC11’s IRQextracts the informationfrom the magnetic stripecard. And then, the mag-netic stripe reader readsTrack1 card data, whichhas 6 bits and 1 odd paritybit for each character.

Track1’s serial data for-mat is shown in Listing 4.Note that only the Namefield characters are used inthis application.

All of the informationreceived after the IRQinterrupt, which includesthe user’s name and per-sonal identification num-ber and time stamp, is recorded in theexternal serial EEPROM.

All three signals, CARD PRESENT,DATA, and STROBE, are negativetrue logic. So, the 6-bit data read fromthe magnetic stripe reader has to beinverted to become the user’s name inASCII code format. I included somesample code of bit banging and read-ing the serial data, which is availableto download from Circuit Cellar’sweb site.

SERIAL EEPROM TO ’68HC11Xicor’s X25650 8K × 8 serial EEP-

ROM records the security system’shistory. Figure 2 shows that theX25650 provides the SPI port inter-faces to the ’68HC11 and a PC paral-lel port. This nonvolatile memory cansave the user’s name, ID code, andtime stamp, which are provided bythe control code of the ’68HC11. Thetime stamp of any IRQ interrupt fromthe magnetic stripe reader and all fol-

lowing data sequences are recorded inthis 8-KB EEPROM.

The other interface to the parallelport has a 2N7002 and 74HC14 buffercircuit. This interface provides theoption of having a PC download theinformation from the EEPROM to afile or print out a hard copy. The con-trol codes and different functions ofthe X25650 are available to download.

In addition to the bit banging code,the algorithm and sample code for the’68HC11 to write to and read fromthe X25650 are available on CircuitCellar’s web site.

The algorithm for a PC to read fromor write to the EEPROM of theX25650 can be done in a similar man-ner by bit banging the PC’s parallelport on pins 4, 6, and 7 (data bits areoutput and pin 13 selects bits asinputs). A high-level language such asC can be used to communicate in SPIformat with the X25650.

OPERATIONThe security system control uses an

LCD module to interact with users. Ifthere is no interrupt from the magnet-

Figure 1a—The loader circuit has an MC145407 or MAX233 that uses an RS-232 to interface with the PC serial port. b—This low-cost system board design can be used for various HC11 family members.

Jumper Setting Function

J1 (MODA) On BootstrapOn Single chipOff ExpandedOff Special test

J2 (MODB) On BootstrapOff Single chipOn ExpandedOff Special test

J3 (IRQ) On 10k Pull-upOff No pull-up

J4 (EPROM) Pins 1 and 2 Normal operationPins 2 and 3 68HC11 Internal EPROM programming

J5 (EEPROM) Pins 1 and 2 68HC11 Internal EEPROM programmingPins 2 and 3 Normal operation

J6 (XIRQ) On Loading E2 codeOff 10k Pull-up

Table 1—The HC11 sys-tem board uses thesejumper settings.

a)

b)

Page 25: cc_2001_07-132
Page 26: cc_2001_07-132

24 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

ic stripe reader, the security systemprints a greeting message, updates thedate and time information on theLCD module, and instructs potentialusers to start with a qualified magnet-ic stripe card. This repeats over andover again until there is a CARDPRESENT interrupt. The desirablesetup information is loaded into thesystem from a PC during initializa-tion and stored in the externalX25650 serial EEPROM.

After a card is slid through the mag-netic stripe reader, the systemprompts to enter the user’s securitycode. After the code has been entered,the system checks the card informa-tion and security codes against thepre-stored data. If all of the datamatches, the system will energize arelay to open the door through anelectric latch. If the information isn’tcorrect, the user will be given twomore chances. And, if the thirdattempt fails, the security system willignore any further activity by the userfor 10 min.

Figure 2—The HC11 system uses peripheral control circuits.

Page 27: cc_2001_07-132
Page 28: cc_2001_07-132

• Intel Pentium III Processor• 256MB 133MHz SDRAM• 40GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• 50X CD-ROM• ATX Professional Tower Chassis• 1 Parallel, 2 Serial, 2 USB ports• 17" .27 1280x1024 Monitor• ATI Xpert 2000 32MB AGP Video Adapter• Yamaha Sound System & 120 WATT Spkrs• Windows '98, Logitech PS/2 Mouse & Keyboard• Netgear 10/100 PCI Ethernet Card

• Intel Pentium 4 Processor• 256MB PC800 RAMBUS• 60GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• 12X DVD CD-ROM• Creative Labs CDRW 32x12x10• 1 Parallel, 2 Serial, 2 USB ports• 19"KDS .26 V195 Monitor• ATI Rage Fury Max 64MB AGP Video Card• P4 Mid Tower Chassis & 300W PS• Yamaha Sound Card & 520 WATT Speakers• Windows ME, Microsoft Intellimouse & Keyboard• 56K v.90 Lucent PCI Modem w/Fax & Voicemail

• Intel Pentium 4 Processor• 128MB PC800 RAMBUS• 40GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• Creative Labs CDRW• 1 Parallel, 2 Serial, 2 USB ports• 17" .27 1280x1024 Monitor• ATI Xpert 2000 32MB AGP Video Adapter• P4 Mid Tower Chassis & 300W PS• Yamaha Sound System & 120WATT Speakers• Windows '98, Logitech PS/2 Mouse & Keyboard• 56K v.90 Lucent PCI Modem w/Fax & Voicemail

• Intel Pentium III Processor• 256MB 133MHz SDRAM• 40GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• 50X CD-ROM• ATX Professional Tower Chassis• 1 Parallel, 2 Serial, 2 USB ports• 32MB AGP Video Adapter• Yamaha Sound System

• Intel Pentium III Processor• 128MB 133MHz SDRAM• 30GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• Creative Labs CDRW• ATX Professional Tower Chassis• 1 Parallel, 2 Serial, 2 USB ports• ATI Xpert 2000 32MB AGP Video Adapter• Yamaha Sound System & 120 WATT Spkrs• Windows '98, Logitech PS/2 Mouse & Keyboard• 56K v.90 Lucent PCI Modem w/Fax & Voicemail

July 2001

DreamTech

• Intel Pentium III Processor• 256MB 133MHz SDRAM• 40GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• 50X CD-ROM• 1 Parallel, 2 Serial, USB & PS/2 Port• ATI Xpert 2000 32MB AGP Video Adapter• Sound System & 120 WATT Speakers• Windows '98, Logitech PS/2 Mouse & Keyboard• 56K v.90 Lucent PCI Modem w/Fax & Voicemail• ATX Professional Tower Chassis

$649 $669 $699 $719

!"#

$819 $839 $859 $879

Dream Netstation THIS POPULAR CONFIGURATION IS PROVENRELIABLE & VERSATILE! NOW WITH 40GB HD,32MB SVGA, 17” MONITOR & MORE !

19” MONITOR, DVD & CDRW, 60GB HD, 64MBVIDEO & 520 WATT SPEAKERS WITH SUBWOOFERMAKE THIS THE ULTIMATE ENTERTAINMENT SYSTEM!

$269 $299 $329 $349 $369

• Intel Pentium III Processor• Configurable Flash BIOS & APM• 256K L2 Cache• Supports RAM up to 1GB• 1.44MB 3.5" Floppy Disk Drive• UDMA 100 4HD & 2FD controller• 5 32-bit PCI, 1 ISA, & 1 4X AGP slot• 2 Serial, 1 Parallel, 2 USB & PS/2 port• Professional ATX Tower Case• 250 WATT ATX Power Supply• 104-Key PS/2 keyboard• Integrated Audio

!#DesignerDreams

AddMicrosoft Office

Professionalfor only $269

$1599 $1619 $1699 $1799

"#$%& '(')$('$'#"

Dream Generation 4

Call for a quoteon your

Dream Computer

WITH CASE, POWER SUPPLY, MB, CPU, FD & KB.A SOLID FOUNDATION FOR YOUR DREAM COMPUTER.

!##

!

$699 $719 $739 $759

Dream XSRW CREATE AUDIO & DATA CDs WITH EASE!CREATIVE LABS CDRW & 30GB HD DELIVERSHIGH PERFORMANCE ON A BUDGET.

Add an HP DeskJet 840Ccolor printer

for only $109

!#!##

WITH 256MB RAM, 40GB HARD DRIVE,32MB VGA & 50X CDROM.A POWERFUL SYSTEM WITHOUTUNNECESSARY EXTRAS. PERFECT FORTODAYS DEMANDING APPLICATIONS.

$559 $579 $599 $619

Starting

at

Add WIndowsinstalled & tested

(with CD & manual),premier support,

& Logitech mouse

"# $

%!

Dream XS2000

PowerDesigner+

$ 949 $ 969 $1039 $1169

Dream Producer 4

$1159 $1199 $1259 $1399

!#

PRODUCE, COMPILE & BURN! A COMPLETE P4WORKSTATION WITH 17” MONITOR, 40GB HD & CDRW.

• Intel Pentium 4 Processor• 128MB PC800 RAMBUS• 40GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• 50X CD-ROM• 1 Parallel, 2 Serial, 2 USB ports• 32MB AGP Video Adapter• P4 Mid Tower Chassis & 300W PS• Windows 2000, Logitech PS/2 Mouse & Keyboard• Netgear 10/100 PCI Ethernet Card

!#"#

EXPERIENCE THE NEXT GENERATION OF HIGH-PERFORMANCE DREAM COMPUTERS BUILT WITH INTEL’S PENTIUM 4 PROCESSOR.APPLICATIONS RUN FASTER, VIDEO AND AUDIO PLAY BACK WITH GREATER FIDELITY, AND EMERGING BUSINESS TOOLS RUN SMOOTHER.THE PENTIUM 4 PROCESSOR FEATURES A 400MHZ SYSTEM BUS THAT TRANSFERS DATA IN AND OUT OF THE PROCESSOR AS MUCH ASFOUR TIMES FASTER THAN TODAY’S PENTIUM III PROCESSOR, QUALIFYING AS A POWERFUL MULTI-TASKING BUSINESS ENGINE.

"#

&

%!!

'! Dream Concept 4

RELIABLE, POWERFUL WORKSTATION ATAN UNBELIEVABLY LOW PRICE. WITH 40GBHD & 32MB VIDEO CARD!

NETWORK-READY WITH WINDOWS2000 PROFESSIONAL & NETWORKADAPTER FOR UNBEATABLEBROADBAND PERFORMANCE.

• Intel Pentium 4 Processor• 128MB PC800 RAMBUS• 40GB UDMA Hard Drive• 3.5" 1.44MB Floppy Drive• 50X CD-ROM• P4 Mid Tower & 300W PS• 1 Parallel, 2 Serial, 2 USB ports• 32MB AGP Video Adapter

NEW PENTIUM 4 POWERDESIGNER WITH128MB RAM, 40GB HARD DRIVE, 32MB VGA &50X CDROM. BUILD YOUR DREAM ON THEPOWER OF INTEL’S PENTIUM 4 PROCESSOR.

$779 $799 $859 $999

PowerDesigner 4

* OPTIONALINDUSTRIAL CASE

DISPLAYED

‘98 add $139ME add $149

2000 add $169

Page 29: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 27

All information input after themagnetic stripe is read is recorded inthe external serial EEPROM. If theinformation stored there overflows,the new data will overwrite the olddata in the first in, first out format.To prevent system lockup or programrun away, the watchdog timer shouldbe enabled. A parallel port of the PCinterfaces with the serial EEPROM ofthe X25650 to retrieve all recordedinformation for emergency or securitycheckout purposes.

You can download a figure showingthe system control. If you’re in themarket for a new keyless entry sys-tem, try this application. It workswell and is inexpensive. I

Steve Hsiung is an associate professorat Utah State University. Prior toteaching, he worked for MaximIntegrated Products, Inc. You mayreach him at [email protected].

SOFTWARECode and other examples are avail-able on Circuit Cellar’s web site.

SOURCESMT-211Mag-Tek Inc.(800) 788-6835(310) 631-8602Fax: (310) 631-3956www.magtek.com

MC68HC11, ’145407, ’68HC68T1,PCBUG11Motorola, Inc.(847) 576-5000Fax: (847) 576-5372www.motorola.com

X25650Xicor Inc.(408) 432-8888Fax: (408) 432-0640www.xicor.com

<Start Sentinel = %><Format Code><Primary Account Number><Field Separator = ^><Country Code><Name = 26 AlphanumericCharacters><Field Separator = ^>….<End Sentinel = ?>

LDAA AddressJSR XFER_SPILDAA ByteJSR XFER_SPILDAA AddressJSR XFER_SPILDAA #$FFJSR XFER_SPISTAA Memory

INIT_SPIPSHXLDX #$1000BSET DDRD,X %00111000 ;SS, SCK, & MOSI outputLDAA #%01010100 ;Enable SPI, master mode, bit

rate 1MHz, CPOL=0, CPHA=1STAA SPCR,XBSET PORTB,X %00001000 ;Activate SPI interfacePULXRTS

XFER_SPIPSHXLDX #$1000 ;Set register baseSTAA SPDR,X ;Write to SPI port

WAIT BRCLR SPSR,X $80 WAIT ;Wait till SPI transfer complete flag (SPIF) set

LDAA SPDR,X ;Read back SPI port, also serve as dummyto clear SPIF

; flagPULX

Listing 3—The first four lines are used to write to the SPI port by simply loading the data in ACC, and thencalling XFER_SPI. The next four lines are used to read the SPI port by loading dummy data $FF in ACC, andthen calling XFER_SPI again. INIT_SPI initializes the SPI port and needs to be done only once.

Listing 4—Track 1 has this serial data format.

ALL

ELECT R ONICSC O R P O R A T I O N

1-800-826-5432ORDER TOLL FREE

SHOP OUR ONLINE STOREwww.allelectronics.com

CHARGE ORDERS to Visa, Mastercard, American Express or Discover

TERMS: NO MINIMUM ORDER. Shipping and handling for the48 continental U.S.A. $5.00 per order. All others including AK,HI, PR or Canada must pay full shipping. All orders deliveredin CALIFORNIA must include local state sales tax. Quantities

Limited. NO COD. Prices subject to change without notice.

MAIL ORDERS TO:ALL ELECTRONICS

CORPORATIONP.O. Box 567

Van Nuys, CA 91408FAX (818)781-2653

e-mail [email protected]

CALL, WRITE

FAX or E-MAIL

for our FREE96 Page

CATALOGOutside the U.S.A.

send $3.00 postage.

Miniature DC MotorMabuchi # FF-N20PNMiniature 1.5 to 3 Volt DC motor. Ideal for modelsand radio control applications where small size is important. No load rating: 15,800 RPM @ 2.4 V, 96 mA.Length (excluding shaft), 0.654” long x 0.47” x0.39”. 0.039”(1mm) dia. x 0.13” long shaft.Solder-loop terminals. Large quantity available. CAT# DCM-166 150 for 60¢ ea.

600 for 50¢ ea.1500 pieces 35¢ ea.for $1502

Solar PanelOutput: approx.3 Volts @ 40 mA. 2.40” square x 0.13”thick epoxy-encapsulated silicon photovoltaic panel removed from solarlighting system. Solid, almost -unbreakablemodule with easy-to-solder spots on backside.Ideal for solar-powered battery chargers and other projects.CAT # SPL-60

$350each

Two Speed Worm Gear Motor

Powerful windshield wiper motor for 2000-2001 Saturn Lseries automobiles. Two speeds; high speed is 106 RPM at 12 Vdc, 4 Amps. Low speed is 41 RPM at 12 Vdc, 0.91 Amps. 3/8" threadeddrive shaft with nut. A 2.25" lever with a univer-sal joint, attached to the shaft, is easily remov-able. 7" overall length x 3.5" x 4". CAT # DCM-171 $1975

each

Rechargeable Battery

$350each

Eveready # NH22. Nickel Metal Hydride rechargeable battery. Replaces 9 Volt batteries in manyapplications. Actual voltage 7.2 Volts. Can be charged in most Nickel-cadmium chargers. CAT# NMH-9

Page 30: cc_2001_07-132

28 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

here came atime when I need-

ed to be able to trans-fer large amounts of data

from my Windows98-based PC, whereI was compiling code into an embed-ded target device based on the PC/104platform running good-old DOS. I fig-ured I had three basic alternatives.

The first alternative was to use aparallel port. Although fast enough formy needs, I didn’t want deal with thebulk of wires necessary to take fulladvantage of the port’s speed. Theport also has a distance limitation ofabout 10′, but this was not a decidingfactor. This port was available on myPC/104 stack and Windows PC.

The next choice was a serial port.This method, in its simplest configu-ration, is a three-wire solution andtherefore solves the problem with theparallel port choice, but it is too slow.This port was also available on myPC/104 stack and Windows PC.

The third choice was USB, which isfast (about 1 MBps on the USB 1.1version), but has a complex protocoland requires special drivers on the PC.On the other hand, the cable from thedevice to the PC is only four wires.Although available on my PC, thisport wasn’t on my PC/104 stack.

FEATUREARTICLE

Before transferringlarge amounts ofdata, you often facedifficult choices. But,the answer was obvi-ous to Jeff. He dis-covered that USBconnectivity doesn’thave to be a diretask, not when youfind the right part andthe right company toset the course.

And so I was faced with a choice.Although I had worked with the hard-ware and software means of transfer-ring information using both paralleland serial port systems, they eachrated a seven on my score card. USBwould be great, but rated a negativenumber as a result of USB hardwareand software protocols and Windowsdrivers required (all of which I had lit-tle knowledge and no experience).

That was until I came across a com-pany called Future TechnologyDevices International (FTDI) and theFT8U245AM USB chip. FTDI is basedin England and its products are dis-tributed in the U.S. by Saelig. Thechip handles the USB protocol, elec-trical issues, and leaves you with anice 8-bit wide (i.e., 74xx245 chips)port with transmit and receive FIFOsand associated status lines. FTDI alsosolved the problem of Windows driv-ers by providing special ones thatmake its chip look like a standardCOM port to the Windows OS (datarate settings are ignored, communica-tions are as fast as the USB allows).

It looked like USB might go from anegative rating to a full 10! Afterglancing at the web site, it looked asif you could add parts for the onboardoscillator, resistors and capacitors,and the FT8U245AM, and get a com-plete USB interface. If you want touse more than one FTDI part on thesame USB bus, simply add a 93C46serial EPROM (and more resistors) tothe design, and have Windows98 pro-gram the EPROM through the USBwith a supplied driver. As I men-tioned earlier, my design was to be forthe PC/104 bus (see Photo 1), so Iwould need to add address decodelogic for that side as well.

I started my quest for developingmy own USB-to-PC/104 adapter bydownloading and looking at thedatasheets and schematics on FTDI’sweb site. The information wasstraightforward. If you visit the site,be sure to download all the pertinentdocumentation including datasheets,app notes, and schematics. The appnotes provide insight into why thingsare done a certain way, so be sure tolook at them. I’ve broken the projectdown into five main issues.

Jeff PollardRobert Lacoste

USB, FTDI Style

t

Page 31: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 29

USB SIDE HARDWARE The chip is encased in a 32-pin thin

quad flat package (TQFP) and operateson 5 V. With a fine-tipped solderingiron, a steady hand, and plenty oflight, this chip is easily soldered ontoa PCB. With only 32 pins, the job isn’ttedious. The chip has eight pins perside, so there are three ways to mountit wrong. (Check twice, solder once!)

The necessary power to drive theUSB chip (VCC, AVCC, Gnd, and AVGND)and other chips on the PCB can betaken straight from the USB port orexternally supplied. If you choose anexternal source, be sure not to tie theUSB 5 V to the external source. Thepower from the built-in 3.3-V (3V3OUT)LDO regulator (drives the USBbuffers), the 5-V digital, and 5-V ana-

log supplies should be decoupled well.The amount of power you can drawfrom the USB is limited. Visit theUSB site (www.usb.org/developers) toget more information.

No level shifters and associatedvoltages are needed to connect to theUSB (USBDP and USBDM). A coupleof impedance matching resistors andpull-up/down resistors are all that’sneeded to get from the chip to theUSB connector.

The onboard oscillator (i.e., XIN andXOUT), originally designed to run witha 6-MHz crystal, but later specified torun at 48 MHz, is in a typical parallelresonance configuration, with an LCtank appended to the XOUT pin toensure proper startup at 48 MHz. Thiswas the first time I had to add an LC

tank to a chip with an onboard oscil-lator, but adding two caps and a smallinductor was no big deal.

I chose to drive the reset (*RESET)pin by inverting the RESETDRV sig-nal from the PC/104 bus. I later addedthe ability to choose reset usingMicrochip’s TCM809 reset chip if thedevice was to be used in a stand-aloneconfiguration (see Figure 1). FTDI’soriginal schematic used a simple RCreset (FTDI later found this solutioninadequate in some situations).

The serial EPROM interface con-sists of three lines: chip select, clock,and data (EECS, EESK, and EEDATA).The EPROM, Microchip’s 93C46, isneeded if you want to use more thanone FTDI device on the USB. Atpowerup, the FT8U245AM looks to

Figure 1—The schematic shows how simple it is to integrate the FTDI chip into a system, including this PC/104 design. The FT8U245AM, EEPROM, decoding logic, and ahandful of passives are all it takes.

Page 32: cc_2001_07-132

30 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

the serial EPROM for vendor identifi-cation (VID), product identification(PID), manufacturer strings, and serialnumber information. If it doesn’t findvalid information in the EPROM (or ifthe EPROM is missing), it uses adefault setting. So, two devices withoutEPROMs will default and look like thesame device to USB drivers on the PC.The EPROM data is read through asingle I/O pin so the EPROM’s DIN

and DOUT pins are connected througha 2.2-kΩ resistor. I didn’t use the pins(*EEREQ and *EEGNT) that allow theEPROM contents to be accessedthrough the data bus.

The processor interface has eightbidirectional data pins (D0–D7), twostatus lines (*TXE and *RXF), andtwo control lines (WR and *RD). Thedata lines allow access to the 384-bytetransmit FIFO and 128-byte receiveFIFO. By pulling *RD low, the proces-sor can read the current data bytefrom the receive buffer. As the linegoes high, the next byte in the FIFO(if any) is advanced for future reading.Data is strobed into the transmit FIFOon the falling edge of an active highdata strobe of WR. When low, the*TXE line indicates that the transmitbuffer can be written to.

Usually *TXE means that the trans-mit buffer is empty, but in this case itmeans there is room in the buffer.When the *RXF line is low, it signalsthat data is available in the receivebuffer. Similarly, *RXF normally indi-cates that the receive buffer is full,but here it means data is available.

I designed a PC/104-compatiblePCB to mount the parts on, and aftersoldering the resistors, capacitors, andFTDI chips necessary to get the USBworking (no PC/104 parts at thispoint), I hot-plugged it into my PC.Windows98 detected the board imme-diately and I was witness to a miracle,there were no hardware problems!Not finding any drivers present forthe new USB board, Windows startedthe USB installation procedure.

USB SIDE SOFTWARE A hardware or embedded software

person might balk at the prospect ofhaving to deal with the Windowsdrivers necessary to complete a USB

link. Again, FTDI has made the issueeasy by providing all of the necessarydrivers. Like I said, these driversmake the FTDI USB chip appear likea regular COM port. I had previouslycopied the drivers supplied by FTDIto my hard disk, and after tellingWindows in which directory to findthem, the installation was seamless.No shutdown and reboot required.When it was done initializing, I wasable to go to the Windows ControlPanel, System, Device Manager, Ports(COM and LPT), and see USB serialport (COM4) in the listing. I was con-nected. Then, most of the complicat-ed parts of the job were done, and all Ihad left to do was make a few simpleconnections to the PC/104.

PC/104 SIDE HARDWARE The PC/104 bus (J1 label PC64BUS)

is simple to work with. Because it isreally a version of the old ISA bus,data rates and signal transitions areslow by today’s standards, and easy towork with. Being an 8-bit chip, theFT8U245AM didn’t require the fullPC/104 16-bit bus, so I designed forthe 64-pin connector only. SD0–SD7on the PC/104 connect directly toD0–D7 on the FT8U245AM.

I wanted to be able to relocate theUSB device anywhere in the ISA I/Ospace, so I used a 74HCT688 magni-tude comparator along with the AENline as an active low enable to decodeaddress lines A1 through A9 for aselect signal. This was fed into a PALalong with address line A0 and *IORand *IOW to further select the FTDIstatus lines and data ports.

In a straightforward manner, theaforementioned lines are used to gen-erate the *RD and WR signals for theFT8U245AM. The status lines fromthe FT8U245AM, *TXE and *RXF, arebuffered through the PAL to create astatus port and are read as data on thePC/104 data lines D0 and D1. Thus,the main processor can poll the statusof the chip.

Both status lines are also combinedto generate the interrupt IRQ line forthe PC/104 bus. In most cases, the PCwill want to know when a characterhas been received, so the *RXF line isnot qualified in the PAL. If you want

no interrupt from the USB-PC/104board, you must set the PC’s 8259mask register appropriately. However,it isn’t necessary to always get aninterrupt to declare that the transmitbuffer has space available, so this linehas been qualified in the PAL.

To allow interrupts from the *TXEline, a logic 1 is written to the statusport on D0 and to disable them, alogic 0 is written. Use header JP1 toselect IRQ 3, 4, 5, 6, 7, or 9. Gettingthe equations right for the IRQ lineand the programmable masking tooka couple of tries, but otherwise it wasrelatively easy. When this was fin-ished, there was only one main issueleft…software.

PC/104 SIDE SOFTWARE This is where most of your time

could be spent depending on therequired application. All that is neces-sary to get a simple communicationsterminal running through the USB isa small program running on thePC/104 side and a COM program run-ning on the Windows side. ThePC/104 side could poll the statuslines of the FT8U245AM chip, get anyavailable character from the receivebuffer, and display it on the screen. Itwould also get any character you typewith the keyboard and put it in theFT8U245AM transmit buffer. Thesource code available on the CircuitCellar web site goes a little furtherand adds interrupt capabilities andtransmit and receive data queues.

One note to anyone writing yourown code with interrupt capabilities,be sure to clear any characters in thereceive buffer before enabling theinterrupts. From the basic code pro-vided, you could branch off to developmany different methods of through-put. The final software design woulddepend on the type of informationbeing transferred. For example, differ-ent protocols could be used: Xmodem,Zmodem, or Kermit. For more exten-sive and interactive designs, youcould write a program for theWindows side in Visual Basic to openthe USB-COM port and exchangeinformation with the PC/104-USB ina proprietary manner as long as bothsides follow the same protocol.

Page 33: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 31

SOFTWAREThe code for this project is avail-able on the Circuit Cellar web site.

STAND-ALONE SYSTEMI decided to add a port for the stand-

alone system after I had finished theoriginal PC/104 design. This port isjust an extension of most of the linescoming from and going to theFT8U245AM. The 16-pin connector(Header J3) allows access to the con-trol and data lines of the USB chip. Amicroprocessor development systemport similar to what’s on PIC orScenix development boards is easilyconnected. In the standalone case, thePAL (U2) and 74HCT688 (U9) shouldbe removed, and *RESET selected tocome from the Microchip reset device(JP3). Power may come from eitherthe USB port (installing JP2) or themicroprocessor development system.

Remember, the serial EPROM isnot required if only one FT8U245AMdevice is attached to the local USBbus. Running a Windows programsupplied by FTDI, the EPROM getsproperly initialized and programmedwith the correct PID, VID, manufac-turer strings, and serial number infor-mation. The serial number is generat-ed on the fly using time and dateinformation. The EPROM is cheap,easy to program, and differentiatesdifferent USB devices, therefore itshould be considered for all designs.

FINAL ANALYSISThe FT8U245AM is easier to use

than serial and parallel ports, and as aWindows Drivers novice, I was satis-fied with the ease of installing andusing the supplied Windows drivers.

Jeff graduated with a BS in ComputerScience from California StateUniversity, Northridge. He has beenworking with digital systems designfor almost 20 years. His main focus isembedded systems (industrial con-trols), including both hardware andsoftware design and development.

According to the FTDI web site, driv-ers for the following platforms arealso available: Windows ME,Windows 2000, iMAC, and Linux. Irecommend this chip if you need ageneric way to gain USB connectivity.

An assembled version of the USBPC/104 board (with stand-alone port)costs $60. A double-shielded USB-A-to-molex cable is included. ContactJeff at [email protected] or visitwww.xylotex.com for more informa-tion. Also, saelig.com offers FTDI’sdemo board for the FT8U245AM for$85. FTDI’s board is not what’sdescribed in this article. It just goes toshow that if the right company comesalong to point you in the right direc-tion, whether or not you have theexperience is irrelevant. I

SOURCESFT8U245AMFuture Technology DevicesInternational (Saelig Co, Inc., dis-tributor)(716) 425-3753www.ftdi.co.uk, www.saelig.com

TCM809, 93C46Microchip Technology Inc.(480) 792-7200www.microchip.com

74HCT688Philips Semiconductors(212) 536-0500www.philipslogic.com

Photo 1—The working prototype PC/104 USB boardonly works as the top board in a 16-bit system as aresult of my ill-conceived placement of the stand-aloneand IRQ headers.

RESOURCESPC/104 Embedded PC Moduleswww.pc104.org

USB Implementers Forum, Inc.(503) 296-9892www.usb.org/developers

Page 34: cc_2001_07-132

32 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

ltrasonic dis-tance measurement

is not a new technolo-gy, and its principles are

well-known: transmit a short ultra-sonic pulse, wait for the reception ofan echo, and measure the time to getit. Divide this time by the speed ofsound in air (roughly 340 mps) and bytwo (to target and back) and you getthe distance. The theory is simple.

But how do you use this principleto get a three-dimensional image of agiven scene in order, for example, todrive a robot in a complex environ-ment? What could such a captor “see”in our real world? Is it possible tobuild such a device with low-costparts? I pondered these questions for along time, and then finally decided totransform these ideas into an experi-mental prototype. The SCAN 3-Dproject was born (see Photo 1)!

In order to be able to reuse it after Ibore of 3-D images, the SCAN 3-Dneeded to be usable in two differentconfigurations, as stand-alone andconnected. As a stand-alone device,SCAN 3-D is a general-purpose ultra-sonic telemeter with an onboard LCDto display the distance to the firstecho. A set of four push buttonsallows you to memorize distances and

calculate sums of distances and evensurfaces (useful when visiting a possi-ble new house). And, if connected to aPC through a serial link, SCAN 3-Dbecomes a 3-D telemeter. The PC actsas a master, scanning a defined regionand constructing the correspondingvirtual 3-D image.

MECHANICS…The mechanics are not the easiest

part of a project like this one, espe-cially for guys trained to write soft-ware rather than use caliper rules andfiles. The scanning head is built usingtwo standard RC servomotors. Thesemotors are inexpensive, provide excel-lent precision, and are blazing fast.Moreover, they can be interfaced to amicrocontroller with only a TTL-compatible PWM signal. The first ser-vomotor (vertical scanning) is fixed onthe enclosing box, the second (hori-zontal scanning) is directly glued onthe axle of the first.

I decided to use standard ultrasonictransceivers (MA40B8S/B8R, oftenused in ultrasonic remote controls). Iput them in a small plastic tube tomaximize their directional selectivity.These tubes should be long enoughfor improved selectivity yet smallenough for long distance detection.

I ended with a 1-cm compromise,which gives a 4- to 5-m maximumdetection distance but a limited angu-lar resolution (I evaluated it at 5° to10°). As usual with ultrasonic trans-ceivers, take great care to fix thetransceivers; in particular, ultrasonicpulses mechanically transferred

FEATUREARTICLE

It’s a simple theoryand isn’t new, in fact,working with 3-Dtechnology is old hat.But, with an innova-tive approach, Robertdetermined a uniqueway to use 3-D. And,you too can build thisclever project. After-ward, you may look atthe world in a wholenew way.

Robert Lacoste

A New ViewAn Award-Winning 3-D TelemeterProject

u

Photo 1—Two servomotors allow you to rotate theultrasonic transducers in two directions. And, a mini-malist user interface makes it possible to use SCAN3-D as a stand-alone device.

Page 35: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 33

between them should be minimizedusing isolation materials. On the pro-totype, I used some elastic rubber totrap the transceivers in the tubes.

…AND ELECTRONICSNow it’s time to build some elec-

tronics to control the SCAN 3-D. Ofcourse, you build with a microcon-troller. However, in order to reuse theultrasonic distance measurement sub-system from design to design, I off-loaded a large part of the time-criticalfunctions to an external EPLD, eventhough the microcontroller can han-dle everything directly.

Figure 1 shows the final productwired on a small homemade PCB (seePhoto 2). The circuit can be dividedinto five sections, the power supply,microcontroller, transmitter, receiver,and EPLD.

SCAN 3-D can be powered by a 9-Vbattery or DC power supply. The DCsupply is regulated to 9.4 V through a78L08 and is biased to 9.4 V with anLED on the ground line. The 9.4 V ismerged with the battery outputthrough a pair of 1N4001 diodes, andis used directly for the transmittersection. A 7805 gives a clean 5 V forthe rest of the circuit.

I used a National SemiconductorCOP8 series microcontroller,COP87L88GGN. [1] The COP isclocked by an external 8-MHz oscilla-

tor, which also is used by the EPLDsection. It is directly connected to a2 × 16 character LCD and three pushbuttons (enter, add, and multiply).The TDX/RDX UART lines are dedi-cated to the PC serial link via anexternal MAX232 converter (builtinto the serial cable). T2A and T3Atimer outputs drive the servomotors,and three lines (START, ONGOING,ECHOFILT) link the microcontrollerto the EPLD section.

The transmitter section is very sim-ple. The ultrasonic burst (16 periodsat 40 kHz) is generated by the ELPDas soon as ordered by the microcon-troller. A push-pull discrete amplifierbuilt around T1 to T6 amplifies theseTTL signals up to an 18-V peak-to-peak signal to get a maximum trans-mission level from the 9-V power sup-ply. This signal directly drives theMA40B8 transmitter (see Figure 2).

The receiver section is the trickiestpart. Because the level of an echoreceived by the receiver is significant-ly smaller for a long distance echothan for a close one, a classic designmust find a compromise betweenfalse short-distance echoes and maxi-mum detection distance. Otherwise,the result is poor performance.

I used a trick I first read about in anarticle written by Steve Ciarcia(thanks!). [2] The gain of the receptionchain is progressively increased (witha log scale) while waiting for progres-sively long distance echoes. Thissetup allows for maximizing both per-formances! To do that, I used a digitalpotentiometer (DS1666) to control thegain of the reception chain driven bythe EPLD. This chip is a 128-tapspotentiometer controlled by a clocksignal and an up/down input.

The amplifier is built around a cou-ple of TS925, low-noise, rail-to-railamplifiers, the last one used as a com-parator. The result is satisfactory (seeFigure 3). I managed a maximumdetection distance of up to 5 m duringgood conditions, and didn’t miss anyecho up to 3 m.

As stated earlier, I used an EPLD (aLattice ISPLSI1016) to manage allreal-time and timing issues, exceptthe time measurement done directlyby the COP (see Figure 4). This EPLD

does many things. It generates theultrasonic burst as soon as the STARTline is asserted by the microcon-troller. The EPLD also inhibits recep-tion of an echo during a 1.5-ms win-dow after the transmit pulse in orderto filter direct cross talk between thetransmitter and receiver.

It progressively increments the gainof the reception chain while waiting

Photo 2—The SCAN 3-D prototype was built on asmall double-sided PCB. The COP is under the LCD.A header near the EPLD allows in-circuit program-ming, a useful provision during the test phase.

Photo 3—The onboard user interface shows a detect-ed echo at 4.7 m. The three blue push buttons allowlocal arithmetic operations, with the top two values onthe stack displayed on the bottom line of the LCD.

b)

a)

Photo 4a—This example shows three main obstacles,a book, the black box, and a small clock. The distanceof the objects is 30 cm to 3 m. (b) shows the visionthrough SCAN 3-D. The clock, a reflective object, pro-duces a red spot at the bottom, far larger than theobject itself because of diffraction. The book producesthe yellow spot, and the black box gives the lightgreen spot at the extreme left. The larger green/bluespot is the background wall (depicted as a circle,because only portions perpendicular to the transceiverreflect an echo well).

Page 36: cc_2001_07-132
Page 37: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 35

Figure 1—The four sections of the SCAN 3-D can be clearly identified as the power supply, microcontroller and its peripherals, EPLD glue, and transmitter and receiver driv-ers.

Page 38: cc_2001_07-132

36 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

for long distance echoes, sending puls-es to the DS1666 digital potentiome-ter. The EPLD filters and signalsreception of the first echo(ECHOFILT). And, it resets the gain toits minimal value (with a set of quickrewind pulses to the DS1666), waitsfor a 30-ms security period to elimi-nate double echoes, and signals theend of the measurement to the micro-controller (ONGOING back to 0).

WHY A COP8 MICROCON-TROLLER?

The major constraint for this proj-ect was the need for a microcontrollerfully loaded with onboard timers.More specifically, I needed one timerthat can be configured in PulseMeasurement mode to get a precisetime-to-echo measurement independ-ently from other CPU activities andtwo timers that can be configured inPWM Generation mode to drive thetwo servo-motors. I also needed a seri-al port to the PC. Low power con-sumption (SCAN 3-D can be battery-powered) and low cost were essential.

Not many microcontrollers on themarket satisfy all of these require-ments, but National Semiconductor’sCOP87L88GGN fit the list exactly. Itisn’t a usual chip for hobbyists, butthe COP8 series is indeed a classic 8-bit choice particularly in automotiveapplications. The COP87L88GGNincludes 512 bytes of RAM, 16 KB of

OTP ROM, along with a full-duplexUART, three 16-bits timers, wake-upinterrupts, on-chip watchdog, twoanalog comparators, and full staticCMOS design.

Moreover, National Semiconductoroffers an inexpensive programmer andin-circuit simulator (IceMaster EPU).With this EPU, the code execution issimulated on a PC, so it’s far fromreal-time emulation (around 20 KHzequivalent CPU speed), but the I/O isredirected on the target board. That’sbetter than a simple software simula-tor and cheaper than a real ICE. Solet’s go with it!

EMBEDDED SOFTWAREThe software embedded in the

COP8 microcontroller was written inassembler and is available on CircuitCellar’s web site (scan3-D.asm). It usesapproximately 1.5 KB of the onboardEPROM memory. After initialization,a main loop is executed with the fol-lowing main steps:

• Check if an “I” is received on theUART interface

• If so, enter Remote Control mode. Ifnot, get the echo distance, managethe user keys, and update the dis-play

• Loop

In Local mode, a simple local userinterface is implemented with theLCD and three push buttons acting asenter, add, and multiply (see Photo 3).The software emulates a reversePolish calculator and enables quickcalculations of sums of distances andarea calculations.

In Remote Control mode, a simpleprotocol allows the host (a PC or mas-ter microcontroller) to orient thetransceivers and measure a distance(see Table 1). Three measurementmodes are supported, a single burst,repeated burst up to the reception ofan echo, and an arithmetic average offour successive measurements toimprove the precision.

A large part of the software consistsof utility routines like UART manage-ment, LCD screen management, andfixed-point number crunching, andcan be reused for other applications.

PC-BASED SOFTWAREIn order to control and drive the

SCAN 3-D module, I developed theaccompanying PC side software. This

Host SCAN 3-D Comment

I Switch to Remote modeSCAN 3-D V1.0 Confirm Remote mode

Hxx Define horizontal positionVxx Define vertical positionM Get a distance measurement

nn.nnM Return measured distanceR Get a distance with retry

nn.nnM Return measured distanceA Get an average distance

nn.nnM Return measured distanceL Go back to Local mode

Table 1—An ASCII-based protocol is implemented between the host PC and SCAN 3-D microcontroller. TheSCAN 3-D switches to Remote mode when it receives an “I,” and goes back to Local mode when it gets an “L.”

Figure 2—The first two traces are the outputs of theEPLD. The last trace is the signal between the twopins of the transmitter. The transmit pulse is 16 peri-ods, 40 kHz, and amplified to a 17.4-VPP signal. Theultrasonic transmitter and coupling capacitor generateoscillations after the sixteenth pulse.

Figure 3—The receiver section demonstrates why aprogressive gain is needed. The first trace is the trans-mit pulse, the second is the received signal withoutamplification, the third is after progressive amplifica-tion, and the last one is the detected echoes (output ofthe comparator). In this case, even if a strong signalwas present 1 to 2 ms after transmission, the realecho is the one 11 ms after transmission. This isimpossible to detect without a different gain over time.

Page 39: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 37

Windows-compatible software, devel-oped with Bill’s Visual C++ and MFCframework, allows you to define thehorizontal and vertical scan range anddrive the SCAN 3-D module throughthe COM2 serial port.

It then displays the corresponding3-D image in false colors, the hottestcolors indicating the closest distances.The color scale can be dynamicallychanged in order to optimize the dis-play depending on the scene.

SCAN 3-D AT WORKEnough theory, let’s look at what

SCAN 3-D can do!As shown in Photo 4, the direction-

al resolution that the ultrasonic beamis around is important (5°–10° depend-ing on distance), so every obstacle isenlarged and rounded to the sameangle. Nevertheless, the resultingimage clearly allows detection ofobstacles and possibly helps you finda way between the two obstacles.

You should note that ultrasonicdetection doesn’t detect all objects.Some exceptions are absorbing mate-rials that don’t give echo and reflec-tive surfaces with large angles of inci-dence (the echo isn’t reflected in thedirection of the receiver).

Author’s note: This project won thesecond international prize of theCOP8 contest organized in 1999 byNational Semiconductor and Elektor.

Robert Lacoste lives near Paris,France. He has 10 years of experiencein real-time software, embedded sys-tem developments, and projects andoperations management. He stillloves building innovative microcon-

This is why ultrasonic detection isoften used in conjunction with otherkinds of captures (like cameras), toconstruct a coherent and completerepresentation of the environment bymerging the information coming fromthe different sensors, a task usuallycalled “multi-sensorial fusion”… andnot an easy one!

Regarding acquisition time, well, itdepends on the resolution yourequire. The motor speed is never thelimiting factor, but each pixel needs38 ms to capture the required timebetween each ultrasonic pulse to pre-vent crossovers between measure-ments (i.e., the pulse of a previousshot being received after transmissionof the next one). For a low-resolutionpicture (say 10 × 10 pixels), that trans-lates to around 10 s with overheads.But for a high-resolution picture likePhoto 4, be prepared to wait for agood 5 min.

WRAP UPThe SCAN 3-D is an interesting

piece of equipment. It gives a some-times surprising vision of the world,but understandable when you keep inmind the physics of ultrasonic waves.Designing and testing this device wasa pleasure, mainly thanks to the gooddevelopment tools supplied byNational Semiconductor and Lattice.

Of course, a project like this one isnever finished. My next goal is to useit on a robotic platform. For example,a second microcontroller may act as amaster and control the SCAN 3-D. Inorder to quickly detect an obstacle,only the horizontal servo would beused (distance scanning on a horizon-tal line), and complete pictures can betaken from time to time. Well, that’swork for the next couple of years! I

Figure 4—The first trace of the EPLD is the ONGO-ING signal, which is active for 38 ms. The secondtrace is the inhibition signal, which blocks reception for1.5 ms after transmission. The third trace is theECHOFILT signal. In this case, the first echo wasreceived 10 ms after transmission, giving a distance of0.036 × 340/2 = 1.7 m. UP/DOWN is the last signalshown, driving the DS1666 potentiometer. This signalis up during the reception phase, but switches to 0 toreset the DS1666 to its minimal value just before fin-ishing the cycle. During this time, the EPLD switchesthe DS1666 clock from 4 to 500 kHz.

SOURCESDS1666Dallas Semiconductor, Inc.(972) 371-4000Fax: (972) 371-3715www.dalsemi.com

EPLD ISPLSI1016 and toolsLattice Semiconductor Corp.(503) 268-8000Fax: (503) 268-8037www.latticesemi.com

MAX232Maxim Integrated Products, Inc.(408) 737-7600(800) 998-8800Fax: (408) 737-7194www.maxim-ic.com

MA40B8S, MA40B8R Murata Manufacturing Co., Ltd. (770) 436-1300Fax: (770) 436-3030www.murata.com

COP87L88GGNational Semiconductor Corp.(408) 721-5000 www.national.com

TS925STMicroelectronicswww.st.com

SOFTWAREThe code, EPLD design file, andC++ sources of this software areavailable to download from theCircuit Cellar web site.

REFERENCES[1] National Semiconductor Corp.,

“COP87L88GG: 8-bit One TimeProgrammable (OTP)Microcontroller with UART andThree Multi-Function Timers,”www.national.com/pf/CO/COP87L88GG.

[2] S. Ciarcia, “Home in on theRange! An Ultrasonic RangingSystem Using Polaroid’sDesigner’s Kit,” BYTE, November1980.

troller-based devices after-hours. Heis currently working for NortelNetworks. You can reach him [email protected].

Page 40: cc_2001_07-132

38 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

ccurate, reliableposition sensing is

the backbone of manyclosed-loop control sys-

tems in robotics, automotive, andindustrial process industries, to namea few. In May 1999, I introduced youto the principles behind the popularvariable differential transformer sen-sors, the LVDT (linear variable differ-ential transformer) and its close rela-tive RVDT (rotary variable differentialtransformer), the reigning family ofposition sensors. [1] These deviceshave changed little in their 100-plusyears, so the question is: Are thereany new devices more in line withtoday’s technology that could layclaim to being the next dominant gen-eration of position sensors?

The answer is a qualified yes. Whenit comes to operationin extremely hostileenvironments, suchas the cryogenic tem-peratures encoun-tered in space, or themere –65°C in thearctic and at high fly-ing altitudes, or thehundreds of degreesheat inside engines,it is hard to beat the

FEATUREARTICLE

The rapid pace ofchange in technologyconstantly calls forupgrades and morevariety of products.This month, Georgefocuses on the nextbig thing for positionsensors. So, read onto get the skinny onthe newest develop-ment before it makesit to the mass market.

variable differential transformer. Notmuch can happen to a stationary,wire-wound bobbin, which is all theLVDT is. I’m not aware of any newsensor technology that could success-fully challenge the LVDT’s position inthese extreme environment applica-tions any time soon.

In the friendlier environmentbetween –40°C and 125°C, however,several contenders already exist.Optical encoders, Hall effect, andmagneto-resistance (MR) sensors forexample, have been around for sometime. New developments such aspiezoresistive beam have been intro-duced, but they still have to provetheir capabilities.

LVDT REVISITEDIn this article, I want to introduce

you to another technology, the inte-grated inductive sensor developed bythe Swiss company CSEM. Whatmakes this sensor interesting is thatin principle it is similar to the vari-able differential transformer, with thecoils micro-machined on a chip.Photo 1 shows the sensor with itsdriver and decoder electronics encap-sulated for protection. Photo 2 is amicroscopic detail of the business endof the sensor.

Variable differential transformersand their cousins’ resolvers are robustand, when their output signals aredigitized, can consistently provide 16-bit resolution. But the coil windingsare large and heavy, and the requiredprecision manufacturing is costly.

The size and weight are concernsfor many reasons. In the transporta-tion industry, the long-standingmaxim is that the cheapest way toimprove efficiency and performance isby reducing weight. Lower weight and

George Novacek

Inductive Sensors

a

Sensor chip

Driver Oscillator

Demodulator

Demodulator

Target

Logic

Decoder integrated circuit

PowerSupplyFilter A

Direction4X

Filter B

Figure 1—The CSEM sensor diagram is simple. An oscillator drives the excita-tion coil while the position signal is picked up and decoded by four series-parallelsensor coils.

Page 41: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 39

smaller size make it possible toinstall sensors in previously impossi-ble locations and make their mount-ing less demanding. Their mechanicalcharacteristics, such as response timeand ability to sustain vibrations aregreatly improved. Small size alsoimproves EMI characteristics, bothemission and susceptibility, resultingin reduced shielding requirements andfurther size and weight reduction.[1–5]

On the manufacturing side, unlikethe old-fashioned coil winding, preci-sion, repeatability, and low cost (withhigh volume) are inherent to themicro-machining process, and hardlyachievable by traditional manufactur-ing methods (just as the miniaturesize and weight).

THE WORKSThe CSEM sensor, shown in

Figure 1, is deceptively simple.Packaged on a small PCB, the sensormodule is merely 0.35″ × 1.18″ (9 mm× 30 mm) and weighs approximately0.7 grams (0.025 oz). The sensor,which is encapsulated for protection,consists of two individual siliconchips on a single carrier (see Photos 1and 2).

One chip holds the micro-machined coil assembly with fivecoils and the other holds the interfaceelectronics. An AC current excitesthe large octagonal coil. The excita-tion frequency isn’t externallyadjustable and, therefore, isn’t speci-fied. Judging by the overall operationof the sensor, I estimate it to be in the200- to 500-kHz range. Its purpose isto generate a magnetic field, which isamplitude-modulated by the move-ment of a structured metallic target,

typically a gear or slot. Four sensingcoils are connected in differentialpairs to pick up the modulated fieldand feed the resulting signal to a setof amplifiers and amplitude demodu-lators in the second chip.

Because of the use of differentialsignal pickup and processing, the sen-sor is nearly independent of tempera-ture and target distance shifts. Theamplitude demodulators, followed bylow-pass filters to attenuate the exci-tation frequency remaining in the sig-nal, produce sine and cosine outputsrepresenting the target’s teeth move-ment. The sinusoidal signals aresquared in the following voltage com-parators to generate two trains ofpulses; the pulses are 90° phase shift-ed because of the positioning of thepickup coils. Their duty cycle isaffected by the geometry of the targetteeth, but is usually kept to 50% bythe teeth design. Although the sensordoes not achieve the admirable reso-lution and precision of its variable dif-ferential transformer cousin, it consis-tently delivers a respectable 12 bits,adequate in most applications.

ELECTRICAL INTERFACESThere are several interface modules

available from CSEM; choose basedon the type of signal you need.The functions and processingare simple for a microproces-sor, however you also can useoptimized processing modules.It’s a matter of economics.The cost of development maynot be justifiable for small vol-ume usage.

Figure 2 is a timing diagramof the output from the decoder

shown in Figure 1. Two externalcapacitors set the low-pass filters’critical frequency. Typically a 3-kHzbandwidth is used, but that can beextended up to 40 kHz. Frequency inthis case is determined by the numberof teeth the sensor will see per secondand, obviously, is an engineeringtrade-off. The more teeth, the betterresolution, but speed decreases. Thesensor signals calculate the relativeposition by counting teeth, determinedirection by the quadrature offset ofthe outputs, and measure velocity.The interpolation signal used invelocity measurement is usually fourpulses between teeth, but up to 256pulses are available.

A more complicated interface willenable you to measure absolute posi-tion. Figure 3 shows the timing of thesignals. In this mode, the sensor canbe used in place of a variable differen-tial transformer, digital resolver, orthree-wire analog interface.

In addition to its small size andlight weight, the CSEM sensor isn’t apower hog, as some resolvers and’VDTs are. Working off a standard 5-VDC, TTL-compatible supply, theCSEM sensor draws about 20-mA cur-rent from it. The output in the lowstate can sink up to 1 mA. In the highstate it can source 200 µA while guar-anteeing minimum 2.4-V output.

MECHANICAL INTERFACES The pickup coils need to see mov-

ing teeth or slots to detect motionand determine position and speed.The coils’ geometry is optimized for0.040″ (1 mm) teeth or slot width and1-mm pitch between them. This willprovide a 50% pulse duty cycle. Thesensor does not need to touch the tar-get and will work well with a 0.020″to 0.035″ (0.5 to 0.9 mm) gap.

Photo 1—The sensor module with its driver anddecoder electronics is merely 0.35″ × 1.18″ andweighs approximately 0.7 grams.

Photo 2—This is a microscopic detail of the sensorpart. You can see the large octagonal excitation coil,which is about 0.15″ (3.8 mm) across. The four small-er sensing coils below it are faintly visible.

Channel A (PSA)

Channel B (PSB)

Clock (PCLK)

Direction (PDIR)

Interpolation 4X(PD4X)

Figure 2—The timing diagram of the circuit in Figure 1 providesdigital indication of relative target position.

Page 42: cc_2001_07-132

40 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

As you expect, sensing a wheel’steeth isn’t the only way to use thesensor. You can, for example, use it todetect presence (or absence) of ametallic target or movement of a slotinto a predetermined position. In suchapplications, the CSEM sensor would-n’t be much different from proximitysensors. And proximity sensors arewidely used as limit switches or posi-tion detectors. Such switches detectposition of the thrust reversertranscowls in jet engines or down-and-locked position of a landing gear,where even the best sealed mechani-cal switch has a limited life.

Another interesting way of detect-ing position is shown in Photo 3,which is a demonstrator kit availablefrom CSEM. Instead of having teethon the circumference of the wheel,the wheel has been threaded. So, ineffect the sensor sees only one toothmoving across its sensing window asthe wheel turns and makes one revo-lution. This provides you withabsolute position measurement of therotational angle. The interpolation

breaks up the 360° of rotation to 256chunks of 1.4° of angular movement.With standard bandwidth the sensorwill work up to 9,000 rpm.

THE FUTUREThis is still a new technology, so

you’ll have to wait a while before itmatures enough and high productionvolume brings down the price. It’sstill expensive, depending on quantityand special requirements, but it’s inline with the competing technologies.

Nothing is perfect, so let’s be con-structively critical and see what’swrong with this device. Like every-thing else, it has limitations. The firstone is temperature, although I hastento add it is specified for a respectable–40°C to 125°C. But it may not begood enough for some commercialand automotive applications. The sec-ond limitation is its relative complex-ity, which affects reliability.

These two characteristics don’tallow it to be a contender for work inthe environments in which the sim-ple coil in ’VDTs and proximity sen-sors reigns supreme. Consequently,the sensor competes in a crowdedfield against numerous other tech-nologies, such as optical encoding andHall effect, primarily by price becauseit doesn’t have a major feature thatsets it apart from the pack.

No less important today is the BITability, the ability of a built-in test torun diagnostics on the sensor to deter-mine whether or not it’s operatingproperly. In safety-critical applica-tions, it’s imperative that the elec-

Photo 3—The CSEM demonstrator kit has a threadinstead of teeth.

Page 43: cc_2001_07-132
Page 44: cc_2001_07-132
Page 45: cc_2001_07-132

sensors, you could conclude only thatthe output is invalid, but you couldn’tsay which one. For that you wouldneed three sensors and the cost wouldbe hard to justify.

As we continue to automate ourlives, we need more and a wider spec-trum of sophisticated sensors. In thisarticle, I looked at one method ofposition sensing. Check out theResource section if you want to lookfor more methods. I

George Novacek has 30 years of expe-rience in circuit design and embed-ded controllers. He is currently thegeneral manager of Messier-DowtyElectronics, a division of Messier-Dowty International, the world’slargest manufacturer of landing-gearsystems. You may reach him at [email protected].

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 43

RESOURCESensor informationSensors Magazinewww.sensorsmag.com

SOURCESensorsCSEM (Centre Suissed'Electronique et deMicrotechnique)+41 32 720 5111Fax: +41 32 720 5700www.csem.ch

REFERENCES[1] G. Novacek, “Accurate Linear

Measurement Using LVDT,”Circuit Cellar 106, May 1999.

[2] ———, “Testing 1, 2: Part 1—

tronic controller can determinewhether or not the signal receivedfrom the position (or any other) sensoris valid. With a detection coil, forinstance, you can monitor its voltageand current. Unfortunately, CSEMdoesn’t appear to address this issue inits literature. I haven’t found suffi-cient detail to infer what happens if apart of the sensor fails.

The traditional way to verify a sig-nal is through dual redundancy (i.e.,by using two sensors and comparingtheir outputs). This isn’t cost-effec-tive, and therefore isn’t desirable inmodern systems. Even with two such

Channel A (sin)

Channel B (cos)

Interpolation A (PIA)

Interpolation B (PIB)

Reference (PREF)

3.02.52.03.02.52.0505050

Figure 3—As the timing diagram of the linear positioninterface shows, an absolute position signal is avail-able to replace variable differential transformer orresolver-type sensors.

Enduring Challenges” CircuitCellar Online, July 1999.

[3] ———, “Testing 1, 2: Part 2—Standards: Prepping YourPrototype,” Circuit CellarOnline, August 1999.

[4] ———, “Testing 1, 2: Part 3—Powering Your Way ThroughDesign Safety,” Circuit CellarOnline, September 1999.

[5] ———, “Testing 1, 2: Part 4—Immunity Not for Circuitry,”Circuit Cellar Online, October1999.

Page 46: cc_2001_07-132

44 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

his is anotherproject that has its

roots in my diversepast. During the 1970s, I

worked at CERN, the accelerator labin Switzerland. In Geneva, I met aUN employee who was adamant thathe is telepathic. Because I knew of thepitfalls associated with testing suchclaims, I designed a telepathy testerthat would circumvent the problemsencountered by earlier experimenters.

This tester was AC-powered, usedTTL parts, and had electromechanicalcounters that recorded results. Themodern equivalent described here ismore portable. A 9-V battery powersits PIC16C55, LED targets, and LCD.

Both testers present the telepathicsender with one of four randomly cho-sen colored lights. The telepathicreceiver then presses one of four col-ored buttons. If this matches the colordisplayed, a hit is recorded. In thelong run and in the absence of tele-pathic ability, 25% of the keystrokeswill match the target. A significantlyhigher score, especially if repro-ducible, hints at some unusual abilityto communicate.

Neither my UN friend nor anyoneelse I’ve tested has scored better thanchance. However, many people are

convinced they have telepathic pow-ers. A simple device to test suchclaims makes for an interesting ifunusual construction project and letsyou do some real science, too.

THE TEST PROTOCOLThe aim is to discover whether or

not a person in one room can tell,without sensory clues, what colorlight a person in another room islooking at. Thus, the telepathy testerhas two parts, a sender’s box and areceiver’s box, linked by a cable 50′ orso long. A panel in the sender’s box isilluminated part of the time by one offour LEDs—red, yellow, green, andblue. The rest of the time the panel isdark. The rate at which the panelcycles between light and dark can beadjusted to suit the subjects. Typicallyit would be once every few seconds;an experiment of, say, 80 trials lastsonly a few minutes.

The receiver’s box has four pushbuttons. Their colored tops match thecolors and positions of the four LEDsin the sender’s unit. As soon as thesender’s panel is illuminated, thereceiver’s box beeps. This indicatesthat the sender is looking at a coloredpanel. The receiver then pushes thebutton that he or she believes corre-sponds to the target. (Let’s hope tele-pathic ability isn’t associated withcolor blindness!)

Each keystroke counts as a trial. Ifthe correct button has been pressed, ahit is counted. If any of the threeincorrect buttons is pressed, no hit iscounted. The test ends when a prede-termined number of trials (20, 40, or80) have finished. If the receiver failsto press a button, that trial is notcounted as part of the test.

The number of hits is then evaluat-ed to see if an abnormal event hastaken place. A significant deviationfrom 25% hits, the chance expecta-tion, could indicate that the senderand receiver have been able to com-municate in some manner.

As with any scientific experiment,a result can be caused by the effectbeing sought. Or a result can be anartifact of the experimental design ora chance fluctuation. Table 1 showsthe likelihood of various outcomes.

FEATUREARTICLE

As proved monthly inthis magazine, there’spretty much no limit tothe capabilities ofembedded applica-tions. How aboutdesigning a test toevaluate people whoclaim to be telepath-ic? Is parapsychologyfictive? Even a skep-tic can find intrigue inthis project.

Put Telepathy to the Test

t

Tom Napier

Page 47: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 45

LESSONS FROM THE PASTRegrettably, telepathy testing

has a long history of positiveresults being achieved, conscious-ly or unconsciously, by impropermeans. Thus your first concern isto minimize the possibility ofdeception. Occam’s razor tellsyou not to attribute a positiveresult to telepathy until all otherconceivable (more likely) causeshave been eliminated.

The two participants should bein different rooms with a closeddoor between them. A refereeshould be present at the sendingend to control the test and verifythat no tampering with the devicehas taken place. A witness in thesame room as the receiverensures that nothing untoward(e.g., listening at the door) takesplace. Other people should beexcluded from the test area incase any of them are confederateswho might signal the target tothe receiver.

This testing device containsseveral features to avoid the flawsthat have been found in publishedtelepathy experiments. The tar-gets are chosen by a mechanismthat is equally likely to pick anyof the four colors. There is no listof targets that may not be ran-dom, altered after the experiment,or been seen by the receiver.

There is no list of the receiver’schoices, which might be recordedincorrectly or altered by the per-son checking the results. Believeme, it’s been done. Both hits andtotal attempts are recorded auto-matically when a button is pressed.Pushing more than one button, push-ing a button twice, or holding a but-ton down does not result in an extrahit being registered.

The timing of the trials is con-trolled electronically. This preventsthe sender and receiver communicat-ing by code. And yes, that’s been triedtoo. No person needs to communicatebetween the two parties, possibly giv-ing clues to the correct color.

I was even reluctant to use a micro-controller for this job because it couldbe reprogrammed to give misleading

results. Please don’t alter the pub-lished firmware. My credibility is atstake every time you use this tester.

THE SENDER’S UNITThe PIC in the main unit is con-

nected to the noise pulse generator,LCD display, target LEDs, controlswitches, and interface to the remoteunit. It illuminates the random tar-gets, checks the receiver’s response,records, and displays the results.

To select one of a number of eventscompletely at random is an interest-ing technical problem which not all

experimenters have succeeded insolving; one well-known labora-tory built a machine that rarelypresented the same target twicein succession. (Computer-generat-ed random numbers are too pre-dictable for serious testing.)

The random pulse generatoruses a 9.1-V zener diode as acheap substitute for a noisediode. When passing around25 µA it avalanches at irregularintervals. Connecting it to a self-biased comparator chip generatesabout half a million random puls-es per second. These are fed tothe RTCC pin of the ’16C55 andincrease its timer register. Twobits of this register select one ofthe four LEDs for each trial.

The trial length is adjustablefrom 2 to 15 s to suit the testsubjects. It can’t be changed oncea test has begun. A four-way TestLength Selector switch can be setto 20, 40, or 80 trials. It also has aCheck position. Moving thisswitch during a test has no effect.

Pressing the Start button beginsthe trials. A random LED is lit atthe start of each trial period. Atthe same time, a pulse is sent tothe receiver’s unit. This generatesa beep and enables recording ofthe receiver’s response. The beepindicates that the sender is look-ing at a colored lamp and that it’stime to divine it.

At the end of the display peri-od, the receiver’s unit is interro-gated to see which, if any, buttonhas been pressed. This is com-pared to the target, and a hit is

counted if it matches. A short pauseoccurs before the next trial starts.

During a test, the LCD indicatesthe current number of trials and thepredetermined total trial number. Atthe end of the test, the display showsthe number of hits and an indicationof how likely this result is. The resultthen can be recorded.

Pressing the Reset button returnsthe device to Standby mode. If Resetis pressed, the test is aborted and noresult is displayed; disconnecting thecable has the same effect. Figure 1shows the flowchart of the firmware.

Intitialize

Read and display

parameters

Delay 20 ms

Storeparameters

Start butttonpushed?

Pick and display color

Send startto remote

Delay 3xP

Read remote

Validdata?

Hit?

Miss?

Delay 1xP

Lasttrial?

Displayhit count andevaluation

Display"Test stopped"

Reset buttonpushed?

No Yes

No

Count a hit

Count trial

Yes

Yes

Yes

No

No

No

No

Yes

Figure 1—The firmware allows the test parameters to be set beforea test is started. It counts hits and displays the results after theselected number of trials have occurred.

Page 48: cc_2001_07-132

46 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

When you switch to the check posi-tion, the random color cycling contin-ues indefinitely and the result of eachtrial (hit, miss, or pass) is displayed.This allows operation of the box to bedemonstrated and the trial period tobe selected.

Pressing Reset stops this test. Acheck should be done before a test toconfirm that all four lamp/buttoncombinations show the correct hitsand misses (omitted in Figure 1).

The tester runs from a 9-V battery,which has a life of about six hours. Alow-power, 5-V linear regulator pow-ers the microcontroller. I added a7660 inverter to get a high enoughvoltage for the noise diode; lowervoltage zener diodes don’t exhibit theavalanche effect. The –8-V output ofthe inverter can supply a negativebias to the LCD if it needs it. VR3 isthe LCD contrast control and shouldbe adjusted for the best display.

I added a crude battery voltage

check. This compares a fraction of thebattery voltage with the input thresh-old of a PIC port bit. Because the lat-ter is not well specified, you shouldrun the unit from a variable powersupply and adjust VR2 until the “Battlow” message appears around 7.5 V.

AT THE RECEIVING ENDI was tempted to put a microcon-

troller into the receiver’s unit, but anall-hardware solution is better. Thehigher speed and asynchronous natureof logic make it easier to excludesimultaneous keystrokes.

The remote unit uses a 74HCT165shift register to latch whichever but-ton is pressed first. An enable latch isset to put the ’165 in Load mode atthe start of each trial. Pressing anybutton clears the latch and switchesthe ’165 to Shift mode. This latchesthe current state of the buttons sometens of nanoseconds after the firstbutton makes contact. A button

Number of trials Hits Probability

20 6 3.828 × 10–1

7 2.142 × 10–1

8 1.018 × 10–1

9 4.093 × 10–2

10 1.386 × 10–2

11 3.942 × 10–3

12 9.354 × 10–4

13 1.837 × 10–4

14 2.951 × 10–5

15 3.813 × 10–6

16 3.865 × 10–7

17 2.960 × 10–8

18 1.611 × 10–9

19 5.548 × 10–11

20 9.095 × 10–13

40 11 4.161 × 10–1

12 2.849 × 10–1

13 1.791 × 10–1

14 1.032 × 10–1

15 5.444 × 10–2

16 2.624 × 10–2

17 1.156 × 10–2

18 4.651 × 10–3

19 1.708 × 10–3

20 5.724 × 10–4

21 1.749 × 10–4

22 4.864 × 10–5

23 1.230 × 10–5

24 2.826 × 10–6

25 5.880 × 10–7

26 1.105 × 10–7

27 1.871 × 10–8

28 2.841 × 10–9

29 3.851 × 10–10

30 4.631 × 10–11

31 4.906 × 10–12

32 4.536 × 10–13

33 3.618 × 10–14

34 2.253 × 10–15

Table 1—The probabilities of getting N or morehits by guessing are listed for the three testlengths. Probabilities less than 10–15 are omitted tosave space.

Number of trials Hits Probability

80 21 4.403 × 10–1

22 3.426 × 10–1

23 2.553 × 10–1

24 1.819 × 10–1

25 1.239 × 10–1

26 8.047 × 10–2

27 4.989 × 10–2

28 2.950 × 10–2

29 1.663 × 10–2

30 8.940 × 10–3

31 4.582 × 10–3

32 2.239 × 10–3

33 1.043 × 10–3

34 4.635 × 10–4

35 1.964 × 10–4

36 7.932 × 10–5

37 3.055 × 10–5

38 1.122 × 10–5

39 3.929 × 10–6

40 1.312 × 10–6

41 4.174 × 10–7

42 1.266 × 10–7

43 3.659 × 10–8

44 1.007 × 10–8

45 2.641 × 10–9

46 6.593 × 10–10

47 1.566 × 10–10

48 3.538 × 10–11

49 7.597 × 10–12

50 1.550 × 10–12

51 3.002 × 10–13

52 5.516 × 10–14

53 9.606 × 10–15

54 1.584 × 10–15

Page 49: cc_2001_07-132
Page 50: cc_2001_07-132

Figure 2—The main unit uses a noise diode to select random targets. The ’16C55reads and checks the subject’s responses, and then displays its conclusions.

Page 51: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 51

would have to bounce open or a sec-ond button close within this periodfor an incorrect state to be latched.Nothing further happens until the endof the display period when the con-tents of the ’165 are shifted out andsent to the main unit.

The interconnecting cable has threecores. I used intercom wire (part 278-0871) purchased at Radio Shack. Onewire supplies 5-V power, one carriestwo-way communication, and one iscommon. The data wire is connected

to a pull-up resistor in the main unitso either unit can transmit data byshorting the wire to ground. Staticprotection is provided at both ends ofthe cable.

A 400-µs active-low pulse from themain unit marks the start of a displayperiod. It triggers one half of a dualmonostable, generating a 50-ms pulsethat gates a transistor-driven piezo-electric beeper to make the trial syn-chronizing signal. This also sets theenable flip-flop.

What is Random?After you build this telepathy

tester and check someone’s abilities,the question arises: What do theresults mean?

If your subjects are not telepathic,then in 20 trials, the most likelynumber of successes is simply 20 ×0.25, or five. Carry out thousands oftests and you will get five hits moreoften than any other number, but, asFigure s1 shows, the probabilities ofthree, four, five, six, or seven hits arenot very different. In 80% of tests,the number of hits will lie within therange of three to seven, unless some-thing other than chance is operating.

That is, small deviations from fivehits are not significant. The probabil-ity of getting larger numbers of hitspurely by guessing drops precipitous-ly. The vertical scale in Figure s1 islogarithmic. The probability of 10hits is about 1%, but the probabilityof 15 hits, three times the expected

number, is about 3.4 in one million.Because the aim of the telepathy

experiment is not to get a specificnumber of hits but to do better thanguess, it’s more meaningful to ask,what is the probability of N or morehits? Table 1 lists these probabilitiesfor the three trial numbers. If youdid a trial every second for eighthours of every day for four years,you would stand a less than evenchance of getting more than 40 hitsout of 80 trials.

On the other hand, an exceptionalscore can crop up. You may betempted to crow about that scoreand ignore all of the others, butthat’s bad science. Positive telepathytest results are often published; noone knows how many unsuccessfulresults are buried in desk drawers. Ifthe effect is real you should get asimilar result every time you repeatthe test.

1 in 10,000,000

1 in 1,000,000

1 in 100,000

1 in 10,000

1 in 1000

1 in 100

1 in 10

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

–8

–7

–6

–5

–4

–3

–2

–1

0

Logprobability

17 18 19

Number of hits

Figure s1—In theabsence of com-munication, theexpected numberof hits has this dis-tribution in a 20-trial test. Evenlarge numbers ofhits sometimesoccur by chance.

Page 52: cc_2001_07-132

52 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

container. The 16-character, two-lineLCD is mounted across the top of thefront panel. Both the box and displaywere relics from an abandoned proj-ect. (Surplus dealers sell suitable dis-plays for about $10.)

The target panel is mounted in thecenter of the box. I used a 2″ diametertranslucent polyethylene plug cover.This is illuminated from below byone of four high-brightness LEDs.Above and to its left is a potentiome-ter (VR1) that sets the trial rate.Below that are the Start and Resetbuttons and the on/off switch. Thefour-way slide switch, which selectsthe trial count, is at the bottom right.

Most of the parts fit on a PC boardmounted on the bottom of the box.Connectors on the board link to thedisplay and the panel controls; con-nection to the remote unit is madewith a 0.12″ stereo jack socket on thefar end of the unit.

The remote unit (see Figure 3) fits ablack plastic box that measures 4″ ×2″ × 1″. Its only visible features arefour colored push buttons on one face;each is about 0.5″ square (520 series

from E-Switch, available from Digi-Key). One PC board carries the pushbuttons and the beeper. A secondboard carries the four ICs and the jacksocket for the cable. The two boardsare linked by a 7-in-line connector.

INTERPRETING THE RESULTSAt the end of each test, the display

indicates the number of hits regis-tered and a one-word evaluation. Thelatter is based on the probability ofthe result if telepathy isn’t acting.“Normal” indicates a score youwould expect to get in 19 out of 20tests. “Unusual” means a less thanone in 20 chance and “Amazing” indi-cates a less than one in 1000 chance.If you get a score that would happenby chance less than once in 100,000tests, the display shows “Incredible.”For a more accurate evaluation, youcan look up the score in Table 1.

Even extremely high scores may bepurely random (see the “What isRandom?” sidebar). However, when ascore that should occur perhaps oncein a million experiments occurs, youshould suspect that something odd is

At the end of the display period, themain unit puts six 10-µs active-lowpulses on the connecting line some 75µs apart. These pulses are too short toaffect the enable flip-flop but do firethe other half of the monostable,which has a 35-µs period. Its output isgated by the shift register data outputand ORed onto the line. A zero databit has no effect, whereas a 1 bittriples the length of the pulse on theline. After sending a clock pulse, thecontroller samples the line to see if itis still low and records a 1 bit if it is.

The back edge of the monostablepulse shifts the next data bit to theoutput of the shift register. The firstand last bits are hardwired as onesand the four middle bits indicatewhich button was pressed. If no but-ton was pressed, the first clock pulseclears the enable flip-flop and switch-es the shift register from load to shift,so it’s ready to be read.

THE MECHANICAL STUFFThe main unit (see Figure 2) is con-

tained in a 3.5″ × 5.5″ × 1.2″ moldedplastic box with a built-in battery

Figure 3—The remote unituses CMOS logic to detect,store, and transmit the sub-ject’s responses. One wirecarries power and the othertransmits data in bothdirections.

Page 53: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 53

going on. The best thing to do is carryout another test. If this also shows anunusual result, it probably indicatesperson-to-person communication.Unfortunately, it does not confirmthe existence of telepathy unless youcan prove there is no conceivablealternative method of communica-tion. This device, like all telepathytesters, is better at demonstrating theabsence of communication than thepresence of telepathy.

THE MILLION DOLLAR QUES-TION

Is anyone telepathic? I don’t knowbut there is a cash award waiting foranyone who can prove it. The JamesRandi Educational Foundation(www.randi.org) has a standing offerof $1 million for a demonstration ofparanormal ability. So far nobody hasbeen able to demonstrate the powersthey claim under proper test condi-tions. You might just uncover some-one who can really do it with thistelepathy tester. Just be sure to getyour finder’s fee up front!

SOFTWAREThe object code is available onCircuit Cellar’s web site.

SOURCES520 seriesE-Switch(763) 504-3525Fax: (763) 531-8235www.e-switch.com

PIC16C55Microchip Technology Inc.(480) 786-7200Fax: (480) 899-9210www.microchip.com

74HCT165Philips Semiconductors(212) 536-0500Fax: (212) 536-0559www.philips.com

RESOURCESS. Blackmore, In Search of theLight, Prometheus Books,Amherst, NY, May 1996.

P. Kurtz, ed., A Skeptic’s Handbookof Parapsychology, PrometheusBooks, Amherst, NY, September1985.

Tom Napier has been interested intelepathy since he was a physics stu-dent. He helped found an education-al group, Philadelphia Association forCritical Thinking (www.phact.org),which studies fringe science andparanormal claims.

TO LEARN MOREFor a comprehensive discussion of

telepathy testing I recommend read-ing A Skeptic’s Handbook ofParapsychology, edited by Paul Kurtz,Ph.D. This book contains articles byboth skeptics and believers.

For an insider’s view of the world oftelepathy testing read In Search of theLight, by Susan Blackmore, Ph.D.This book describes Blackmore’sexperiences as a parapsychologist andportrays her gradual conversion froma committed believer whose experi-ments wouldn’t give positive resultsto a skeptic who uncovered the flawsin other people’s experiments. I

AD422 (Requires 9VDC) $79.00AD422-1 for 110VAC 89.00AD422L signal powered 84.00

ADA485 (requires 9VDC) $79.00ADA485-1 for 110VAC 89.00ADA485L signal powered 84.00

CMC’s low cost converters adapt anyRS232 port for RS422 or RS485operation. These converters provide yourRS232 device with all the advantages ofRS422 or RS485 including reliable highspeed operation (up to 200 kbaud) anddata transmission distances up to 5000feet. Two AD422s can be used to extendany RS232 link up to 5000 feet.Completely transparent to the system;no software changes of any type arenecessary.

RS232/RS422/RS485 Converters

• Converts an RS232 port foruse with RS422 or RS485devices

• Supports up to 40 RS485 orRS422 multidrop devices

• Adds multidrop capability toRS232 devices

• Automatically determinesdata direction.

RS232 TO RS4854 wire

• Makes your RS232 port anRS485 port

• Supports up to 40 RS485devices

• Automatically determinesdata direction.

• Signal powered versionavailable

RS232 TO RS4852 wire

ADA425 (requires 9VDC) $89.00ADA425-1 for 110VAC 99.00

Mention this ad when you order and deduct 5%Use Visa, Mastercard or company purchase order

WWW.2CMC.COM Fax:(203)775-4595

codeCC83

PO BOX 186, Brookfield,CT 06804 (203)740-9890Connecticut microComputer, Inc.

• Converts bi-directionallybetween RS232 and RS422

• Use as a short haul modem• Plug in and go. No software

changes required

RS232 TO RS422

Page 54: cc_2001_07-132

54 Issue 132 July 2001 CIRCUIT CELLAR®

ecently I receivedan e-mail note from

Caleb, a regularCircuit Cellar reader,

who posed a question concerning myrepeated use of the term “Floridaroom.” He noted that the members ofSteely Dan had written a song enti-tled “The Florida Room” and he won-dered if there was a hidden messagebehind my choice of words. I assuredhim that there is no subliminal intentor backwards-playing strategy on mypart. In fact, the band members fre-quent the Florida room. One of myfavorite Steely Dan songs, “FM,” hasa lot to do with this month’s article.So, without further delay (nor static),let’s take a look at wireless data com-munication, local area style.

NO STATIC AT ALLEverything communications-orient-

ed is taken for granted today. World-wide, there are wireless Palm devices,Ethernet LAN devices, pagers, andcell phones. A sometimes forgottenfact is that this technology began longago with the invention of wireless, oras we know it today, radio.

For embedded designers, there aremany ways to implement wirelesstechnology. If your product can sup-

www.circuitcellar.com

APPLIEDPCs

port the expense, you can use digitalpager or cell phone sites and servicesto route your wireless data from placeto place. On the other hand, if youjust want to move data in a small cen-tralized area within a radius of a cou-ple hundred yards, the pager and cellmethod is not a viable alternative.

Campus wireless technology wouldbe a good choice for the small areanetwork I described, but you’d need apocketful of money to implement it.If your embedded application requireswireless data packet transfer anddoesn’t entail moving spreadsheetsbetween Palm devices in Singaporeand London or over the 10-acre corpo-rate campus, the wireless data moversdistributed by Lemos Internationalare your ticket to inexpensive, suc-cessful data transfer using wirelessnetworking technology.

Before I get into the details of dataradios, I’d like to show you the hard-ware and software tools I used to puttogether a wireless data packet net-work in the Florida room. Photo 1 is alook into a padded cell that containsthe Radiometrix Universal EvaluationKit. Let’s investigate the individualparts of the kit beginning with themain data radio evaluation platform,which is shown in Photo 2.

RADIO GA GAThat’s what Queen’s Freddie

Mercury (F. M.) would have said uponopening the Radiometrix black box.The Radiometrix data radio evalua-tion board in Photo 2 is designed toassist the embedded wireless designerin selecting the right data radio for agiven wireless task. The data radioevaluation board consists of an areathat is pinned for four types of dataradio modules. The supported dataradio modules are:

• TX1/RX1• TX2/RX2• TX3A/RX3• BiM2/BiM3

In addition to the modules, the dataradio evaluation board is fully loadedwith blinking lights that, at a glance,relay information status concerningsignals received and transmitted by

Fred Eady

Tuning the Data Radio

rThe best way to knowwhere you’re going isto know where you’vebeen. Radios may nowtake a back seat topagers and Palms, butthey forged the hum-ble beginnings forwireless technology.So, take a look at thedata radio when tryingto solve your datatransfer problem.

Wireless Data Communication

Page 55: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 55

the attached data radio modules.Transmitter enabled, receiver enabled,carrier detect, preamble detected, andvalid packet received are all denotedwith LEDs and represented by physi-cal lines that can be monitored by anexternal microprocessor. The dataradio evaluation board can be battery-powered (see Photo 2) or externallypowered using the onboard screw ter-minal block.

Battery operation allows portableoperation and permits on-site rangetesting, antenna evaluation, and noiseand interference identification. I com-pletely drained the original set of bat-teries while putting together this arti-cle, and it was nice to just screw in a9-V wall wart to run the evaluationboard while it was on the bench.

The white row of male header pinsin the upper right corner support theuse of the Received Signal StrengthIndicator module (RSSI) you seemounted to the evaluation mainboard in Photo 3. The RSSI also addsanalog transmission and receptioncapability to the Radiometrix wirelessevaluation kit as well as signalstrength readings.

The row of male headers along thebottom edge of the data radio evalua-tion board mate with a female headerthat couples a DB-25 male shell con-nector to the parallel port of yourembedded or desktop computer. Thepinout of this parallel interfacebetween the Radiometrix evaluationboard and an embedded or desktopparallel port is shown in Figure 1.There is also a jumper link on the par-allel port interface headers that allowsthe wireless designer to access thebuilt-in data radio evaluation boarddiagnostic routines.

The presence of a Reset but-ton indicates that there mustbe intelligence in the form of amicroprocessor close by. In thecase of the Radiometrix evalua-tion board, the smarts are pro-vided by a modified version ofthe RPC-000-DIL (radio packetcontroller-000-DIL). The Eval-RPC is really a MicrochipPIC16F84A-20I/P that is chock-full of radio control diagnosticroutines. A portion of the Eval-

RPC pins are directly connected tothe parallel port interface that attach-es to the DB-25 male shell connectorand ultimately to the parallel inter-face of an embedded or desktop com-puter. When there’s no device hangingon the data radio evaluation board’sparallel interface, a hexadecimal-coded debug switch is used to selectcanned test routines within the Eval-RPC’s ROM. A rundown of the diag-nostic modes is shown in Table 1.The other end of the Eval-RPC man-ages the communications link to thedata radio modules that can beattached to the Radiometrix evalua-tion system.

Four jumper links on the evaluationboard from Radiometrix select thedata rate, mode of operation, and iso-late external analog data input fromthe transmit data line (TXD) inAnalog mode. The data rate is deter-mined by the crystal frequency. Theequation to determine the data rate inbits per second is:

[1]

Standard crystal frequencies includ-ed on the evaluation board are 2.4576and 10.24 MHz. Using these frequen-cies with jumper link 2 (LK2) providesdata rates of 9600 and 40,000 bps,respectively. A pair of 16.384-MHzcrystals is also provided with theRadiometrix Universal Evaluation Kitto allow 64-kbps operation with theTX3A/RX3 and BiM2/3 data radios.

ROCK OR COUNTRY? Being from Tennessee has its bene-

fits. Not only do I get to mingle withthe London rockers, but Faith Hill

and Tim McGraw fly down fromNashville to drop into the Floridaroom from time to time, too.

The Stones one weekend and Faithand Tim the next makes it hard todetermine which type of music I pre-fer over all else. In a parallel situa-tion, I received two sets of radios withthe Radiometrix Universal EvaluationKit, a quartet of TX3A/RX3 modulesand a pair of BiM2 transceivers. Bothsets of radios have unique attributes.I’ll begin by examining the TX3A/RX3 data radio combination.

The TX3A/RX3 data radio setcomes in two flavors depending onwhat continent you’re standing on. InEurope, the TX3A/RX3 data radiosoperate at 868–870 MHz. If you’re inthe U.S., the frequency range is902–928 MHz and the wireless U.S.puppies already have an FCC Part 15pedigree. The UK models are alsoscreened for certification there underEN 300-220-1 and EN 300-683.Caveat emptor! Just because thesemodules are screened and certifieddoesn’t mean you won’t need to havethe final equipment they play in certi-fied too. Outside distances of up to120 m (393.7′ or 0.5965 furlongs) andan inside maximum distance of 30 m(98.43′ or 0.1491 furlongs) can beachieved with data rates approaching64 kbps using the TX3A/RX3 radios.

The TX3A/RX3 data radio set (seePhoto 4) is FM-modulated with thetransmitter (TX3) employing a crystallocked PLL (phase locked loop) for fre-

Photo 1—This black box comes equipped with a couple of full-blown data radio support platforms. Each data radio platformcan be rigged to use 433- or 173-MHz wireless modules. Thelonger antennas are quarter wave.

Photo 2—This data radio platform is equipped withthe 433-MHz BiM2 transceiver. There are femaleheaders underneath it that allow other data radiomodules to be plugged in and evaluated.

Page 56: cc_2001_07-132

56 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

filtered superhet and the BiM2 trans-mitter also uses SAW-stabilized tech-nology to deliver 10 mW of FM powerto the antenna. The BiM2 also drawsa bit more current, a little less than20 mA, from a higher minimum sup-ply voltage that spans 3 to 5 VDC.Like the TX3A/RX3, the BiM2 can bepowered down to the sub 1-µA level.

IT ALL SOUNDS THE SAMEMusicians are really tonality math-

ematicians. Their work is withoctaves, sharps, and flats timed at spe-cific intervals. Embedded program-mers and hardware designers are bina-ry mathematicians who work withbits timed at specific intervals. Forthe embedded programmer, musicaloctaves are powers of 2, with sharpsand flats being all of the bits in-between. Both musicians and embed-ded programmers use the same set ofnotes and bits to write totally differ-ent sounding music and totally differ-ent types of programs.

The point is that both the BiM2 andTX3A/RX3 data radios have a lot incommon. They both have the abilityto transfer data over a reasonable dis-tance and both are capable of opera-tion anywhere using battery power. Acommon interface using the RPC-000-DIL allows almost any microprocessorto interface with the data radio mod-ules. The problem I am faced withright now is determining which dataradio I should use.

In applications that don’t require atransceiver, the TX3A/RX3 data radioset could be deployed as a singlereceiver or transmitter. For instance,if I wanted to monitor the movementof alligators in my backyard, I could

quency stability. The datais demodulated at thereceiver end (RX3) by asingle conversion FMSAW-filtered (surfaceacoustic wave-filtered)superhet front-end. TheRX3 receiver is capable ofproviding RSSI output viaan RSSI pin. A built-in2.85-V regulator allowsboth the receiver andtransmitter to operate overa voltage range spanning2.2 to 12 VDC. Current consumptionis a measly 7.5 mA for the transmit-ter and 9.5 mA for the receiver. Anenable function can be employed toreduce current consumption to lessthan 1 µA. At 3 VDC the TX3 deliv-ers 1 mW of RF power to the antenna.

If you’re wondering how the mod-ules can operate below the built-involtage regulator’s threshold, the trickis that there is no regulation takingplace below 2.9 VDC. The catch isthat the 2.2-VDC power supply mustbe very clean, as the voltage regulatorcircuitry isn’t helping to filter the rip-ple. Any applied supply voltage below2.2 VDC will disable the RF circuitryof the module.

The black and gold module deadcenter on top of the data radio evalua-tion board shown in Photo 2 is theBiM2 transceiver. Just like theTX3A/RX3 radio set, the BiM2 iscompliant with European low-powerradio standards. However, the BiM2isn’t ready to go up against the FCCright out of the box. The usable out-door range is 200 m (656.2′ or1969 hands). Indoor range extends toa maximum of 50 m (164′ or492.1 hands). BiM2 operates on theEuropean license exempt frequency of433.92 MHz. I took a look at the FCCPart 15 document that covers theBiM2. I didn’t see any exemptions for433.92 MHz. Better put some puppypaper down on the living room carpetbefore you turn this one loose in theU.S. Also, there is no resident RSSIoutput pin on the BiM2.

The rest of the BiM2 specs readmuch like the TX3A/RX3. The datarate ceiling is 64 kbps, but the BiM2receiver is a double conversion SAW-

Photo 3—This configuration allows the newly dubbed embedded wire-less engineer to quickly survey the terrain for dead spots and interfer-ence without the use of expensive spectrum analysis equipment.

Page 57: cc_2001_07-132

www.circuitcellar.com Issue 132 July 2001 57

simply construct a transmitting sta-tion using only the TX3A module.Taking that idea one step further, sup-pose I needed to monitor the neigh-bor’s backyard, too. I could put anoth-er TX3A transmitting station thereand set it to report in at a differenttime than my backyard monitor.Another factor in favor of theTX3A/RX3 is that it is almost FCC-approved right out of the box.Although I would still have to pursueFCC certification for my alligatormonitor, the TX3A/RX3 puts me a bitcloser than the BiM2.

On the downside, if the parts countand space are at a premium and I real-ly need a transceiver, the BiM2 is amuch smaller footprint in a singleeasily mountable package. The BiM2is a bit zesty for the U.S. FCC agents,but there is a way to tame the savagebeast. The effective radiated power(ERP) output of the BiM2 can be regu-lated using a short impedancematched antenna, or by impeding theactual power delivered to the antennausing a passive attenuation network.

CIRCUIT CELLAR®

The bottom line is that both dataradios will do the job in an equalmanner when tuned to the FCCrestrictions. As far as my decisionprocess goes, power consumption is oflittle importance in that both dataradios are power-stingy. There is littledifference in the receiver sensitivity

at 5 VDC and the same antennagotchas apply to both data radios.Audio is a no-brainer, as it will not beused. I only need a data rate of9600 bps because I’ll only be trans-mitting very small packets of sensordata on demand to a centrally locatedembedded system well within eitherdata radio’s range.

My application definitely requires atransceiver and I personally like thesmaller footprint the BiM2 provides. (Ihappen to know that the BiM3 isscheduled to come out in September.From what I hear, it has the samefootprint as the BiM2). As you see inPhoto 2, Lemos has a snazzy littlestubby antenna that fits the bill, andthe Pi-Network is a piece of cake toimplement using surface-mount resis-tors. I’m going to commit to the BiM2data radio model for the rest of thisarticle and application.

MAGNETIC PICKUPSThe BiM2 I have selected as the RF

component of my sensor station isfully capable of emitting a radio signal

+5V D3

D2

D1

D0

*RXA

*RXR

*TXA

Debug/Gnd

*TXR

*MCLR

*Signal

5

4

3

2

14

13

12

1

18

18

15

Data3

Data2

Data1

Data0

*Auto linefeed

Printer selected

*Paper out

*Strobe

GND

*Initialize printer

*Error

Figure 1—Although this picture depicts a standardPC-compatible parallel port connection, any parallelport configuration that can handle the I/O configurationand adhere to the signal timings will suffice.

Page 58: cc_2001_07-132

58 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

to the external embedded processorusing the 4-bit data port and the fourhandshake signals.

To provide reliable wireless datatransfer, some precautions must betaken. First, the transmitter mustallow the receiver to synchronizewith the incoming datastream. In thecase of the BiM2 data radio module,it may be sleeping and waiting for thewakeup signal. To accomplish syn-chronization, the RPC-000-DIL placesa preamble and start byte at thebeginning of each data packet it willsend out. The packet is then append-ed with an error check code. Thepacket is then mark:space balancedand transmitted. In your case, thetransmission is via a BiM2 but thedata radio could be a TX1/RX1 or aTX3A/RX3. The basic packetizing issimilar to what’s done with Ethernet.

Somewhat like Ethernet, the RPC-000-DIL provides collision avoidancemethods. These include fixed delaytransmit with no channel check,immediate transmit if channel is clear,random delay transmit if channel isclear, and immediate transmit no-channel check. Fixed delay transmitwith no-channel check is ideal forlarger wireless networks (approaching255 data radios) that require pollingfor data transfer. The random delaytransmit if the channel is clear is mostsimilar to today’s Ethernet collisionavoidance method. The four methodsare mutually exclusive and are chosenby the embedded wireless engineer.

On the receive side, the RPC contin-uously searches the ether for a validpreamble. The preamble allows thereceiving RPC to synchronize with theincoming datastream. The data is

that can be sensed by other BiM2units in its range. It would be nice ifthose transmissions made somesense. That’s where the Eval-RPCcomes in. The Eval-RPC is based onthe original RPC-000-DIL.

I needed a network of smart wire-less modules. The Eval-RPC and theRPC-000-DIL both provide low-levelpacket formatting and packet recov-ery functions, so I had to inter-con-nect a number of data radio-equipped,alligator-watching microprocessors ina wireless network. I also obtainedsome RPC-000-DIL parts from Lemosand verified that the Eval-RPC andthe RPC-000-DIL are logically identi-cal and can communicate with eachother when installed in the data radioevaluation boards. So, from now onI’ll call them both by the same name,RPC-000-DIL.

The RPC-000-DIL handles almosteverything related to wireless datatransmission using the TX3A/RX3 orBiM2 data radios. Using a 4-bit dataport and four handshaking signals, anexternal embedded processor assem-bles and loads a data packet of 1 to 27bytes into the RPC-000-DIL. Whentransmitted, the receiving RPC-000-DIL signals the external embeddedprocessor that received data is avail-able. The received data is moved out

Figure 2—There’s reallyno rocket science here asthe RPC-000-DIL is instandard PIC surroundings.Programming a workingdata radio model is a snap,as the RPC-000-DIL isalready loaded and the RFmodule is self-contained.Most of the real program-ming design work will bedone on the externalmicroprocessor platform.

Photo 4—The divisionof transmitter andreceiver enables theinexpensive assemblyof transmit- or receive-only data radio equip-ment.

Page 59: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 59

clocked in, decoded, and validat-ed using a checksum. The exter-nal microprocessor is alertedthat a valid packet has beenreceived by the RPC and is wait-ing to be transferred.

The actual data format of thepacket is up to the embeddedengineer. Only the first byte isfixed. The first byte, or controlbyte, tells the receiving RPCwhich type of packet it has (con-trol or data) and how many bytesit contains. The contents of thepacket could contain routinginformation or packet sequenceinformation. After the first byteis configured, the rest of thepacket payload is at the design-er’s discretion.

The data transfer process is a lock-step method using request and acceptlines. To transmit a byte via the RPC-000-DIL and a data radio module, theexternal microprocessor takes theTXR (transmit request) line low. TheRPC-000-DIL then pulls the TXA(transmit accept) low. At this point,the external microprocessor enablesthe 4-bit data bus and places the leastsignificant nibble of data on the bus.After that, the external microproces-sor takes the TXR line high to indi-cate that the bus holds valid data. TheRPC-000-DIL reads the data bus andraises the TXA line to signal that thedata has been read from the data bus.This entire process is repeated for themost significant nibble of the byte tobe transferred.

After the control byte and payloadare placed in magnetic space andreceived by other data radios, thereceive process begins with a signalfrom the RPC-000-DIL (taking RXRlow), telling the external microproces-sor that “there’s data in thembuffers.” (I’m paraphrasing.) Theexternal microprocessor seeingreceive request low, pulls RXA(receive accept) low. The RPC-000-DIL then enables the 4-bit data busand places the least significant nibbleof the first received byte on the bus.Next, the RPC-000-DIL sets the RXRline high. The external microproces-sor sees this and knows that theincoming data is valid and ready to be

SOURCESLemos International(508) 798-5004www.lemosint.com

PIC16F84A-201/PMicrochip Technology Inc.(480) 792-7200www.microchip.com

Radiometrix Universal EvaluationKit, TX3A/RX3, BiM2/3, RPC-000-DILRadiometrix Ltd.020 8428 1220www.radiometrix.co.uk

Fred Eady has more than 20 years ofexperience as a systems engineer. Hehas worked with computers and com-munication systems large and small,simple and complex. His forte isembedded-systems design and com-munications. Fred may be reached [email protected].

read. After reading the data bus, theexternal microprocessor takes theRXA line high.

This receive process is repeated forthe most significant nibble of theincoming byte. The entire messagereception process is determined bythe programming in the externalmicroprocessor and should be regulat-ed by the length of the message asdefined in the control byte.

The most significant bit in the con-trol byte determines if the packet is adata or control packet. A zero in bit 7of the control byte makes the packeta data packet, and the last five bits ofthe control byte are the number ofbytes in the packet including the con-trol byte. You know that the RPC-000-DIL is really a PIC16F84A andthese flash memory parts contain asmall amount of user EEPROM. Someof this EEPROM is allocated to theRPC-000-DIL internal affairs. The restis there for public consumption. Toaccess the EEPROM, the most signifi-cant bit of the control bytes is set. AnEEPROM read operation is performedwhen control byte bit 6 is cleared.The EEPROM write operation is exe-cuted when bit 6 is set. In either case,read or write, the remaining six bitsof the control byte are the operation’starget EEPROM address.

The very first location of RPC-000-DIL EEPROM (0x00) contains theswitches that determine such thingsas which mode to run in (Continuous

or Power Save), the collisionavoidance method, and whetheror not to enable the EEPROMfor a write operation. The restof RPC-000-DIL reserved EEP-ROM memory holds the num-ber of preamble cycles to gener-ate or how long to sleep inPower Save mode. This restrict-ed EEPROM memory areaextends from 0x00 to 0x09.EEPROM locations 0x10through 0x3F can be used asyou see fit. Now that you havea logical knowledge of how thedata radio evaluation boardworks, take a look at thephysics of the data radio mod-ule in Figure 2.

SIGN OFFIn my days of AM radio, I actually

had to turn off the transmitter atnight and sign off the station. Thesedays, radio runs 24 hours a day, AMand FM. I’ve got to turn off myCircuit Cellar transmitter now, butnext time when I sign on again, I’llexplore attaching the data radioequipment to a Linux embedded sys-tem. Stay tuned as it becomesincreasingly clear that it doesn’t haveto be complicated to be embedded. I

Mode Name Function

0 RX-On Preamble detector on(RXR LED = preamble detected)

1 RX-Pulse 10 ms on, 10 ms off,preamble detector on, RXR LED

2 TX-On-Pre Preamble modulation, send continuous preamble

3 TX-On-Sq 100-Hz Square Wave mode,TX testing on spec analyzer

4 TX-On-255 Random 40 kb/s data for eye diagram tests,in sync with RXR

5 TX-Pulse 10 ms on, 10 ms off,preamble bursts, RX lock in tests

6 Echo Transponder mode, retransmit any valid packets received

7 Radar Send ASCII test packet, Radiometrix,and listen for echo

8 Self-test Loop test, TX > RX (OK on RXR)

Table 1—Some of the diagnostic routines, like TX-On-255, are intend-ed to be used in conjunction with a four-channel storage oscilloscopefor technical evaluation purposes, and Echo and Radar are focused ona human walking the intended radio range perimeter.

Page 60: cc_2001_07-132

60 Issue 132 July 2001 www.circuitcellar.com

hat is the mostefficient method to

synthesize precisionlow-distortion power sine

waves? The answer to this big bucksquestion is a concern for designers ofsystems like electric autos, industrialAC motor controls, and telephoneringer circuitry and their associatedpower quality conditioners.

Recently, I’ve been exploring what Icall “steplocked” magic sine waves,which apply Chebyshev polynomialsand a few other arcane math tricks tosynthesize ultralow-distortion sinewaves. These sine waves have precise-ly defined amplitudes and frequenciesand are created by a small number oflow-energy switching events forexceptional efficiency.

The key feature of steplocking isthat, in theory, any number of lowharmonics can be forced to zero.Often n pulses per quadrant can bechosen to force an astonishing 4nlow-order harmonics to zero!

Compared to current PWMschemes, steplocking offers com-pelling advantages. Fewer switchingevents mean dramatic efficiencyimprovement. There is low-energy,single-side switching for further effi-ciency gains. And, significantly less

CIRCUIT CELLAR®

FEATUREARTICLE

This month, Don tack-les an issue facingscores of designers.Who isn’t looking foran efficient way tosynthesize power sinewaves? Although hewon’t pull a rabbit outof a hat, Don will usea little magic togetherwith Chebyshev poly-nomials to get the jobdone.

high-frequency energy is involved.Carrier energy is rarely stronger thanthe fundamental, even at low ampli-tudes. Any number of low harmonicscan be forced to or near zero.

Steplocking offers nearly unlimitedchoice of precision amplitude incre-ments. Switching pulses are locked tothe chosen fundamental. The carrierphase reverses every half cycle to aidharmonic reduction.

This process works well with low-end microcomputers. And, nothing isanalog. It requires typically 26 bytesper amplitude. You can safely makesteplocking three-phase delta friendly.The final advantage is that per-cycleswitching events are often independ-ent of speed or frequency.

And, of course, on the dark side,there are limitations. First, the initialpair of uncontrolled odd harmonicsoften is strong, possibly comparablein strength to the fundamental.Second, some low-pass filtering isneeded; filtering is provided by motorinductance and load inertia.

The third disadvantage is that high-ly precise timing is required to onepart in 30,000 or better. Fourth, speedor frequency may have to be set by asecond PLL circuit. Fifth, steplockingis best suited for power and loweraudio frequencies. And finally, a rea-sonably wide speed/frequency rangedoes not go down to DC.

A FIRST LOOK Figure 1 shows some steplocked

sine wave variations. A few exactlyspaced pulses thicken nearing the sinewave crests. Thickening and reposi-tioning achieves higher amplitudes.

Often you will work in the firstquadrant only. This is mirrored forthe second. The pair then can getflipped for the remaining bottom halfof the waveform. Using one quadrantguarantees no DC term, no even har-monics, and no Fourier cosine termsfor any odd harmonics. It alsorequires only one-fourth the storagefor your table look-up listing of pulsestart and pulse width values.

Each pulse is output to connect aDC power supply to your load. Twohalf-bridge drivers often are used forsingle-phase applications. Unlike

Don Lancaster

w

Steplocked Magic SineWaves

Page 61: cc_2001_07-132

Figure 1—Here are threeexamples of variations onsteplocked magic sinewaves. a—The normalmagic sine wave cancelsout harmonics 2 through22. b—The delta-friendlymagic sine wave handlesthree phase loads. c—The best-efficiency magicsine wave cancels outharmonics 2 through 24.

www.circuitcellar.com Issue 132 July 2001 61CIRCUIT CELLAR®

PWM, only one driver is normallyswitched at a time, which mayimprove efficiency.

The spectrum for any steplockedmagic sine wave typically consists ofzero even harmonics and no DC term.A chosen number of low odd harmon-ics are also forced to or near zero.

The higher the number of pulses,the more odd harmonics you are ableto force to zero. But, the efficiency isworse because of the increase inswitching events. The lowest two oddharmonics that aren’t suppressedoften are strong and may approach(but rarely exceed) the fundamentalamplitude. Low-pass filtering canminimize these harmonics.

To have deep harmonic nulls, thepulse positions and widths must beexactly specified. A 1-µs timing accu-racy is neither excessive nor unrea-sonable at 60 Hz.

Numbering sequences by the totalpulses is convenient. A seven-pulse-per-quadrant solution can be called asteplock-28 and have 56 half-bridgeswitching events.

STEPLOCK SYNTHESIS Figure 2 shows how to synthesize a

steplocked magic sine wave with effi-ciently controlled amplitude. The

waveform has nolow harmonicsthrough the six-teenth. Similartechniques can beused on othersequences toforce any numberof low harmonicsto zero. Someknowledge ofFourier serieswould be helpful.

For more information, check out thetutorial on my web site.

The secret behind a steplock syn-thesis is that each pulse edge controlssomething. Typically it controls anodd harmonic, but it may set yourfundamental amplitude or force someuseful sequence property.

You should work in the first quad-rant to eliminate even harmonics andpick up some other benefits. You’llneed one pulse edge to set the funda-mental amplitude, one edge to cancelout the third harmonic, and six moreto cancel out harmonics 5, 7, 9, 11,13, and 15. Eight edges for four pulsesper quadrant are needed.

This gives you eight messy equa-tions with eight unknowns that canbe solved for the precise pulse posi-tions and widths. During previousforceful testing, I learned that at leastone useful and unique solution oftencan be found.

A simple Calculus 101 lesson tellsyou that any first quadrant unityheight pulse adds to the fundamentalamplitude using:

where α is the start angle in degreesand β is the end angle in degrees. The

amplitude = 4π [cos (α) – cos (β)]

first equation should then simply sumthe four pulses to give the fundamen-tal amplitude. There are similar four-pulse start and end equations easilywritten and set to zero for each har-monic to get controlled. Use termssuch as cos (3α) for your third har-monic, cos (5α) for the fifth, and so onas needed.

These eight equations are ugly. Youmay want to play with them to makethem friendlier. First you’ll want toget rid of those nasty multiple angles.You probably suspect that useful iden-tities are buried in a trigonometrybook somewhere:

cos (3θ) = 4 cos (θ)3 – 3 cos (θ)

cos (5θ) = 16 cos (θ)5 – 20 cos (θ)3 + 5cos (θ)

After using these identities, all that’sleft are zeros, constants, or powers ofprimary angle cosines. Now you cansubstitute x = cos (θ) and similarterms to get rid of the nasty trig andhave eight plain algebraic equationsand eight unknowns remaining.Before solving these though, let’s get abit fancy by driving the…

CHEBY TO THE LEVEE Those multiple angle substitutions

are polynomials or just summed pow-ers of a variable. This particularsequence of polynomials is called firstkind Chebyshev polynomials. You canverify this by digging deep enoughinto any thick math textbook to findthis rare gem:

Tn cos (θ) = cos (nθ)

where Tn is the appropriateChebyshev polynomial of the orderyou need. As you may already know,these polynomials have all sorts ofother uses, including filters and curvefitting. More details can be found onmy web site and in Active FilterCookbook. [1]

A curious Chebyshev property isthat when it is good at something, itmay end up being the best possibleyou can do. So, until proven other-wise, I claim that the steplock synthe-sis shown here is the best you can do

0˚ 30˚ 60˚ 90˚

0˚ 30˚ 60˚ 90˚

0˚ 30˚ 60˚ 90˚

a)

b)

c)

Page 62: cc_2001_07-132

62 Issue 132 July 2001 www.circuitcellar.comCIRCUIT CELLAR®

in terms of the maximum har-monic cancellation for mini-mum pulse edges and switch-ing events. Hence, it’s themost efficient.

You need to know littleabout Chebyshev polynomi-als. T0 is defined as 1 and T1 isdefined as x. The rest of theterms can be found by usingthis cute recursive formula:

(next term) = 2x (currentterm) – (previous term)

In steplock magic sinewaves, you are usually inter-ested only in odd Chebyshevterms, because you are seek-ing odd harmonic control.Substituting Chebyshev forthe angle reductions gives thesuperbly compact first equa-tion in Figure 2.

Many fancy PC math pack-ages provide Chebyshev capa-bilities and work directly with equa-tions of this type. But, you can furtherreduce the equations to an astound-ingly and elegantly simple format.Any time you have a pile of equa-tions, you can add or subtract multi-ples of the individual equation linesto each other without changing theirvalidity. Doing so leads to the simplepower expressions of the second equa-tion in Figure 2.

Often, equations like this are bestsolved by starting with a good guessand then incrementally “shaking thebox” to get a closer answer. Because afundamental amplitude error is a dif-ferent animal than a harmonic zeroerror, it’s best to minimize harmonicsfirst and then try again.

For instance, suppose you’re tryingto get a 0.4000 amplitude and end upwith a harmonically zeroed 0.4004amplitude. You would then ask for a0.3996 and retry. Note that this ployrapidly converges.

VARIATIONS ON A THEME Because real sine waves don’t have

a hole near their crests, you can alsoforce an odd number of edges perquadrant. The two leftover edges canform a (usually) wider pulse bridging

90° or 270°. To do so, end your finalpulse at 90° and let the adjacent quad-rant pulse abut.

You also could skip selected har-monics or force them to nonzero val-ues, possibly for channel distortion orto handle an oddball resonance prob-lem. I guess you could even playmusical chords!

Table 1 shows a normalized 0.57-amplitude example for a steplockedmagic sine wave. Other examples ofdifferent kinds of steplocked magicsine waves are available on my website. A steplock-24 solution ofFigure 2 for six pulses per quadrantresults in the best efficiency.

You may also create steplockedmagic sine waves whose pulses endup more evenly spaced. This costsyou control of one odd harmonic, butis more like the PWM signal, has amore obvious carrier, and can helpyou develop your upcoming three-phase, delta-friendly solutions.

Useful choices for your amplitudeincrements are 100 or 256 steps, butkeep in mind that nearly any ampli-tude set can be used. In addition, youcan work in constant power incre-ments by selecting the square root ofyour forced amplitude.

BECOMING DELTA-FRIENDLY

The real world may placeanother limit on steplockedmagic sine waves. Most largeindustrial motors are three-phase; you wouldn’t want torewire existing motors or usesix power half-bridge drivers ifyou need only three.

I define a delta-friendlymagic sine wave as one thatlets you control unmodified,three-phase motors. Moststeplock sequences are notdelta-friendly! Becoming delta-friendly involves some off-the-wall concepts, but it can bedone using a few carefullyselected steplock sequences.The price is your ability tocontrol a few less harmonicsthan optimal. Plus there arefewer sequence choices.

Before continuing, let’sbriefly review delta friendli-

ness. When you connect a three-phasemotor to three SPDT switches, youhave only eight switch states. For agiven winding, the possible combina-tions can only result in your forcingthe individual (ABC) winding currentsof (000), (0+–), (0–+), (+0–), (+–0), (–0+),(–+0), or (000) again.

Now, phases A, B, and C will be120° apart. But B is also where Ashould end up in time 120° later. AndC is now where A will be in time240° later. So, you can conclude thatthe third harmonic of any narrowsample of a delta-friendly waveformalways must be zero.

Note that this rule is more restric-tive than simply generating a wave-form whose third harmonic averagesto zero over a cycle. You can’t robPeter to pay Paul. Reflecting this needin the first quadrant should give youthese two wondrously obtuse rules:

• If there is zero energy in any narrowsample x in the 60° to 90° range, therealso must be zero energy in samples(x – 60) and (120 – x).• If there is one energy in any narrowsample x in the 60° to 90° range, theremust be one energy in one but notboth samples (x – 60) and (120 – x).

Desired amplitude 0.57Actual amplitude 0.569999Actual power 0.324899Distortion 2H-22H 0.00096016%First strong harmonics 23 and 25Pulses per sine cycle 24Total switching events 48Delta-friendly No

P1 Start: 5.1278 End: 6.2655 Delta: 1.1377P2 Start: 20.1049 End: 23.2776 Delta: 3.1727P3 Start: 34.1831 End: 39.2932 Delta: 5.1101P4 Start: 48.423 End: 55.1945 Delta: 6.7715P5 Start: 62.9925 End: 71.0116 Delta: 8.0191P6 Start: 77.9668 End: 86.6674 Delta: 8.7006

H3: -7.10092 × 107 H21: -3.80407 × 106 H21F: -1.81146 ×107

H5: -3.6481 × 106 H23: 0.803194 H23f: 0.0349215H7: -5.7061 × 108 H25: -0.440767 H25f: -0.0176307H9: 4.65998 × 106 H27: -0.169326 H27f: -0.00627134H11: 4.11531 × 107 H29: -0.0100077 H29f: -0.000345094H13: 5.11062 × 106 H31: 0.0125276 H31f: 0.000404115H15: -2.63622 × 106 H33: 0.0149846 H33f: 0.00045408H17: 2.2086 × 106 H35: 0.0162002 H35f: 0.000462862H19: 2.01816 × 106 H37: 0.0174321 H37f: 0.000471138

Table 1—This steplock-24 normal magic sine wave is not delta-friendly.Harmonics 2 through 22 are almost 0. The first major harmonics are thetwenty-third and twenty-fifth. Harmonic amplitudes are relative to the funda-mental. Filtered f harmonics assume a filter of an integrating, or 1/H or 1/fresponse. A 0.001° or better timing accuracy is required.

Page 63: cc_2001_07-132

REAL TIME

KNOWLEDGE

FREE YOURSELF!EEGLOBE.COM

NEURAL-EDGE KNOWLEDGE TECHNOLOGY ™

Page 64: cc_2001_07-132

64 Issue 132 July 2001 www.circuitcellar.comCIRCUIT CELLAR®

The reasoning behind theserules is obvious when youdraw the first quadrant of awaveform’s third harmonic. Ifthere is no negative 3H ener-gy present, there should be nopositive energy. On the otherhand, if there is somethingnegative, it must be canceledby an equal positive that canlie in either but not both ofthe two positions on eitherside of the first 3H crest.

One way to gain deltafriendliness is to start with anormal or equally spacedpulse sequence. Then, youcan carefully shift and some-times split the narrowest andmiddle pulses so you obeythe above rule. To visualizethis, you can copy Figure 1band fold it forward at 60° andback again at 30°. Then, holdit up to a strong light andlook through it.

Note how the pulses on the firstand second folds sum to match the

pulses on the third fold. Again, if youhave energy on fold three, you must

have energy on only one ofthe first two folds.

From this visualization, youcan easily derive which edgeswill have to track each otherto pick up delta friendliness.Note that your first fold puls-es should track in the samedirection as the third, andyour second fold pulses trackin the opposite direction.

Mathematically, to create adelta-friendly steplock-28, youcould start by using 14 edges.You then lock seven of thoseedges so that your trackingpulses automatically force therules. For instance, the start ofyour first pulse would getlocked to the start of the sixthpulse minus 60°.

To force delta friendliness,apparently you have to wasteseven of your available edgesand seven of your equationvariables. But these same

seven edges also conveniently cancelout all triad harmonics 3, 9, 15, 21,

Problem:Create a minimal pulse steplock sequence that generates a fundamental sine waveof 0.53 amplitude but has zero harmonics through the sixteenth.

Solution:By working in quadrants, all even harmonics will automatically be forced to zero.Eight pulse edges are needed to control the fundamental and first seven odd harmonics (3, 5, 7, 9, 11, 13, 15) for eight equations and eight unknowns.

Write the eight harmonic equations using Chebyshev polynomials:

T1(P1S) – T1 (P1E) + … + T1 (P4S) – T1(P4E) = 0.53 × T3(P1S) – T3 (P1E) + … + T3 (P4S) – T3(P4E) = 0 T5(P1S) – T5 (P1E) + … + T5 (P4S) – T5(P4E) = 0 [1]

… … … T15(P1S) – T15(P1E) + … + T15 (P4S) – T15(P4E) = 0

Where P1S is the cosine of the first pulse start angle, P1E is the cosine of thefirst pulse end angle, T1 is a first-order Chebyshev polynomial (used to define the fundamental), T3 is a third-order Chebyshev polynomial (used to define the thirdharmonic), and so on. π/4 is a Fourier series amplitude scaling factor.By adding or subtracting previous line multiples, the equations can be reduced to this elegantly simple form:

(P1S)1 – (P1E)1 + … + (P4S) – (P4E)1 = 0.53 ×

(P1S)3 – (P1E)3 + … + (P4S) – (P4E)3 = 0.53 × [2] (P1S)5 – (P1E)5 + … + (P4S) – (P4E)5 = 0.53 ×

… … … …

The solution of these equations using my fast and simple PostScript iterativeapproximation procedures gives you degree values:

P1 start: 17.9125 P1 end: 21.4007P2 start: 36.1121 P2 end: 42.7902P3 start: 54.8818 P3 end: 64.1028P4 start: 74.4503 P4 end: 85.1345

163π

325π

Figure 2—Check out the math involved in steplock synthesis.

They know the rightBIOS is key to the

success of embeddeddesigns—and configurabilityis key to the right BIOS.

That’s why AMD, Intel,and STMicro ship GeneralSoftware’s Embedded BIOSpre-installed on theirembedded platform evalua-tion boards.

With over 400 configura-tion options, EmbeddedBIOS offers the advancedconfigurability you need torun your custom targetenvironment without editingthe core BIOS source code.

Contact us today fordetailed information and afree sample BIOS binary foryour standardreferencedesign.

What do the leading siliconvendors know about BIOS?

© 2000 General Software, Inc. All rights reserved.

Embedded BIOS™

ADAPTATION KIT:Full source code automaticallyconfigured with over 400 para-meters using BIOStart™ expertsystemCORE BIOS FEATURES:ROM/RAM/Flash disks, Setupsystem, console re-direction,manufacturing mode, WinCEloader, configurable PCI, inte-grated debugger, modular calloutsto chipset, board, and CPU-levelmodulesCHIPSETS:ALI—Aladdin V, FinaliAMD—186, SC300, SC400, SC520INTEL—386EX, 430HX/TX, 440BX, 810, 840NSC—Geode GXm, GXlvServerWorks—ServerSet III HE/LESTMicroelectronics—STPC family

IDEAL FOR:Windows 95/98/CE/NTEmbedded, Linux, DOS, and allx86-based operating systems

www.gensw.com •[email protected] • 800-850-5755 • 425-454-5755

Page 65: cc_2001_07-132

www.circuitcellar.com Issue 132 July 2001 65CIRCUIT CELLAR®

SOFTWARESteplocked magic sine wave cata-logs and calculators are available atwww.tinaja.com/magsn01.html.Send an e-mail to request addition-al support, software, source code,and consulting services.

REFERENCED. Lancaster, Active FilterCookbook, Synergetics Press,Thatcher, AZ, September 1996.

Author’s Note: Many thanks to math-ematician Jim Fitzsimmons for hisvaluable contributions to thesteplocked magic sine wave concept.

Microcomputer pioneer DonLancaster is now the author of 35books and countless articles. Donmaintains a technical help line, (520)428-4073, and provides consultingservices. He is the webmaster of hisGuru’s Lair at www.tinaja.com. Youmay reach him at don@ tinaja.com.

27, 33…. In the steplock-28 example,this leaves seven edges. You use oneedge to set your fundamental and sixto cancel out the remaining odd har-monics 5, 7, 11, 13, 17, and 19. Youstill have 14 equations and 14unknowns, and the usual “shake thebox” solution approach still applies.Half of the equations are now simpler.

Certain delta-friendly solutions canintroduce other problems such astriad suppression, which interfereswith one of your carrier harmonics.The best catalogs I’ve found demandan odd number of pulses per quadrant.

SOME MORE HELP A PIC microcomputer seems ideal

for steplock magic synthesis. Youstore the start and length of eachpulse in an internal table. The tablecan be modest; a steplock-24 mightrequire 26 bytes per amplitude. Onequadrant worth of pulses might getgenerated by suitable switching andtime delay routines. That quadrant ismirrored for the second, and the pairis flipped for the third and fourth.

For single-phase uses, you wouldoutput to a pair of half-bridge powerdrivers. Making the left driver highand your right one low should forcepositive current into the load for allpulses in the first 180°. Making theright driver high and the left lowforces negative current into the loadfor the other half cycle.

You can set both drivers high orlow to get a zero current. Your choicedepends on what will happen. Pickthe one that gives the fewest totalswitching events. The timing neededto cancel out harmonics has to be pre-cise; I recommend an accuracy of atleast one part in 30,000. Your range ofdeep harmonic cancellations ends upbeing infuriatingly narrow. You canjitter your timing during analysis topin down the suppression limits.

Frequency or speed is set by overalldelay times. To allow sane clock fre-quencies, magic sine waves arerestricted primarily to power and lowaudio frequencies.

I also recommend setting any vari-able speed or frequency external to

your generating PIC, perhaps byphase-locking the clock. I

!"#$%&'()*+,-. /0 ,+1 /2( 2343)562!1 30+"37' 58/9$:58 1.. 9-$;'(1-$; - +. +

'0 4(7 <'3 4. =5>/? =5>/ 4 '@@

Page 66: cc_2001_07-132

66 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

very time I needto cheaply send

data via wireless link,I forget that most manu-

facturers of low-end RF transmittersand receivers can’t be bothered withcircuitry that will actually get datatransferred. Isn’t that what they’resupposed to do? Of course it is. But,you can’t cut a hardwired communi-cation link, stick in any old RF trans-mitter and receiver pair, and expect toresume the same virgin transmission.

Perhaps I’m being harsh, but low-end RF pairs play around in the ana-log domain. For these, the modulationof choice is OOK or OOSK (on or offshift keying). Although sensitivity forOOK is high (the greatest differencebetween no modulation (0) and fullmodulation (1)), just when is areceived carrier sufficient?

In other modulation techniques thecarrier remains on whenever data isbeing sent. The data is embedded as afrequency, phase, or amplitude changeas opposed to OOK. And, the receiversensitivity is significantly less, whichmakes these differences more difficultto detect. But I digress.

Digital signals are considered to begray if they are not at VCC or Gnd. Inthis gray area, you can’t be sure

whether a logic device will see thedata as a 1 or 0. Hysteresis can beused in circuitry to force or hold dataoutput high or low as its input transi-tions through the area. This is accom-plished by assigning different switch-ing points to the rising and fallingdata signals. A couple of comparatorscan be used to give a signal hysteresisby forming a window comparator.The further apart these switchingpoints are, the wider the hysteresisband becomes. A changing input sig-nal won’t affect the output unless ithas risen above or fallen below thedesigned values (see Figure 1).

With analog circuitry, such as thatused in RF transmitters and receivers,the signals don’t necessarily play fair.The maximum signal excursion maynot be 5 V. To be able to assign digitaldata values to these analog signals,you must sometimes use dynamicmeans. Translation: Find the averagesignal value on the fly. Then youmust compare this dynamic value tothe live analog signal to determine anarbitrary logic state. The point here isthat, because this is dynamic, youcan’t know when an input is givingyou a bad signal (noise) or a good sig-nal (data). (Unless, of course, youforce the dynamic level to a knownstate and look for specific data.)

If you force the transmitter to senda 50% duty cycle transmission (pre-amble data), and the receiver’s averag-

FROM THE BENCH

Sendingdata viawirelesslink canbetricky.

Although there are noguarantees with anRF connection, Jeffsays the keys to suc-cess are asking theright questions andknowing your system.

Jeff Bachiochi

The Missing (Wireless)Link

e

Photo 1—Here's the prototype transmitter and receiv-er interfaces I built for a one-way transmission path.The Ming modules can handle ~2400 bps.

Page 67: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 67

ing circuit is designed with a capaci-tor sized to hold its charge for at leastx cycles, the dynamic level willremain constant. Based on this level,it’s easy to compare against thereceived signal and determine appro-priate logic output.

What happens with bad signals?The dynamic level will adjust to noiseand the output will again change butwill be based on the noise. At thispoint, squelch circuitry might be usedto disable any output when dynamiclevels are too high or low. This is notthe case with many low-end receivers,so it will cause havoc because it isnormally connected to some kind ofdecoder or UART. Although a gooddesign will reject all of this data (notformatted correctly), the randomnoise can occasionally create a gooddata byte. So, how can you make sureyou handle only the really good data?

PACKETIZINGWhen sending snail mail or e-mail,

the delivery service doesn’t necessari-ly know what’s in the envelope orpacket. The envelope accomplishesone thing, it protects your data andprovides a delivery scheme. Whenyou’re designing a delivery system fordata, you can use packetizing to helpmove the data. I’ve previously men-tioned a preamble. This is the firstpart of the packet you will define.

To send out an alternating patternof ones and zeros, a string of Us canbe sent. The U character has a bit pat-

tern of 01010101. A UART transmis-sion of a start bit, the U character(LSB first), and stop bit have a patternof 0101010101. This pattern will con-tinue uninterrupted with additionalUs being sent (assuming one stop bit).Assuming that the receiver requires xtime to get its hysteresis set correctly,the receiver’s UART may or may notbe in sync with the transmitter’s startbit (first 0 bit) of its U character trans-mission. In fact, it’s more likely thatone of the other 0 bits in the trans-mission will be seen as a start bit tothe receiver’s UART. So, although thereceiver will eventually receive the Ucharacter, most likely it will not be insync with the transmitter. How canyou get the transmitter in sync withthe receiver?

Well, a synchronization characterneeds to be sent by the transmitter.This is the second part of packetiza-tion. The only character you can sendthat will guarantee synchronization isthe character with all ones. The FFhcharacter contains a start bit (0) alongwith eight 1 bits (plus a 1 stop bit).Independent of which zero the receiv-er has used as a start bit, after itbegins receiving the ones of the FFhcharacter, it will not start a new char-acter until the next start bit. After thecharacter that’s not in sync finishes,the remaining ones of the transmittedFFh character will look like additionalstop bits and the receiver will wait forthe next start bit. Now the receiver isin sync with the transmitter.

Data received by the receiver’sUART can now be considered good. Ichose to require a null character (00h)to follow as a signal that this is actu-ally the beginning of a packet. Thischaracter helps to balance the previ-ous FFh character and also acts as acheck to make sure you didn’t get tothis point by accident (via randomnoise). The null character is not partof the data message being transferred,just part of the wrapping to ensuredelivery. Now you can be sure thatthe receiver is listening to good data,is in sync with the transmitter, andready for the message data to be sent.It’s important to note that the actualmessage transmitted should maintainthis 50/50 balance between ones andzeros to retain a constant dynamicvalue. However, most data will notnaturally have a 50/50 balance.

BALANCED TRANSMISSIONThere are some fancy ways to trans-

late characters into data with a bal-ance of ones and zeros. The simplestway might be to count the ones andzeros of a message and pad the end ofthe message with bogus data to evenout the bits. This has potential prob-lems because the data may containlong groups of consecutive ones orzeros (run length). Although averagedover a message to a 50/50 balance, thedynamic level will wander and poten-tially create inaccurate decoding.

To reduce run lengths, treat themessage on a byte-by-byte basis. Withthis in mind, a simple approachwould be to complement each bytesent. Using this approach the longestrun length would be nine. Here youtrade off doubling the data sent toensure both a 50/50 bit balance and amaximum run length of nine. Toimprove this idea even further, treatthe message on a bit-by-bit basis bycomplementing each bit as opposed toeach byte. This improves the runlength to a maximum of two.

In addition to the ability of thereceiver’s code to reject malformedpackets, it can also reject bad messagedata. Because each message byte con-sists of two transmitted bytes of com-plemented bits, the receiver’s codecan reject any packets that contain

VREF = 0.5 VCC

VCC

Gnd +

Input

R21

Output

U1

VCC

VREF = Half peak detector voltage

VCC

Gnd +

–Output

U2

VCC

VCC

VCC

R22

Gnd

Gnd

R12

R10

R11C9

Input

VREF

VREF

Figure 1—Without a dynamic level control circuit, (a) will miss levels below the threshold set by the resistor divider(0.5 VREF). Using a dynamic level control circuit, (b) will adjust the VREF level based on the input.

a)

b)

Page 68: cc_2001_07-132

68 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

DUPLEXINGMost message transmission sys-

tems are half-duplex (i.e., data istransferred in only one direction at atime). This system is simplified fur-ther by designating a single node asthe master while all other nodesbecome slaves. No slave is allowedto initiate a message. The masternode must request a message from aslave for it to respond. This systemallows for many slaves to be part ofthe system without increasing thepossibility of unwanted interference.Because each node must be able to

receive and transmit,the node cost is alsohigh.

When a systemrequires transmittingdata to or from a sin-gle node (data onlyneeds to be sent inone direction), thenode cost is cut inhalf. This design canalso work for multi-ple data senders ifyou can keep all ofthem silent while asingle node is send-ing.

Sounds easy, does-n’t it? The problem isgetting the senders tostay in sync so they

second way is to use flow control ofthe message input. The easiest wayis with hardware flow control. Whenthe input buffer is about to be filled,signal the sender to cease sendingdata. When the buffer is empty, sig-nal the sender that it may continue.This control is built into most serialports and, when enabled, is automat-ic. The serial port monitors its CTSinput and halts further transmissionswhen it’s disabled. When messagesare guaranteed to be shorter than thebuffer size, flow control can be disre-garded.

message data not conforming to thecomplement rule. This can be used aserror checking on the received mes-sage data. You should also note that itis the responsibility of the receivingequipment to handle error checkingon the received message as a whole. Ibelieve no data is better than poten-tially bad data, so I chose to imple-ment this algorithm and dump pack-ets with bad complement data.

MESSAGE LENGTHVery few transfer protocols allow

infinite length messages. When multi-ple transmitters share the same medi-um, you shouldn’t hog that medium.Therefore, messages are usually limit-ed in size. This may, in fact, be limit-ed by the hardware used. Small sys-tems may be limited to a few kilo-bytes of RAM and micros may haveonly a handful of RAM. This RAMmust be shared between the systemvariables and the transmit and receivebuffers. In an ideal world, the packetmessage being transmitted wouldkeep up with the message beinginputted. Because the number ofpacketized message bytes actuallytransmitted can be more than twotimes the number of message bytesinputted, something’s got to give orelse the output clogs up quickly.

One way to prevent this is to beable to transmit at a faster transferrate than the input receives bytes. A

IF INV==0BCF GPIO, SOUT; clear the serial output bit

ELSEBSF GPIO, SOUT ; set the serial output bit

ENDIF

And the bit test (in the receive PIN)

IF INV==0

BTFSC GPIO, SIN; test the serial input bit and skip the nextinstruction if clearedELSEBTFSS GPIO, SIN; test the serial input bit and skip next

instruction if setENDIF

Listing 1—The use of conditional assembly statements allows your code to be assembled with differentparameters based on a constant’s value preset at the beginning of your code. At the time of assembly,the conditional statements grouped under the matching constant are substituted automatically and alter-nate conditional statements are overlooked.

Figure 2—IC1 receives packets from the RF transceiver anddecodes them into data output to the RS-232 transmitter. When it’snot busy, IC1 allows IC2 to packetize and send the data to the RFtransceiver it has received via the RS-232 receiver. Two inter-processor control lines assure half-duplex operation as required bythe transceivers (i.e., the Linx Technologies SC series).

Page 69: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 69

can share the ether. No matter howquickly each node sends its data, ifthe nodes transmit randomly or atfixed intervals, they will eventuallytransmit at the same time and tram-ple one another’s signal. If you thinkabout this a bit, you will see how thispossibility goes up dramatically asthere are more and more senders. Youcan live with missing a message nowand then, you say? Just remember,you won’t be able to predict whenthis will happen.

HOW LOW CAN YOU GO?Is there a way to keep cost down

and still handle both two- and one-way transmissions? This projectattempts to handle both situationswhile keeping cost to a minimum. Ichose to design with Microchip’sPIC12C508 because it’s inexpensive.Its 8-pin package can have up to sixI/Os as a result of its optional internalRC oscillator. Keep in mind that theinternal oscillator is factory-trimmedvia an OSCCAL value preprogrammedinto the device. This value has beenadjusted for 4-MHz operation withVCC equal to 5 V at 25°C, and is volt-age- and temperature-dependant. Thisvalue can be adjusted slightly to com-pensate for operation at other voltagesand temperatures. Actual operatingfrequency is only critical for time-dependant operations (i.e., as a soft-ware UART). This device contains nohardware UART nor interrupt ontimer overflow, so creating a softwareUART is not easily achieved, especial-ly at higher transfer rates.

Figure 2 shows how I used two12C508s as separate transmitter andreceiver protocol interface nodes(PIN). To assure half-duplex operation,I gave each node an interprocessor

communications channel. Essentiallythis prevents a message from beingtransmitted while a message is beingreceived (preventing full-duplex opera-tion). Full-duplex operations would beallowed only if the transmission andreception paths were different. In awired network, this means separatewires for each path. In an RF link,this means different frequencies orchannels for each path.

In this design, the transmit PINrequests permission to transmit viathe TXREQ line. The receiver inter-face acknowledges this via the TXENline if it’s not busy with a data recep-tion. When the transmitter interfaceis used alone where data needs to goin only one direction, its TXREQ out-put must be tied to its TXEN input.This signal also can be used as an RFtransmit enable when necessary.Hardware handshaking is provided tothe source of the transmit messagewhen long messages must be sent. Atransmission is requested when thePIN’s buffer is full or isn’t empty anda character hasn’t been received fortwo character times. The timeoutsends a partial buffer without requir-ing a special character (i.e., <cr>).

This design uses the same transferrate for the data in and data out sidesof the PIN. This should be matched tothe ability of the RF transmitter.However, there is no rule that saysthe data inputs and outputs need tobe identical rates. In this design, theserates cannot be a user option (exceptat code assembly time) because all ofthe I/Os are used. Remember to payattention during powerup to thetransmit to transmit times and trans-mit enable to transmit times of yourparticular RF transmitter. Thesedelays must be met before beginning

Figure 3—Herethe PIC12C508handles the packetdata from the MingRX-66 receivermodule. While idle,the transmitter mayoutput noise. ThePIC’s softwaremust be able tostrain the datapacket out of thenoise soup.

Page 70: cc_2001_07-132

70 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

any transmissions or you’ll end uptransmitting only a partial packet.

The receive PIN constantly listensfor RF receptions and polls theTXREQ line to learn if it must relin-quish control to the transmit PIN. Ifit’s not busy receiving an RF trans-mission and the transmit PIN isrequesting control, the RXEN outputis disabled and control is granted tothe transmit PIN via TXEN. Whenthe transmission is complete, thetransmit PIN gives up control by dis-abling the TXREQ line. The receivePIN acknowledges this by disablingTXEN and enabling RXEN.

Another reminder: Pay attentionduring powerup to the receive toreceive times and receive enable toreceive times of your particular RFreceiver. This is important for thetransmitting node because this is theminimum time between messages orthe minimum delay before the receiv-er will be ready.

Because the receive and transmitbuffers are of identical size, there’s noway for a transmit PIN buffer to sendtoo much data to a receive PIN buffer.However, because you’re dealing withtwo software UART routines in eachPIN, each device will do tasks sequen-tially. Each will receive a messagefrom a host and then send a packet tothe RF transmitter, or receive a pack-et from an RF receiver and then senda message to a host. If a transmittingnode must send multiple messagesback-to-back, it must be aware of thereceiver’s ability to get rid of the lastmessage and prepare for the nextpacket. Although data manipulationis similar at each end, to be safe, ashort delay is recommended between

transmission packets. Hardware hand-shaking can automatically add a delayto ensure that the receiver has hadadequate time for full reception of thepacket and retransmission of the mes-sage data to its host device.

CODE BITSWithout a timer interrupt, you

must pay close attention to the timervalue to keep timing as accurate aspossible. The minimum loop to readthe timer, test for zero, and jumpback is four execution cycles. If thetimer changes with each executioncycle, you may never see a timervalue of zero with the read timer0instruction (MOVF TMR0,W) becauseit may occur during one of the otherinstructions. If the timer0 prescaler isdivided by four, the timer value willnot change for four instruction cycles.This assures that when it’s read, itwill remain at zero for each instruc-tion cycle of the loop.

This creates a potential problemwith the resolution. You can be sureof timing accuracy only within plusor minus three cycles. At 9600 bps,the bit time is 104 µs. Assuming aninstruction cycle time of 1 µs (4-MHzinternal RC), you might be anywherefrom 101 to 107 µs (9901 to 9346 bps),or ±~ 3%. This may not be enough tobe out of specs with UART tolerancesalone, but with the addition of thesystem clock tolerances, it could be ofconcern. With faster rates it becomesmore of a potential problem.Although with slower rates, becausethe error is a smaller percentage ofthe rate, it is less of an issue.

Using conditional assembly instruc-tions within your code can be of help

Figure 4—In this configuration, the PIC12C508 handles a Ming TX-66 transmitter module for a simple one-waytransmission. Hardware handshaking can be used on the transmitter interface when you need to have flow controlto prevent data overruns.

Page 71: cc_2001_07-132

M I C R O C H I PP L A N E T

www.microchip.comExplore the Universe of EmbeddedControlThe Microchip name and logo, PIC, PICmicro, and The Embedded Control Solutions Company are registered trade-marks of Microchip Technology Inc. in the USA and other countries. © 2001 Microchip Technology Inc. All rightsreserved. All other trademarks are the property of their respective owners.

Now, with our extensive analog portfolio,including TelCom Power Management, ThermalManagement,Linear, Interfaceand Mixed SignalICs, Microchip gives you the analog solutionyou need to blast your designs into the future.Combined with the popular PICmicro® micro-

Microchip Adds 250 Analog Products

1-888-MCU-MCHP 1-888-628-6247

controllers, memory devices, innovative devel-opment tools, technical training and experi-enced applications support and you have acomplete product solution from Microchip.Whole Product Analog solutions–one morereason to explore the Universe of EmbeddedControl. Call or visit our website today toreceive your Analog PowerPak.

Page 72: cc_2001_07-132

72 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

when programming for options at thetime of assembly. In this application, Idefined the polarity of the two serialinterfaces such that I could haveeither normal serial levels for inter-facing directly to a micro’s serial port(or through a pair of RS-232 levelshifters), or inverted levels for inter-facing directly to a PC that will sup-port TTL signals (eliminating the RS-232 interface chip). A program vari-able, INV, is set to 0 for normal serialand 1 for inverted serial. Throughoutthe remainder of the program, IFINV==0, ELSE, and ENDIF statementblocks are used, which define thestate of an I/O pin in the transmitPIN (see Listing 1).

When assembled, these blocks pro-duce only one instruction dependingon the state of the defined variable,INV. The other instruction is thrownout, but the source code retains theoptions should you decide to changeINV and reassemble the code. The RFserial interface uses the same kind ofoption, meaning it can be easilymatched to the needs of the RF trans-mitter or receiver.

ONE-WAY STREETWhen used with low-cost transmit-

ters and receivers like the TX-66 andRX-66 from Ming Microsystems, thecurrent draw is so low that the RFdevices can be powered directly bythe ’508’s output pins (see Figures 3and 4 and Photo 1). The frequency ofyour RF devices governs the durationof the transmissions. For thesedevices (300 MHz), the FCC saysthat, in addition to radiated powerlimits, manual transmissions can’texceed 5- s. Periodic transmissionsare not permitted, however, whenused for integrity checking of securi-ty or safety systems. Alarm condi-tions are allowed during a life-threat-ening emergency and transmissionsare allowed when limited to 1 s/h.

It is interesting to note that theFCC excludes the requirement forproduct testing for compliance of anycircuit built (not from a kit) by a hob-byist for personal use (provided thatgood engineering practices are used).I’m talking about a respect for person-al freedom here, however, you can

depend on them to uphold the person-al freedom of others if you causeinterference outside of the home.

ONE LAST THOUGHTI’ve presented some of the things

you’ll need to think about whendesigning in an RF connection. Whenthe wire is cut, RF communicationbrings with it a multitude of prob-lems. The medium is no longer underyour direct control. You may have lit-tle or no control over how the envi-ronment will affect your preciousdata. You need to spend a good deal ofyour time investigating how your sys-tem responds to data, or the lack of it.How will range and noise affect thedata you are trying to pass from pointA to point B? What techniques willyou employ to ensure data integrity?

It is fairly clear that the RF spec-trum is only going to get more crowd-ed in the future. At least manufactur-ers are beginning to talk about com-patibility and interference issues.This can only help bring access tomore user-friendly solutions. Andwith increased use, there’s sure to below-cost, powerful solutions. I

Jeff Bachiochi (pronounced BAH-key-AH-key) is an electrical engineer onCircuit Cellar’s engineering staff. Hisbackground includes product designand manufacturing. He may bereached at [email protected].

SOURCESSC series RF transceiverLinx Technologies, Inc.(800) 736-6677Fax: (541) 471-6251www.linxtechnologies.com

PIC12C508 8-pin microcontrollerMicrochip Technology Inc.(480) 792-7200Fax: (480) 792-7277 www.microchip.com

TX-66 RF transmitter, RX-66 RFreceiverMing Microsystems(626) 961-0323www.ming-micro.com

Page 73: cc_2001_07-132

To request a free conference catalog or to register:

www.embedded.com/esc888-239-5563 • [email protected]

Develop Your Skills and DiscoverPractical New Solutions at ESC Boston

With more than 80 classes, including 20 new topics, you can customize atechnical program to address the specific embedded technologies you’recurrently using or evaluating. Classes are designed for working engineers,and emphasize practical solutions that can be put to use as soon as youreturn to the office.

Attendees also have unlimited access to the 3-day exhibition, featuringmore than 160 companies, to evaluate new products and vendors. Checkout our web site for detailed class descriptions, the complete event sched-ule, conference packages, and online registration.

What You’ll learn:

• 25 Common Mistakes in Real-Time Software Development,

and How to Avoid Them

• How to Design an Efficient Wireless Appliance

• Security Methods for the Embedded Internet

• How to Use UML Effectively

• Efficient Code to Increase the Performance of DSPs

• Project Management in the Embedded Development Environment

September 4–7, 2001Hynes Convention Center

New dates

Larger Show Floor

Expanded CourseOfferings

20 New Classesand Tutorials

46 Industry ExpertSpeakers

See the latest productsand technologies frommore than 160 leading

companies

Network and exchangeideas with other developers and

vendors

Sponsored by:

priority code:CC

Page 74: cc_2001_07-132

74 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

ast summer Imoved into a new

house. It’s been quitean adventure, a combina-

tion of The Grapes of Wrath and “TheMoney Pit.” It’s great to own a brand-new house as opposed to a fixer-upper, but that doesn’t mean therewon’t be issues, just different ones.

Case in point, as summer came toan end, I concluded that the buildershad managed to connect a toilet tothe hot water line. With a fall chill inthe air, I found myself wondering ifthis was a new feature, kind of likeheated seats in luxury cars.

As a former pool owner, I had seenthe unfavorable effects of tepid waterwith all the hazards of a breedingground for who knowswhat. So I presumed thatafter centuries of using atried-and-true design, ifconnecting hot water wasa great idea, it would’vebeen done already. Well,a few more cold nightsyielded complaints fromthe kids that the upstairsfurnace wasn’t working.

Hauling out a ladder, Iventured up to my attic.There’s the furnace, but

what’s this? It’s blinking at me. Therewas a lamp peeking out the side ofthe furnace repeating a two-digit,blink-pause-blink code of some kind.

Grabbing for the furnace manual(thoughtfully stuck in a rafter), Iquickly found the translation: “Openthe gas valve, you dummy!” Afterpeering into the dark recess behindthe unit and tugging aside some insu-lation, that’s just what I did.

Inevitably I would’ve checked thegas connection (i.e., whether or not itwas plugged in), although I’ll bet youraverage furnace repair person has goneout on just such a call. Nevertheless,it was reassuring to have the furnaceconfirm the diagnosis, enough so thatI felt confident reinstalling the atticaccess door as I climbed down.

A number of the furnace troublecodes deal with more significant prob-lems and the manual offered somepossible solutions to try (e.g., cyclingpower). Even more useful, some of thetrouble codes are so explicit, theyhelp you decide immediately if you’llfix it yourself, call a repair service, orbuy a new furnace before nightfall. Iappreciated this relatively high-techfeature and suggest that the least youcan do is consider designing in a sin-gle LED for even your most deeplyembedded designs.

Moving up the pecking order of dis-plays, you find the one- to many-digitvacuum fluorescent and LED displays.These can range from relatively cheapsingle-digit, seven-segment units tolarger, fancier dot matrix displays.However, as you move up the sizeand features scale, the price andpower consumption can quicklybecome problematic.

SILICONUPDATE

Tom Cantrell

Liquid Crystal Delight

lYou haveto love aproductthat has“easy” built

right into the title.Aptly named EasyGUI, from AmuletTechnologies, may bethe answer to yourprayers for a simplesolution for middle-of-the-road LCDs.

Photo 1—The Amulet Easy GUI Starter Kit ($399) includes everythingyou need to craft your own 1/4 VGA touchscreen display.

Page 75: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 75

WORKING GLASS HEROThis brings us to the LCD. At the low end, enjoying near com-

modity status, are 1 × 16 (one line of16 characters) to 4 × 40 alphanumericunits that go back several years, basedon a controller chip originallydesigned by Hitachi. The fact thatHitachi was once a second source forMotorola micros is seen in the 6800-type interface (E, RS, R/*W, etc.) thesemodules employ.

Meanwhile, high-end embedded PCapps can take advantage of the won-derful VGA-and-beyond LCDs foundin laptop computers. The beauty ofthis approach is that you can use yourfavorite desktop software develop-ment tools without having to writeany specialized display drivers.Because both the target and desktopsystems are PCs, it’s the ultimateWYSIWYG approach.

However, there are a ton of applica-tions that need more than a few linesof text, but don’t need (and can’tafford) the overkill of a full-blownembedded PC.

If you’re a big-shot customer, I sup-pose you could buy a truckload of rawglass and hack together a bunch ofdriver chips and low-level software tomake it do something useful. Anotheridea is to draft some consumer elec-tronic gadget such as a PDA,GameBoy, or even a hand-held TVinto double-duty as a display.

QUARTER HORSEWhat the world really needs is a

fully integrated, easy-to-use solutionfor middle-of-the-road LCD displayapplications. That’s exactly whatAmulet Technologies aims to deliverwith its aptly-named Easy GUI pack-age of chips, boards, modules, andsoftware tools (see Photo 1).Configurable to support a variety ofpanels and resolutions, Easy GUI tar-gets the so-called 1/4 VGA (320 × 240)sweet spot, fitting squarely betweenthe resolution offered by the old warhorses (e.g., 256 × 64 for the venerableHitachi LM213B) and the full-blownmegapixels of an embedded PC.

Easy GUI technology starts with achip of Amulet’s own design (seeFigure 1). Packaged in an 80-pin PQFP,

<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso8859-1"><META NAME="Amulet" Content="baud=115200"><TITLE>untitled</TITLE></HEAD><BODY><P><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="320" HEIGHT="240"><TR><TD WIDTH="320" HEIGHT="240"><P><body bgcolor="white" text="black" link="blue" vlink="purple"alink="red"><p>&nbsp;&nbsp;&nbsp;<applet code="Field.class" width="137" height="32"align="middle"><param name="fontsize" value="5"><param name="fontstyle" value="bold"><param name="href" value="1"><param name="max" value="250"><param name="maxfld" value="5000"><param name="min" value="0"><param name="minfld" value="000"><param name="printf" value="RPM - %4i"><param name="updaterate" value="1.0,.1"></applet></p><p>0 <applet code="BarGraph.class" width="195" height="39" align="middle"><param name="fillpattern" value="1"><param name="href" value="1"><param name="max" value="250"><param name="min" value="0"><param name="name" value="Tach"><param name="sweepfrom" value="left"><param name="updaterate" value="1.0,.1"></applet>&nbsp;5000</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<applet code="LinePlot.class" width="178"height="84"align="bottom">

<param name="href" value="1"><param name="lineweight" value="2"><param name="updaterate" value="1.0,.1"><param name="xsamples" value="100"><param name="ymax" value="250"><param name="ymin" value="0"></applet></p><p>&nbsp;<applet code="FunctionButton.class" width="56" height="25"align="bottom"><param name="fontsize" value="3"><param name="fontstyle" value="plain"><param name="href" value="Amulet:function(1)"><param name="name" value="Tach"></applet>&nbsp;<applet code="FunctionButton.class" width="56" height="25"

align="bottom"><param name="fontsize" value="3"><param name="fontstyle" value="plain"><param name="href" value="Amulet:function(2)"><param name="name" value="H20"></applet>&nbsp;<applet code="FunctionButton.class" width="56" height="25"

align="bottom"><param name="fontsize" value="3"><param name="fontstyle" value="plain"><param name="href" value="Amulet:function(3)"><param name="name" value="Trans"></applet>&nbsp;<applet code="FunctionButton.class" width="56" height="25"

align="bottom"><param name="fontsize" value="3"><param name="fontstyle" value="plain"><param name="href" value="Amulet:function(4)"><param name="name" value="Load"></applet></p></TD></TR></TABLE></BODY></HTML>

Listing 1—My example user interface boils down to little more than a page of HTML, which the Amuletcompiler crunches down to proprietary uHTML for storing in the onboard serial EEPROM.

Page 76: cc_2001_07-132

76 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

the AGB64LV01 integratesan 8-bit microcontrollerwith LCD interface logicincluding a line buffer andprogrammable timing gen-erator. External interfacesinclude an 8-bit data bus foran SRAM, 8-channel SPIport for serial EEPROM andother peripherals, UART forhost connection, and theLCD panel interface.

The latter consists of apixel data bus and a halfdozen video-like timing andcontrol signals. Variouscharacteristics are program-mable, such as pixel buswidth (1, 2, 4, or 8 bits) andpixel and frame clock polar-ity, to accommodate a vari-ety of manufacturers’ pan-els. At this point, Amulet supportsonly monochrome panels, but it’s nothard to imagine a color follow-on.

Figure 2 is the schematic for a typi-cal board design, much like the onethat comes with the starter kit (see

Photo 2). The Amulet Technologieschip is hooked to a serial EEPROMthat stores the user-defined screensand a byte-wide SRAM used for boththe display frame buffer and workingstorage. An RS-232 level shifter and

the usual 9-pin connectorcomplete UART connec-tion to the host.

Also shown on theschematic is a Burr-Brown(now part of TexasInstruments) ADS7486touchscreen controller.This little puppy handlesall the details of connect-ing a resistive touchsceenoverlay for “Look ma, nomouse” embedded apps.That’s a nice touch.

SOFTWARE TO BOOTIt’s great that Amulet

offers an easy integration(i.e., connects to anythingwith a UART) solution formid-range display apps.However, hooking up the

hardware is only part (arguably, theeasiest) of the story. No matter whosechip you use, there’s still the smallmatter of software to make it dosomething useful. It isn’t hard to cob-ble together some low-level drivers

ROM RAM

CPU

Graphics

I/O

Generic

Memoryinterface/arbiter

Linebuffer

Rastercontroller

Timer UART SPI

I/O Bus

Address bus

Data bus

Figure 1—The Amulet Easy GUI chip ($17.50 in 10k units) combines a micro with cus-tom graphics extensions, a 256-byte line buffer, and an LCD interface with programma-ble timing to accommodate a variety of displays.

Products to support thedesign and testing of vehicle

network components

CAN and more!The AVT-718 does it all!

1509 Manor View Road • Davidsonville, MD 21035(410) 798-4038 voice • (410) 798-4308 fax

e-mail: [email protected] • home page: www.avt-hq.com

Supports all popular protocols.

• CAN (2-wire and GM Single Wire CAN).• J1850 VPW (GM Class 2 & Chrysler).• J1850 PWM (Ford SCP).• Keyword Protocol 2000 (and ISO 9141).• UBP (Ford).• RS-232/422 to host computer.

See our web site for a complete listingof available products and information.

AVT’s Products...• AVT-715: Dual J1850 Interface, CCD

optional (RS-232/422).• AVT-716: Multiple Protocol Interface:

J1850 VPW, PWM, ISO-9141, KWP2000,CCD, ALDL (RS-232/422).

• AVT-717: UBP & CAN Interface: Ford’s UBP,CAN 2-wire & single wire (RS 232/422).

• AVT-921: Dual J1850 Interface (ISA Bus).• AVT-931: Dual J1850 Interface (PC/104).• AVT-932: Dual J1850 Interface to Ethernet

(PC/104).

AVT’s Services...• Automotive Network Engineering.• Customized firmware for our products.• Custom hardware and firmware development.

!"#

Part Master, BOMs, Purchase Orders, WorkOrders, Sales Orders, Receiving, Invoicing,Stockroom, Address Book,and Security Modules

Integrated inventory andmanufacturing control

Affordable

Multi-user

Page 77: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 77

such as BitBLT (bit block transfer) or aline algorithm, but it’s a long journeyfrom these primitives to a pleasinguser interface. Worse, the more cyclesyour host controller has to spendbabysitting the display, the fewercycles it has available to handle theembedded application.

Wouldn’t it be nice to be able totake advantage of powerful desktopsoftware tools to craft your user inter-face, but without having to burdenyour application with the full baggageof an embedded PC? Well, hang on toyour logic probe, folks, because that’sjust what Easy GUI purports to do.The trick can be described in four let-ters, HTML. Here’s how it works.

Start with your favorite web pageeditor and craft your user interface,including touchscreen hyperlinks,

right on screen. Of course, you canevaluate, share, or otherwise foolaround with your user interfacedesign using a standard web browser.When you’ve got it just right, run thedesktop HTML through Amulet’sHTML compiler.

The HTML compiler munches onyour pages and outputs a condensedversion Amulet Technologies callsuHTML. The uHTML gets down-loaded to the serial EEPROM on themodule where it’s interpreted by theAmulet chip at runtime using a built-in uHTML browser.

WIDGET WARRIORThe concept of using a standard

web page editor to build an embeddeduser interface is intriguing, butAmulet goes even further.

As handy as it sounds, there aremany things an embedded systemneeds to do that aren’t really in thedomain of HTML or conventionalweb page development tools.

Although the RS-232 port providesthe hardware connection between thedisplay and application, there alsoneeds to be a software scheme forcommunication. For example, press-ing the touchscreen should update avariable or invoke action by the hostcontroller. Likewise, an applicationshould be able to overlay the staticuHTML pages in flash memory withdynamic application data.

No doubt there are a lot of embed-ded apps that could take advantage ofcanned functions (e.g., a bar graph orline plot), which HTML knows noth-ing about. Java? Well, you’re close.

Figure 2—The schematic for thestarter kit board demonstrates thatwhen it comes to hardwaredesign, Amulet’s technologymakes the job easy.

Page 78: cc_2001_07-132

78 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

In the desktop world, Java appletsare indeed the means by which webpage functionality is extended in anopen-ended manner beyond the con-fines of HTML.

No, the Amulet chip does notinclude a full-blown JVM. Instead,Amulet supplies a library of what itcalls widgets to handle a variety ofuser-interface tasks.

At this point, astute readers areanticipating the gotchas for widgets,namely that they break the cleveruse-a-web-page-editor (which knowsnothing about widgets) strategy.Fortunately, Amulet supplies Javaapplet versions of the widgets, pre-serving the ability to develop on thedesktop with standard Java-capableweb page editors and browsers.

HIGHWAY STARLet’s give the starter kit a whirl

around the block. I’m a novice whenit comes to web page editors andHTML, so it’s all the better that Ineeded to fill the gap in my quiver ofdisplay options. I figured I would be a

good test case to see whether or notthe Easy GUI concept truly lives upto its name.

I decided to prototype a simpleautomotive display. Judging by theamount of e-mails I receive, the arti-cles I’ve written about combiningcomputers and cars strike a chordwith a lot of you. Someday, I hope toupdate my last mobile project (“Onthe Road Again” Circuit Cellar 118and 119), which put an SBC into myvan’s J1850 network, and a mid-rangebitmap display would be the ticket.

My sample interface (see Photo 3a)consists of various widgets includingnumeric field, bar graph, and line plotrepresentations of a variable (rpm),and four touch-sensitive function but-tons. The rpm is updated from thehost via RS-232. Pushing any of thebuttons causes a unique code signify-ing the event to be sent to the host.

To make a long story short, I wasindeed able to get my sample inter-face working in relatively short order,as you can see in Photo 3b. Referringto the HTML source (see Listing 1) is

a good way to see what’s going on. Itstarts with some preamble stuff,including the “Amulet” META state-ment, which conveys hardware-specif-ic information (in this case, the baudrate) to the chip without upsetting theweb page editor or browser. As this isa monochrome unit, all color designa-tors are simply ignored.

Next, you see the definition of a320 × 240 table (corresponding to theresolution of the LCD) that’s requiredto set the stage for your interface.

Following are seven applet code sec-tions, one each for the (numeric)Field, BarGraph, LinePlot, and fourFunctionButtons. Each incorporates alist of parameter names and corre-sponding values that define theappearance and behavior of the widg-et. Let’s go through them one by onefor the Field.class, the first numericfield showing rpm.

The fontsize and fontstyle param-eters are self-explanatory. Note thatcurrently Amulet supports only a sin-gle sans serif font, and size choice islimited to 8, 10, 12, 14, and 18 points.

Page 79: cc_2001_07-132

FPGA

AVR

SRAM

Atmel's programmable FPSLIC SOC technology

speeds time-to-market while lowering risk

for a true out-of-body experience.

Set yourself free on your next design

project. Let Atmel's FPSLIC devices

give you inner peace with FPGA,

20 MIPS AVR®, 8-bit RISC

microcontroller and up to 36K

bytes of SRAM on a single chip.

Need to get to market fast? No problem.

System Designer™, our co-verification

based design tool, will take months off your

development schedule. And with stand-by current

under 100 µA, you won’t need divine intervention

to meet the power goals of your portable products.

For only $495, you can

enjoy design nirvana and

beat your competition to

market. For more information and to order your

starter kit, go to www.atmel.com/ad/fpslic02.html.

R

©2001 Atmel Corporation. FPSLIC, AVR, System Designer and the Atmel name and logo are trademarks of Atmel Corporation in the USA and other countries. Other terms and product names may be trademarks of others.

www.atmel.comFax-On-Demand:(800) 292-8635 (North America) (408) 441-0732 (International)

Introducing FPSLIC™

A Performance of Unrivaled Flexibility

Page 80: cc_2001_07-132

80 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

web page editor, tweaking the param-eters for a widget required navigatinga sequence of menus, lists, and dialogboxes versus a few seconds to edit theHTML with Notepad.

Another reason I drifted away fromthe web page editor was based on theobservation that it was not quite asWYSIWYG as I had hoped, with slightdifferences in the formatting of thedesktop and LCD versions of myinterface. Perhaps more experiencewith any or all of the tools wouldenable reconciling the difference, butI’d rather spend time getting the LCDdisplay to be the way I want it thanfiguring out how to coerce the tools.

Ironically, I recently wrote a col-umn opining that the PC market isweak because our beloved boxes nowhave so much horsepower relative totypical users’ needs, leaving little rea-son to upgrade.

But I must say that by the time Ihad everything running—web editor,browser, Amulet compiler, and proto-

handling a buttonpress includeswitching to a spe-cific page orreturning to theprevious page.

BETA SITEI remain

impressed withthe mid-rangepositioning andoverall web-in-drag concept ofAmulet’s Easy

GUI, although Ihave to admit that

there are some issues, not to mentiona few rough edges.

One such issue is that switchingbetween EEPROM programming andnormal operation requires toggling aDIP switch, which is mounted on thebottom of the board. It doesn’t soundespecially unreasonable, but actuallyruns counter to the easy blow-and-goapproach the technologyencourages. The good news isthat it takes only a few sec-onds to edit and recompileyour project. The bad news isthat it also takes a few secondseach time to turn over theboard and fuss with the DIP toswitch to Programming modeand flip it again to check theresult. If it must have a switchto differentiate modes, I sug-gest something like a dedicatedtoggle switch that’s easilyaccessible from the top.

A nagging concern lies in thepossible complications as aresult of ever more bloaty ten-dencies for desktop web toolsand HTML feature creep. Thisis reflected in Amulet’s recom-mendation that it’s better touse a simple web page editorrather than the latest andgreatest version.

In truth, after I had roughedout my interface with the webpage editor, it wasn’t longbefore I found myself editingthe raw HTML directly ratherthan going through the webeditor. For instance, with the

Href defines the data interchangewith the host, with “1” identifyingvariable 1 as the source of the rpmvalue. Skipping down to the lastentry, you can see that the desiredupdate rate is 1.0 (allowed range is0.01 to 655.35 s). So, once per secondthe Amulet board will send a requestto the host for the value of variable 1.

One limitation is that variables areonly 8-bits wide, so I decided to havethe host send rpm divided by 20. Onthe other hand, a nice touch is thatthe widget incorporates scaling asdefined by the min, max, minfld, andmaxfld parameters. The variable valuebetween min and max (i.e., 0–250) isautomatically scaled to the correspon-ding value between minfld and maxfld(i.e., rpm multiplied by 20). Finally,the printf parameter defines the waythe field is displayed using, as thename implies, C-like format optionsand syntax.

Similarly, the BarGraph and LinePlotparameters define the data source(also variable 1, rpm) appearance,update rate, and so forth.

Skip down to the function buttonwidgets. What happens when they arepressed is defined by the href parame-ter. In this case, the value isAmulet:function(1) for the first but-ton, Amulet:function(2) for the sec-ond, and so on.

This means that when the first but-ton is pressed (Tach), the Amuletboard will send a command to thehost to invoke function 1 for the firstbutton, function 2 for the second but-ton, and so forth. Other options for

Photo 3—The example interface runs in a web browser (a) andlive on the LCD (b). Notice the minor difference in appearance,and the fact that the browser version doesn’t use real data (rpm).

a)

b)

Photo 2—As this photo shows, a complete Amulet-based solution calls for theaddition of just about a half dozen memory and I/O chips.

Page 81: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 81

col simulator—things started gettingnoticeably pokey. Hard to placeblame, but it seemed as if emulatingthe Amulet widgets in the web brows-er imposed a fair amount of stress.

TAKE IT EASYIt’s a work in progress, but even as I

finish this article, progress is beingmade. The latest version of the toolsincludes a serial protocol simulator

(see Photo 4) andthe compiler, forexample, nowallows a singlefunction buttonpress to performmultiple actions

(e.g., switching pages locally andinvoking a remote procedure on thehost). I even hear they’re doing awaywith the dastardly DIP switch.

Judging by the rate of progress, bythe time you read this, many of theglitches should be history. In anycase, warts and all, Amulet is on tosomething. It was quicker and easierto get going than the alternative ofrolling my own display from scratch.

Whether it’s a single LED, full-blown VGA, or, in Amulet’s case,something in-between, just rememberthat embedded systems, even ones inthe attic, need a way to tell youwhat’s going on. I

Tom Cantrell has been working onchip, board, and systems design andmarketing for several years. You mayreach him by e-mail [email protected].

SOURCESEasy GUI Starter Kit, AGB64LV01 Amulet Technologies, LLC(408) 244-0363Fax: (408) 243-5457www.amulettechnologies.com

LM213BHitachi, Ltd.(800) 448-2244www.hitachi.com

AD57486Texas Instruments, Inc.(800) 336-5236www.ti.com

Photo 4—A recently addedserial port simulator allowsthe PC to stand in for thehost. In the RS-232 moni-toring window, you can seethe periodic rpm messageexchange and, near theend, the message that wassent when the Tach (func-tion 1) button was pressed.

Problem 1—Write a one-line C function to copy a stringfrom one place to another.

Contributed by Naveen PN

Problem 2—What is the resultant gain when two transis-tors with gains β1 and β2 are used in the Darlington con-figuration?

Contributed by Naveen PN

Problem 3—Write a one-line C statement to toggle thevalue of a variable between two different values, withoutusing any conditional operators.

Contributed by Naveen PN

Problem 4— What is the output resistance of the fol-lowing circuit? The gain of the op amp is 100,000and its output resistance without feedback is 75 Ω.

Contributed by Naveen PN

Vi741 Vo

+

What’s your EQ?—The answersand 4 additional questions andanswers are posted at www.circuitcellar.comYou may contact the quizmastersat [email protected]

8 more EQ

questions

each month in

Circuit Cellar Online

see pg. 4

CIRCUIT CELLAR T e st YY o u r EE Q

Page 82: cc_2001_07-132

82 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

Insert-ready sub-mini SBCs (small as 47x55 mm.) supporting thePhilips 8xC5918xC5918xC5918xC5918xC591, 89C51Rx289C51Rx289C51Rx289C51Rx289C51Rx2, XACxXACxXACxXACxXACx, XAGxXAGxXAGxXAGxXAGx, Infineon C167CxC167CxC167CxC167CxC167Cx,Motorola MPC555MPC555MPC555MPC555MPC555 & ST Microelectronic ST10F168ST10F168ST10F168ST10F168ST10F168

Low EMI designLow EMI designLow EMI designLow EMI designLow EMI design achieved via GND circuitry, 6 to 8 layer PCB, by-pass capacitor grid and short signal traces achieved via smallfootprint and use of 0402 SMD passive components

32 KB to 8 MB external SRAM & Flash (controller-dependent) FlashTools enable on-board in-system (ISP) programming RS-232, RS-485, I2C & CAN interfaces; ADC; Chip-Select signals Controller signals extend to standard (2.54 mm.) or high-density

Molex (0.625 mm.) header pins on two sides of the board,allowing the SBC to be plugged like a "big chip" into targets

Available in Rapid Development KitsRapid Development KitsRapid Development KitsRapid Development KitsRapid Development Kits including Development Board,AC adapter, serial cable and SPECTRUM CD with eval software tools(Keil, TASKING), FlashTools, electronic documentation and demos

www.phytec.com

phyCORE Modules:phyCORE Modules:phyCORE Modules:phyCORE Modules:phyCORE Modules:NEW GENERANEW GENERANEW GENERANEW GENERANEW GENERATIONTIONTIONTIONTIONSINGLE BOARD COMPUTERSSINGLE BOARD COMPUTERSSINGLE BOARD COMPUTERSSINGLE BOARD COMPUTERSSINGLE BOARD COMPUTERS

PHYTEC America LLC PHYTEC America LLC PHYTEC America LLC PHYTEC America LLC PHYTEC America LLC 255 Ericksen Avenue Bainbridge Island, WA USA 98110

(800) 278-9913

IDEA BOXTHE DIRECTORY OF PRODUCTS AND SERVICES

AD FORMAT: Advertisers must furnish digital submission sheet and digital files that meet the specifications on the digital submission sheet.ALL TEXT AND OTHER ELEMENTS MUST FIT WITHIN A 2″ ×× 3″ FORMAT. Call for current rate and deadline information. Send your disk and digital submis-sion sheet to: IDEA BOX, Circuit Cellar, 4 Park Street, Vernon, CT 06066 or email [email protected]. For more information call Kevin Dows at (860) 872-3064.

Suppliers Directory now available online. Check out our web site www.circuitcellar.com to see who has what and how to get it!

Page 83: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 83

Page 84: cc_2001_07-132

84 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

WinWedge inputs real-timeserial data from any devicedirect into Excel, Access, VBor any Windows program.

www.taltech.com

New CEversion!

! " # $ % $ &%' &' %' (

) * # #"+ ,-- ,* ' # )#!"' +' .' /' (% $ 0% ,* 1(

!"#!!$!%

Page 85: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 85

Scottsdale, ArizonaPh: 480.998.3503Fx: 480.998.3504

0 - 24 MΩ range1Ω resolution± 1Ω up to 1 kΩ± .1% 1 kΩ - 24 MΩ

PATENT PENDING

ohmSOURCE®

Resistance Substitution Device

Orderon-line forFREE shipping!

decadebox.com

NEW!

Learn PICmicro® Assembly

PIC and PICmicro are registered trademarks of MichrochipTechnology Inc. in the USA and other countries.

Need to quickly get up to speed with thePICmicro family? We’ve made ouraward-winning PICmicro developmentsystem even better. The new PMDS 2microcontroller development systemincludes everything you need for programdevelopment, education, experiments, or controlapplicationsusing PICmicrocontrol-lers. Getstarted withcompletesystemsfrom $349.

172 Harvard RoadWaterloo, ON, N2J 3V3Canada519.886.4462519.886.4253(fax)

www.siriusmicro.com

PMDS 2 Professional Pack Features:• PIC16F84, PIC16F876, programmer, cables, power supplies• 2X16 LCD, keypad, analog pots, analog reference adjust, buffered port probe, RS-232 port, 2 4k serial EEPROMs, 2 servo outputs, IR receiver, & in-circuit programming port

Page 86: cc_2001_07-132

86 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

For acquisition and control of digital and analog signals.

High speed Serial Port Interface24 digital I/O (TTL compatible)11 Analog Channels with 12 bit ADC4 channels with signal conditioningEmbedded stepper motor controller32 bit DLL

Control up to 16 stepper motors simultaneouslyusing a “SINGLE SERIAL PORT”.

Up to 8500 Steps/sec with linear Accel/Decel.Chopper driver up to 48V/2A for 4,5or 6 wire motors.Software Winding Current Setup.Shaft encoder input , external driver capabilities.Internal FIFO for linear, cubic or spline Interpolation.24 digital I/O,2 SPI, 11 analog channels on-board.32 bit DLL with examples in VC++,VBasic and Delphi.

ST400-NT

SPORT232

Less than US$100/axis!

9 Channel DataLoggers fromUS$400. Ask us, orvisit our web site.

Control up to 16 stepper motors simultaneouslyusing a “

DATA ACQUISITION & CONTROL

RMV Electronics Inc.230-2250 Boundary Rd.Burnaby, BC, Canada V5M 3Z3Tel: (604) 299-5173 Fax: (604) 299-5174Web site: www.rmv.com

Page 87: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 87

!"#

$

%#&'&

()**

&$&$

!+ ',

- &.$

/!0 1 /20

!3 4$

&' !

See our new site at www.jkmicro.comCall 530-297-6073 Fax 530-297-6074

Page 88: cc_2001_07-132

88 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

Made in USA

PCI 48-channel Digital I/O adapter Versatile interrupt capability 50-pin connections to industry-standard relay racks Simple installation with included software

Discover why industry leaders rely on Serial I/O and Digital I/O products from Sealevel Systems. Call today or visit our website for a free catalog or CD.

PCI DIGITAL I/O

864.843.4343

© 2001 Sealevel Systems Incorporated

YEARS OFSINGLE BOARD

SOLUTIONS

Since 1985

Puzzledover which

Phone 618-529-4525 Fax 618-457-0110w w w . e m a c i n c . c o mw w w . e m a c i n c . c o mw w w . e m a c i n c . c o mw w w . e m a c i n c . c o mw w w . e m a c i n c . c o m

Modem to buy?

• 14.4k, 33.6k, & 56k V90 versions• 60 ma. typical power required• 56k version @ $185 quantity 1• Extra available RS-232 port• Rugged PC/104 form factor

16OVER

Page 89: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 89

RS232/RS422 Converter

• Full duplex• 422 or 485 4 wire• Short haul modem

up to 5000 feet• Supports up to 40

RS422 devices

$84.00 quantity 1. OEM discounts.

Connecticut microComputer, Inc.PO BOX 186, Brookfield,CT 06804(203)740-9890 Fax:(203)775-4595

code CC60

Easy to use converter adapts anyRS232 computer to RS422 or 4 wireRS485. Using two twisted pair wire theADA422L will support up to 40 devicesat distances up to 5000 feet. Power isobtained from the RS232 signal lines.

www.2cmc.com

Port powered

51 East Campbell AveCampbell, CA 95008

....by using real-time emulators.

888-886-6428

Support for:HC12, HC118051C166C500ST10Super10Philips XA68300 familyUbicom Scenix

"Nohau emulators show you what is really goingon inside your embedded system. Turn yourselfinto a debugging expert and find bugs fast."

How to:Cut Your Development Time

[email protected]

For more “How to” info see www.nohau.com/howto

408-866-1820

Page 90: cc_2001_07-132

90 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

NuDAQ.comPC Based Data Acquisition & Control Products

PCI-9812, 20 MHz Simultaneous4-Ch Analog Input Card

PCI-7300A, Ultra-High Speed 32-ChDigital I/O Card

LABView,® HP-VEE,® IF Software, DLL’s, InTouch,® Win 95/98/NTVisit www.NuDAQ.com for EXTENSIVE DETAILS. Much broader selection online!

Circuit Specialists, Inc.1-800-528-1417/ Fax: 480-464-5824

since 1971

Page 91: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 91

Email: [email protected]

! "# $%

%&'%'%(%)*+*

,- ,./0 , ,-&1%! %.&2.-%2))$1.(.2 ,.+ 0 $

34%%$" 5&- )$16%%%/%#%

,73839,722%:$;<-

%(

%

Page 92: cc_2001_07-132

92 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

8051, 80C196PIC®, AVR®

Integrated Development Systems:

Compilers, Simulators, Programmers,In-Circuit EmulatorsNon-intrusive, with trace feature, hardware unconditional & complex

breakpoints, triggers, programmable clock, memory mapping &banking, full project & source level support for C compilers…

(718) 259-3191www.phyton.com

EMBEDDED INTERNET MADEEASY!

2900-1 Crescent DriveTallahassee, FL 32308

850-942-7905 phone & fax

Easy Software Development: Use your C/C++ or Basic com-piler to produce DOS EXE. Download EXE to flash disk via serialport. EXE runs on power up.Standard Features: BIOS & DOS-ROM, 128K flash disk,512K SRAM, 40 MHz AM188ES CPU, 16 digital I/O (opto rackinterface), 2 RS-232, 2 timer/counters, simple bus interface,real-time clock with timed power-up

Options: 8-ch 12-bit ADC, flash disks up to 288 MB, 1 RS-485Tiny Size, Low Power: 2”x2.6”, 5V @ 200 mA at full speed.

Visit http://www.bagotronix.com for info, prices, and FAQs

• Free TCP/IP, PPP,Mini-server

• Easy to Use• Low Cost• Low Power• Tiny Size• High Speed• DOS Environment

with the

TM TM TM TM TM From$99Q.100

Page 93: cc_2001_07-132

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 93

Page 94: cc_2001_07-132

94 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

!"#$%#&%##'()*## +,-.,/0&#

• !"#" $ • %&'( #)(*+,((&

• -( . ((' • !& '/( • 01/0 ($ (• "/& 02 /*+) 3( 44'(

• 5 $6 0• 7/) 8, (• ! 2)9' !"#"• (!:;*<#<1=

""*/!' &6$ 04.)"

• Design, PCB Fabrication & Assembly

• DS, Multi-Layer, SMT & RF PCBs

• In-house CAM & Photo Plotting and

Electrical Testing

Superior Quality at Competitive Prices"...your product was delivered on

schedule and was of the highest quality."

R.R. Bell Atlantic Test Systems

Quick Turn ML & SMT

7845-M Airpark Rd., Gaithersburg, MD 20879

Phone: (301) 977-0303Fax: (301) 990-6715 BBS: (301) 990-9628

Web: www.capitalelectro.comemail: [email protected]

Call for FREE PCB Buyers Guide

Page 95: cc_2001_07-132

ADVERTISER’S

www.circuitcellar.com CIRCUIT CELLAR®Issue 132 July 2001 95

INDEX18 ADAC

93 Abacom Technologies

92 Abia Technology

85 Ability Systems Corp.

86 ActiveWire, Inc.

83 Advanced Embedded Systems

84 Advanced Embedded Technologies

51,69 Advanced Transdata Corp.

76 Advanced Vechicle Technologies

27 All Electronics Corp.

94 Amazon Electronics

10 Amulet Technologies

83 Andromeda Research

86 AP Circuits

65 ATOP Technologies

48 Arcom Control Systems

79 Atmel Corporation

92 Bagotronix, Inc.

83 Basic Micro

85 Bay Area Circuits

91 Beige Bag Software

85 CCS-Custom Computer Services

94 CSMicro Systems

94 Capital Electro-Circuits, Inc

93 Cermetek Microelectronics, Inc.

90 Circuit Specialists, Inc.

86 Conitec Data Systems

53,89 Connecticut mircoComputer Inc.

85 Copeland Electronics Inc.

86 Cyberpak Co.

41 Cygnal Integrated Products

91 Dataprobe Inc.

C4 Dataman Programmers, Inc.

The Advertiser’s Index with links to their web sites is located at www.circuitceller.com under the current issue.Page

70 Decade Engineering

17 Design MSP430 Contest

87 Designtech Engineering

26 Dreamtech Computers

43 Earth Computer Technologies

72 ECD (Electronic Controls Design)

83 EE Tools(Electronic Engineering Tools)

63 EE GLOBE Inc.

23,88 EMAC, Inc.

40 Embedded Internet Conference

72 Engineering Express

83 FDI-Future Designs, Inc.

64 General Software

85 HVW Technologies Inc.

83 Hagstrom Electronics

84 Hataway-Hite LLC

57 HI-TECH Software,LLC

89 IMAGEcraft

92 ICE Technology

91,93 Intec Automation, Inc.

49 Interactive Image Technologies Ltd.

91 Intronics, Inc.

84 Island Logix, Inc.

65,87 JK microsystems

90 J-Works, Inc.

70 JR Kerr Automation & Engineering

25 Jameco

85 LabMetric, Inc.

89,90 Laipac Technology, Inc.

94 Lemos International

2 Link Instruments

85 Lynxmotion, Inc.

90 MaxStream

91 MCC (Micro Computer Control)

82 MetaLink Corporation

88 MJS Consulting

88 Micro Digital Inc

93 microEngineering Labs, Inc.

71,78 Microchip

57 Microcross, Inc.

42,56 Micromint Inc.

70 Midwest Micro-Tek

73 Miller Freeman-ESC

84 Mosaic Industries, Inc.

34,78 MVS

91 Mylydia Inc.

85 Narly Software

31 NetBurner

88,94 Netmedia, Inc.

89 Nohau Corp.

87,88 OKW Electronics Inc.

94 Ontrak Control Systems

92 PCB Express, Inc.

C2 Parallax, Inc.

84 Peter H. Anderson

82 Phytec America LLC

92 Phyton, Inc.

91 Picofab Inc.

91 Prairie Digital Inc.

88 Pulsar Inc.

87 Quadravox

8 R4 Systems Inc.

83 R.E.Smith

89 RLC Enterprises, Inc.

86 RMV Electronics Inc.

47 Rabbit Semiconductor

64 Radiotronix, Inc.

16 Remote Processing

84 SMTH Circuits

11 Saelig Company

5 Scott Edwards Electronics Inc.

88 Sealevel Systems Inc.

91 Senix Corp.

94 Sigg Industries

82 Signum Systems

85 Sirius MicroSystems

87 SmartHome.com

46 Softools

84 Software InnoVations Inc.

15 Solutions Cubed

90 Spectrum Engineering

82 Square 1 Electronics

90 Street Rod Digital

84 TAL Technologies

16,24 Technologic Systems

86 Technological Arts

90 techBITES INTERactive

C3 Tech Tools

89 Tern Inc.

7 Texas Instruments

53 Trilogy Design

92 Vantec

92 Vetra Systems Corp.

86 Weeder Technologies

1 Wilke Technology GmbH

76 Xelos

93 Xilor Inc.

87 Z-World

82 Zanthic Technologies Inc.

Implementing a Two-Wire RS-485 Network

Magnetic Position Tracker

Poolside in April: Building a Solar-Powered Pool Heater

My fAVRorite Family of Micros

Mic Check

A PIC Floating-Point Application

Optimize Your PIC

I From the Bench: Recognizing the Flexibility of Reprogramming

I Silicon Update: Listening Chips

I Applied PCs: Linux, All Grown Up

Page Page Page

Internet and Connectivity PREVIEW

133

Page 96: cc_2001_07-132

ow much gloom and doom there is in the economy right now depends on whom you ask. Certainly thepeople on the West Coast who are experiencing dot-com-downsizing and sitting in the dark are somewhat

bitter and warped. At the same time if you ask a builder in New England when you can schedule an additionto your house, he smiles and says, “Take a number.” If anything it’s a mixed bag. Certain segments of the econo-

my see no tomorrow while others feel that the high-tech blip is just that, a blip. For others, it’s the handwriting on the wall.One sector of the high-tech community that may not recover with the same vigor is the trade show. Circuit Cellar usually attends

three or four shows each year with the editorial staff and a booth. In addition, we send editors or distribute magazines to a bunchmore. In fact, we had just shipped boxes of magazines to the Convergence University show when we were informed that it was“postponed until a more favorable climate.” Anyone in Santa Clara need some extra magazines?

They are not alone. Despite joining together, the Internet Device Builder and Applied Computer Conference recently had a lack-luster result. Trade shows are in trouble and Circuit Cellar is not alone in having to decide how to support or attend future events.For example, we would normally attend the July Embedded Systems Conference in Chicago, but as I write this it appears that it willonly have about one quarter the exhibitors of the most recent West Coast ESC. That is hardly the incentive I need to spend the$10k–$15k to staff a booth. More importantly, there is yet another Embedded Systems Conference in Boston only two months later!

Businesses seem to run in cycles. Maybe it’s just the nature of the business that more often than not, the higher the boom, thebigger the bust. For years the Internet and everything connected to it has grown at a breakneck speed. The NASDAQ blowout andall the dot-bombs put a real damper on the economy. In true fiscal reality, however, with the exception of the stock speculators andvulture capitalists, we haven’t lost trillions of physical dollars in our economy. We just didn’t realize the gain we would have had.The disparity in opinions about our current economic shape has a lot to do with how we view financial assets. The portion of thepopulation that used the $100k worth of Priceline.com in their portfolio to justify overspending had an instant attitude adjustmentwhen it became $50.

The trade-show glut is similar and could be expected. Trade shows produce easy money in a boom economy and don’t require alot of “product development” expense. Every publisher and promoter got on the bandwagon to meet the demand. The more showsthere were, the more people attended. The more successful they appeared, the more trade shows they created. Transient successdoesn’t eliminate basic business principles, however. The result was a classic case of supply overshoot.

The real issue is the relative importance of this overshoot on our business mentality and the transient versus long-term funda-mental consequences for all of us. Everyone crows about productivity gains from tech, but maybe the fact is that everyone may bejust working harder to meet “Internet Time” deadlines. There is also the paradigm shift that the Internet represents for trade showorganizers. Trade shows are a low-tech affair with everything from labor, show space, energy, travel, transportation, hotels, andsuch becoming more expensive and more hassle than ever. What engineer has the time or budget to go to a show every month?Certain traditional roles of the trade shows, like distribution of presentations and establishing contact with relevant personnel, canbe precluded to a degree by the Internet. The inevitable conclusion is that some shows need to disappear or be merged. Basically,it’s adapt or die.

In terms of conventional trade shows, I think the few biggest ones will survive, but the concept of a small trade show will becomean oxymoron. The vacuum may be filled to some degree by non-exhibitor-based conferences, workshops, and training sessions.The more successfully attended ones will be highlighted as “learning vacations.” Call it a vacuum or call it sucking wind, either waythe trade show business is getting ready for a change.

Trade Show Paradigms

INTERRUPT

h

[email protected]

PRIORITY

96 Issue 132 July 2001 CIRCUIT CELLAR® www.circuitcellar.com

Page 97: cc_2001_07-132

Copyright © 1999, TechTools, P.O. Box 462101, Garland, Texas 75046-2101 • ClearView, CVASM16, PICwriter, PICstation, the “Wizard” symbol andTechTools are trademarks of TechTools, P.O. Box 462101 Garland, Texas 75046. • PICmicro is a registered trademark of Microchip Technology, Inc.• All other trademarks are trademarks or registered trademarks of their respective company.

PICmicro® Assembler

Modular design for easy, low-cost expansion &upgrades.

PICmicro® In-Circuit Emulator

Fully emulates the selected PICmicro, including pro-gram memory, register memory, EEPROM, I/O activity,SLEEP mode and all peripherals.

Uses specialized Microchip “Bondouts” for accurateemulation.

Supports unlimited “NO SKID” Hardware Breakpoints.

Tech

Too

lsT

ME

mbe

dded

Sys

tem

s D

evel

opm

entT

ools

Get the TOTAL Package for only

Complete PICmicro®

Development System

PICmicro® DebuggerWindows® IDE

wwwwww..tteecchh--ttoooollss ..ccoommCONTACTS: (972) 272-9392 Fax: (972) 494-5814 Email: [email protected]

Intuitive, Easy to Learn full-featured environmentwith integrated ClearView Debugger.

Source-level debugging for ALL popular Compilersand Assemblers.

ClearView™ Mathias is a full-fea-tured In-Circuit Emulator with a highlyproductive Development and Debuggingenvironment for the PICmicro.

See why Engineers choose TechToolsVisit our website at www.tech-tools.com and request your FREE CDROM!

Complete 12bit Development System from $699Complete 14bit Development System from $749

Combined 12bit & 14bit Development System from $899

Add additional device support for $75 to $200Add a PICwriter Programmer for $199

Add Data Breakpointing for $50Add a Timing/Trace combination module for $270

$699

Page 98: cc_2001_07-132

STILL THE WORLD’S MOSTPOWERFUL PORTABLE

PROGRAMMERS?

Dataman Programmers Ltd215 East Michigan AvenueOrange City, FL 32763Telephone (904) 774-7785Fax (904) 774-7796Home page: http://www.dataman.comEmail: [email protected]

$795inc 4mb ram

Orders received by 4pm will normally be despatched same day.Order today, get it tomorrow!

Surely not.Surely someone somewherehas developed a portable programmer thathas even more features, even greaterflexibility and is even better value formoney.Actually, no. But don’t take our word forit. Use the feature summary below to seehow other manufacturers’ products compare.

$1295

DATAMAN-48LV• Plugs straight into parallel port of PC or

laptop

• Programs and verifies at 2, 2.7, 3.3 & 5V

• True no-adaptor programming up to 48pin DIL devices

• Free universal 44 pin PLCC adaptor

• Built-in world standard PSU - for go-anywhere programming

• Package adaptors available for TSOP,PSOP, QFP, SOIC and PLCC

• Optional EPROM emulator

DATAMAN S4• Programs 8 and 16 bit EPROMs,

EEPROMs, PEROMs, 5 and 12V FLASH,Boot-Block FLASH, PICs, 8751microcontrollers and more

• EPROM emulation as standard

• Rechargeable battery power for totalportability

• All-in-one price includes emulationleads, AC charger, PC software, sparelibrary ROM, user-friendly manual

• Supplied fully charged and ready to use

S4 GAL MODULE• Programs wide range of 20 and 24 pin

logic devices from the major GAL vendors

• Supports JEDEC files from all popularcompilers

SUPPORT• 3 year parts and labor warranty

• Windows/DOS software included

• Free technical support for life

• Next day delivery - always in stock

Still as unbeatable as ever. Beware ofcheap imitations. Beware of falsepromises. Beware of hidden extras.If you want the best, there’s still only onechoice - Dataman.

Order via credit card hotline - phonetoday, use tomorrow.

Alternatively, request more detailedinformation on these and other market-leading programming solutions.

NEW MODEL

MONEY-BACK30 DAY TRIAL

If you do not agree that these truly are themost powerful portable programmers you can

buy, simply return your Dataman productwithin 30 days for a full refund