If you can find a product that doesn't have a microcontroller, wait a year
or two--it's sure to have one by then. Even a new electric toothbrush has a
microcontroller hidden inside. It sounds a beep to tell you when to move to the
next quadrant of your mouth, thus ensuring that you brush all your teeth with
A lot more electromechanical functions are being implemented using microcontrollers, notes Jim Farrell of Motorola's CSIC microcontroller division. For example, you could get a car with automatic door locks 25 to 30 years ago. "The problem with that is you have all these electromechanical circuits, cams, and relays that make it all work, and it's highly expensive and unreliable," he says.
That's where microcontrollers come in. They replace the cam, switches, relays, and contacts with a silicon chip. Silicon performs their functions much better and fundamentally never wears out. The car will wear out long before the silicon.
|Microcontroller advantages • Reliability
• Low cost
• High integration
• Space savings
"Thousands of applications are begging to be converted from electro- mechanical to low-cost microcontrollers. Functions that would be done with timers or simple sensors can now be done simpler and less expensively using a microcontroller." Jason Wolfson, design consultant, Lipidex
"Things that move tend to be unreliable. Things that rub against each other tend to wear out. That's where microcontrollers come in. They replace switches, relays, and contacts with a silicon chip, which fundamentally never wears out." Jim Farrell, Motorola's CSIC microcontroller division.
"It's an 8-bit, analog world, and crude precision is enough for many applications." John Wharton, microcontroller analyst and consultant.
"The price/ performance ratio for 32-bit microcontrollers has come down to the point wher the high- performance, servo, and industrial-control applicaitons, 32-bit controllers should be at the top of a designer's list." Lyle Supp, Hitachi microcontroller/ microprocessor division.
"The only difference between a microprocessor and a microcontroller these days is microcontrollers have some variant of ROM on chip, and microprocessor don't." Semiconductor Industry Association.
Microcontrollers range from 4 to 32 bits, meaning they can process that many bits in parallel internally. Wider data and instruction paths let controllers process more complex instructions and run faster. The most popular controllers are the 8-bit parts, which you'll find in cars, appliances, remote controls, toys, pagers, phones, and even industrial applications. Some cost less than a buck.
With the abundance and increasingly lower price of 8-bit microcontrollers of every possible variety on the market, why are people still buying 4-bit microcontrollers?
"Lots of applications require some minimum level of intelligence but not as much as that supplied by an 8- or 16-bit controller," says Scott Gaw of Toshiba's microcontroller division. "The 8-bit market is the largest, but the second largest in terms of units is the 4 bit."
Such applications used to be manually controlled, such as thermostats. Now, microcontroller-based units let you program your home thermostat instead of setting manual switches. Another big consumer of 4-bit microcontrollers is the appliance market, which uses them for dishwashers, ovens, microwave ovens, and sophisticated coffee makers.
Prices for 4-bit controllers range from 50 cents to a couple of dollars. Some of the 8-bit parts are starting to come down in price, says Gaw, because the silicon vendors are starting to strip out some of the peripherals, such as memory and timers, so they can compete with the 4-bit parts.
Designers on a budget need to decide whether they need the processing power of 8 bits or the greater peripheral mix they can get with a 4-bit controller.
Peter Tam, an engineering consultant with Irvine, CA-based PTI, is such a designer. He uses the TMP47/TMP470 series of Toshiba 4-bit microcontrollers for irrigation timer systems.
Some old systems use the 60-Hz line frequency to rotate the motor on a certain time interval. An electromechanical contact switch acts as a time set, triggering a sequence of events. In this case, it turns on a sprinkler valve.
Why replace this simple system with a microcontroller? Tam answers with two words: cost and flexibility. He chose a 4-bit part because it could handle the job and was less expensive than an 8-bit alternative.
"The electromechanical system is limited due to a sequential linear event. Only one thing can happen at a time. And it's very cumbersome. If you want to implement any schedule, you need more features," says Tam. One of his designs implements a real-time calendar, so users can program it to water only on the odd or even days of the calendar. They can also program the system to water different parts of their lawn at different times. You can't do either of these with an electromechanical timer.
"With synchronized-motor applications, you need a lot of related components, and they're all hardware and they all cost something. They also take up more real estate," says Tam. "With a single-chip controller, a lot of features are already built in--output functions such as the triac or relay driver and interface functions such as the LCD driver."
Also, the microcontroller can run on batteries during a power outage to keep the data and programming alive, Tam points out. An electromechanical timer would be off, and the time would be shifted when the power came back on.
Tam stored the software program in ROM firmware, and uses RAM to store temporary data. A programmable timer has a rain delay feature, which lets users enter a number of days--say, 3--and not water for three days but then restart the schedule on the fourth day. With an electromechanical system, the user would have to remember to turn the system back on. "With ours," says Tam, "you set it and forget it."
"The hurdle in irrigation is trying to educate users that using a microcontroller is OK and that it will save them money," notes Tam. He might start using 8-bit controllers for higher-end applications that demand more functions, such as watering parks, school yards, and golf courses.
Notes Toshiba's Gaw, "I see some upward migration from 4 to 8 bits from customers who need to upgrade to 8 bits to add features to compete in their end market. But there will always be a market for 4-bit controllers.
8 bits dominate. The majority of microcontroller applications are still 8 bit, and the 8-bit market is growing, according to Motorola's Farrell.
"As the price of 8 bits goes down, a lot of 4-bit applications will move to the 8-bit chips," he predicts. "You get more processing power at no penalty in cost."
One vehicular application that uses a Motorola 8-bit microcontroller is a tilt-sensing module for trucks delivering containers to ships. A crane lowers a device called a spreader, which attaches to the container and moves the container from the tractor to the ship.
The cranes are enormous and lift objects at 600 ft/min. In some instances, the longshoreman working the ship forgets to detach the container from the tractor. In this case the crane lifts up both the container and the tractor. Because the cranes are so powerful, before anyone has a chance to do anything the container, tractor, and unfortunate tractor driver are hoisted high into the air.
Obviously, this puts the tractor driver at great risk. Typically significant property damage also occurs to the tractor.
The CATL safety system from Equipment Safety Systems, Carson City, NV, uses the Crossbow Technologies, San Jose, CA, CXTILT02 tilt sensor, which in turn incorporates an Analog Devices ADXL05 silicon micromachined accelerometer and a Motorola 68HC11 microcontroller.
The sensor module sits in a heavy-duty enclosure on top of the tractor. When a crane lifts the tractor from the ground, the sensor measures the angle with respect to Earth's gravity. When the angle exceeds 1.5°--which corresponds to the back tires of the tractor being lifted approximately 3 inches from the ground--the system fires a high-power strobe light. The cranes have a light detector that can see the strobe light and automatically deactivates the crane's upward hoist. The crane operator then knows to lower the container.
The accelerometer has a dc output, which goes to an on-chip A/D converter. The resulting digital signal goes to the CPU, which runs an embedded program to calculate the tilt angle of the tractor at all times. The controller also monitors the magnetic sensor connected to the tractor's drive shaft. Whenever the tractor is moving, the sensor ticks along making little pulses. The pulses deactivate the alarm so there are no false alarms from bumps.
After calculating the tilt angle, the controller triggers the output alarm, if necessary. Because of the solid-state nature of the sensor, the entire design fits on a 2×3-in. double-sided pc board.
In addition to inputs, outputs, and the A/D converter, Mike Horton, Crossbow president, used the SCI (serial communications interface) peripheral to enable technicians to hook up a laptop computer to the sensor to do diagnostics.
Horton chose the Motorola chip because he only needed 8 bits of processing power and was already familiar with the architecture. "The real bottom line here is that we've done a million designs with the HC11, and we have a library of code already written for it," he says.
Also using Motorola microcontrollers is a European car company that plans to put 10 68HC08s in each 1999-model-year vehicle: One in each door that controls the locks and the windows, one in each front seat that controls the position of the seat and remembers who sat in it last, one in the trunk that controls the CD player and lights in the trunk and rear tail lights, one in the dash that controls the instrumentation cluster, one in the radio that controls the front end of the audio system, and one in the sunroof that controls it and remembers how drivers like it positioned. The controllers can communicate via a CAN bus.
This kind of scheme is actually cheaper than using wire to make all the connections, notes Farrell. "Wire is not only heavy and unreliable, it's also very expensive."
Bowling for data. The oldest microcontroller of them all is the 8-bit 8051 architecture. It's almost 20 years old now, with more than a billion units sold worldwide. Intel offers 64 flavors, Philips 101, and Siemens 24.
"It's an 8-bit, analog world, and crude precision is enough for many applications," claims John Wharton, a microcontroller analyst and consultant--and the designer who suggested the 8051 architecture 18 years ago.
A recent design that takes advantage of an 8051--in this case, the Philips 80752--is a bowling-ball data-acquisition system. It's the brainchild of Don Hake, project engineer at Red Lion Controls, York, PA.
"There's really no way for bowlers to ascertain how consistent their throwing is or what kind of changes they're making and whether they're successful," says Hake.
People apply three variables to the ball: speed, spin, and how far down the lane he or she hurls it. "It occurred to me, how could you measure these parameters? If I were in the ball I could count rotations, measure how fast it's going, and see how far down I hurled it," says Hake. So he came up with the idea to put a sensor in the ball instead.
Actually, the design has two sensors. One is a plastic piezo film sensor that registers a voltage when the bowler presses on it. That's used both to indicate when the bowler releases the ball and when it hits the lane and hits the pins. A photosensor detects light when the ball is rolling down the lane. Ambient light comes through the finger hole at different angles to generate a rough sinusoidal waveform that corresponds to the speed of the ball.
For such a design to be feasible, it has to be easy to install and go in a conventional bowling ball hole. Many high-level bowlers use inserts in their finger holes. They're made of soft rubber and fit into a standard-diameter round hole. Hake's module fits in that hole. The piezo film slides down between the insert and the hole. When the bowler is holding the ball, a finger is in the hole pressing against the film. When he or she releases the ball, the film generates a voltage pulse that starts up the module.
Hake says the Philips 80752 is one of the smallest microcontrollers around. On-chip peripherals include an A/D converter and 128 bytes of RAM to hold the program. The controller stores data in 8 kbytes of external EEPROM from Microchip, which is enough for a whole game's worth of data.
A laptop PC does the actual data analysis. It uploads the data from the system's LEDs using an IR wand attached to the laptop's serial port.
Says Hake, "It's made a big difference in my game." The module is not yet available, but Hake is in talks with several interested manufacturers.
Fool-proof fans. Another popular 8-bit microcontroller is the PIC series from Microchip Technology, Chandler, AZ. Lipidex (Duxbury, MA) used the PIC16C54 to design the AiretrakTM mobile-home fan controller for Tamarack Technologies, West Wareham, MA. The unit is also popular in the general housing market for bathroom ventilation fans.
The fan goes on at a low rate for a set period of time to periodically change the air in the house. An override button lets homeowners run the fan at full speed. Before this product, people would have to remember to turn the fan on--and mobile homes can get mighty stuffy.
"The PIC16C54 was perfect for this application," says Jason Wolfson, a design consultant at Lipidex. "It had enough capabilities, I/O pins, small size, and low power consumption." Wolfson says he uses the low-power capability to run the system off a battery during power failures, uses the outputs to drive LEDs and triacs, and uses the inputs to read switches. The chip has 512 bytes of program memory and 25 bytes of RAM.
Airetrack keeps time by reading the ac line--120 zero crossings make up a second. The output controls a triac to turn the fan on and off 120 times a second, varying the timing for speed in 16 steps.
"The microcontroller controls the turn-on voltage so that the fan turns on gently so you don't hear it turn on from the living room," says Paul Raymer, vice president at Tamarack. "The big advantage for us is that the electronics fit into a standard switch box, and the wiring's really simple. It's the least obtrusive way of providing ventilation that users won't defeat." In fact, the unit is designed to run 20 years without anyone touching it.
"One of the things that makes the design robust is the watchdog timer," says Wolfson. "I kind of think of it as a timebomb. If it doesn't get reset, it explodes and the microcontroller gets reset." When he wrote the software, Wolfson made sure to reset the timer in certain places in the code so the "bomb" wouldn't go off.
Static potential from users or spikes on the power supply could cause the microcontroller to "crash." Should it crash, the watchdog timer will go off within 2.5 seconds, and the consumer would never know anything had happened.
Wolfson also used a PIC microcontroller to design a mosquito trap for entomologists. The pests come out as soon as it gets dark, but go away after about four hours and don't come out if it's colder than 50F. The previous electromechanical design detected when it got dark, opened up the trap, turned on the fan and a light that attracted the mosquitoes, and ran all night. The fan blew the mosquitoes into a bag and prevented their escape.
"We put a PIC into the device, and we can now program it to go on at dusk and then shut off after 4 hours to conserve battery power," says Wolfson. "We can adjust how the light flickers and how much CO2 gas--which attracts mosquitoes--is sent out."
Fries for 16 bits. Something else that attracts mosquitoes and other flying pests is fast food--like french fries.
Delta Computer Systems, Vancouver, WA, uses 32 microcontrollers from Advanced Micro Devices in the ADR--automatic defect removal--machine. French-fry makers--companies that slice up potatoes and sell them to fast-food chains and grocery stores--use the ADR to scan potato strips for spots of rot.
Each machine has 32 lanes with belts 13/4 inches apart; each lane has a 16-bit, 40-MHz Am186TMEM microcontroller, a scanner, and two knives. Two ADRs interface to a Windows NT master computer.
Company president and ADR designer Peter Nachtwey describes the process: "Potatoes get skinned up line. Then they get shot from a water cannon and through a grate, and they come out as french fries. The strips go through machinery that aligns them end to end and removes the water."
Next, the aligned strips go down the ADR lanes and underneath the scanners. LEDs and photosensors scan each pre-french fry for colors corresponding to rot. Once a bad spot shows up, a microcontroller notes the location and runs an optimization algorithm that figures out the best way to cut the rot out without wasting valuable potato.
Say the ADR finds a 2-inch defect. It's programmed to cut it into chunks of less than an inch so that they fall down a grating downstream.
"Half the trick is cutting the fry without moving it in relation to the belt," says Nachtwey. The goal is to make the cuts as accurately as possible to minimize waste. Before such machines, fry makers "used to have as many as 50 ladies with paring knives on either side of a conveyor belt cutting the rot out of the potatoes--before they were strips," Nachtwey says.
Delta says it chose the Am186EM controller--part of the popular x86 processor family--because it was fast enough so that they didn't have to add a DSP. And, it has the high integration DSPs don't normally offer. Before, the designers would team up a DSP and a slower 186.
Each controller gets scanning data from external memory, processes it, controls the knives via outputs solenoids, and communicates results to master computer via its serial communication port.
AMD's Rob Stintz points out that the controller has an 8-bit external bus and 16-bit internal bus. "This architecture makes the controller less expensive and you can use a cheaper form of memory with it," says Stintz. He does concede that it can be a bit of a performance bottleneck at times.
The master computer stores parameters for 64 lanes, keeps track of data, and calculates statistics. "We tally all the fries to a 16th of an inch," says Nachtwey, "all the fries that come in and all the ones that go out." Because they know how many sixteenths of an inch it takes to make a pound for a particular-width fry, the computer can make reports of pounds per hour and calculate waste. It also does histograms on fry length. "If the fries end up getting short, MacDonalds doesn't like that," he notes, "so the company can input bigger potatoes."
The need for speed. Some problems can't be solved by using bigger potatoes, but more bits can definitely help microcontrollers tackle more complex tasks.
"Thirty-two-bit processors are faster and more accurate," says Lyle Supp, microcontroller/microprocessor product marketing manager for Hitachi's 32-bit SH1 Series of RISC microcontrollers. "If you only have an 8- or 16-bit chip, and the arithmetic you're doing requires higher precision, you'd have to do multiprecision arithmetic, which sacrifices performance. Instead, you could use the native instructions on a 32-bit RISC chip to handle the operations in a single cycle."
Electromechanical applications requiring 32 bits include: hard-disk drives, CD-ROM players, and DVD players. The performance requirements, access times, and accuracy with which you're moving the servo motors or linear actuators demand 32-bit power. More bits allows better accuracy and higher speed because of faster, more precise calculations.
Electronic applications include digital still cameras, home video-conferencing systems, car-navigation systems, and PDAs. The camera and video system make use of MAC (multiply and accumulate) instructions to do DSP-like algorithms, such as image smoothing during zoom.
"The price/performance ratio for these processors has come down to the point where for high-performance, servo, and industrial-control applications, 32-bit microcontrollers should certainly be at the top of the list for consideration," says Supp. Even if a designer could get away with a 16-bit controller, he suggests considering the 32-bit chip first because of the added processing power, and sometimes there's little price difference.
Another 32-bit advantage: If designers want to build a line of products, they could create higher-end products without having to change processor families. Typically, 8- and 16-bit families are starting to run out of steam, according to Supp. With 32-bit chips, designers can start removing hardware from a system and upgrading it just in software. "This tack makes designing much more flexible, less expensive, and more reliable," he says.
Taking this tack is Englewood, CO-based Echostar. Company designers used the 32-bit MIPS R3041 from Integrated Device Technology (IDT), Santa Clara, CA, to power its Echostar digital satellite receiver.
Why did they pick the R3041? "Bang for the buck," answers system architect Dave Kummer. "It was the lowest-cost solution we could get for the highest performance."
Another reason is the on-chip cache and cache controller, which let the designers use a low-cost memory subsystem but still get good performance. The 32-bit cache controller can get data out of the 8-bit-wide external memory and deliver it to the processor at 32 bits wide. Without the cache controller, the designers say they would have had to use wider or faster memory, which is more expensive, in order to get the same performance.
In the receiver, the controller manages the external MPEG decoder chip, telling it when to start and how to display the data. It also runs the Electronic Program Guide (EPG) by drawing all the graphics and managing the TV-program database.
"We could have done it with 16 bits," claims Kummer, "but the advantage with 32 is that our graphics are much faster than what we could achieve with a 16-bit part."
"Because we went with a 32-bit RISC chip instead of a 16-bit CISC chip, our performance is very much higher for the user interface. And," says Mark Jackson, VP engineering, "we pay less for that part."
The company plans to move to a 64-bit in the future as competitive pressures force them to improve the graphics performance even more. A 64-bit controller would also let designers increase the number of colors in the EPG. "As you up the number of colors, you need more processing performance to be able to even maintain the same speed," says Kummer. "Right now, we're at 4 bits per pixel to get 16 colors, if we went to 8 bits per pixel, that's twice as much memory you have to manipulate even if you were going to draw the same picture."
The designers say that when they move to 64 bits, they'll stay with the MIPS architec-ture because of the time and money they've already invested. And Kummer adds that another reason they chose the MIPS architecture is that it's available from a number of vendors and as an ASIC core. "We could get higher levels of integration--such as integrating the MPEG decoder chip onto the processor--by using ASIC technology with this or another MIPS core," he says.
Alan Heimlich from IDT's microprocessor division says the primary advantage users derive from the R3041 is the ability to replace dedicated system hardware with software functions. "That is such a benefit," says he. "For example, you won't have hardware modems in a few years, it'll all be done in software. The cost will come down, software doesn't take up space or burn power, and it will be easier to add more features."
Of course, software almost always has a few bugs. By implementing hardware features in software, users will be able to fix problems by downloading revised software--something you can't do with a broken modem.
A/D converter (analog-to-digital converter)--Circuitry that converts an analog signal into digital data that a microcontroller can directly process.
ASIC (application-specific integrated circuit)--A processor whose circuitry is designed by the end-user for a specific task.
CISC (complex-instruction-set computer)--A processor that has variable-length instructions.
D/A converter (digital-to-analog converter)--Circuitry that converts digital data into an analog output.
DSP (digital signal processor)--A high-speed microprocessor designed to perform computation-intensive digital processing algorithms in real time.
EEPROM (electrically erasable programmable ROM)--Memory that can be reprogrammed byte-by-byte electrically. Thus, data in EEPROM can later be changed by a manufacturer or a product's end-user.
External bus--The circuitry that lets a microcontroller communicate with the outside world. External buses are usually 4, 8, 16, or 32 bits wide.
Flash memory--A type of reprogrammable memory that can be erased and reprogrammed while on a circuit board. This memory is organized into blocks comprising many bytes, so erasing or reprogramming one byte affects an entire block. Microcontrollers with on-chip flash have just recently become available.
Internal bus--The circuitry that a microcontroller uses to communicate with its on-chip peripherals. Internal buses are often the same width as a microcontroller's external bus, but sometimes the internal bus is actually twice that bit width.
Microcontroller (also MCU, µC)--A microprocessor with added memory and peripherals. A microcontroller contains the essential functions of a computer on a single IC and is programmed to perform a limited number of functions.
Microprocessor (also CPU, µP)--A silicon chip that is reprogrammable and takes care of central processing functions.
Parallel port--An input/output structure that transfers several data bits in a single operation.
Peripheral--A piece of circuitry on a microcontroller that performs a specific function, thus offloading the main processing block. Examples include timers, memory, I/O ports, and A/D converters.
PROM (programmable ROM)--Also known as one-time-programmable ROM, this kind of memory comes from the chip supplier unprogrammed, allowing an OEM to program each chip individually. Once programmed, however, it cannot be reprogrammed.
RAM (random-access memory)--Read/write memory that stores temporary data while a system is operating.
RISC (reduced-instruction-set computer)--A processor with a relatively small set of fixed-length instructions. RISC processors have pipelines with several stages for decoding and executing instructions.
ROM (read-only memory)--Memory that holds permanent programs and data and cannot be reprogrammed.
Serial port--An input/output structure that transfers data one bit at a time.
Timer--A peripheral that performs routine time-measurement functions, such as producing time delays or counting external events.
The following companies can be reached via the Internet. Please tell them you were referred by Design News.
Advanced Micro Devices:
Hitachi America Ltd.
Integrated Device Technology (IDT):
Microchip Technology Inc.:
Semiconductor Products Sector
Also, here are some other Web sites that will prove useful to microcontroller users.
Microcontroller Primer and FAQ:http://dvt07.fagmed.uit.no/faq.
Internet Resource List:
CPU Info Center:
Microcontroller or microprocessor?
There seems to be no standard test to determine whether a chip is a microcontroller or a microprocessor.
Many in the industry say a microcontroller is a microprocessor that has memory and input and output structures on chip. The Semiconductor Industry Association insists that a processor isn't a microcontroller unless it has some variant of ROM on board.
However, many microcontroller families include members with no memory at all, and these chips are still called microcontrollers. Also, some industry sources say that microcontrollers range from 4 to 16 bits, some say 4 to 32 bits, and others say 64-bit microcontrollers are possible using ASIC technology. ASICs are silicon chips whose circuitry users design themselves. An engineer could choose to base an ASIC on a microprocessor core and then add memory, inputs, outputs, and peripherals.
What to do? Says Motorola's Jim Farrell: "From a technical point of view, there's no reason to use a microcontroller instead of a microprocessor. The decision is strictly a financial one."
You could take a 6800 microprocessor and add RAM and ROM chips and an I/O chip and you'd effectively have a 68HC05 microcontroller, he says. The problem is you'd have seven or eight chips on the board instead of one.
High-chip-count designs have many negative implications, including being more expensive and taking up more valuable space. Also, reliability is inversely related to the number of pins that go on a board. So by reducing your pin counts, you're actually dramatically increasing your reliability.
A microprocessor would be the right choice if you're going to be using external memory chips in huge quantities. Computer applications need tens or hundreds of megabytes of RAM, and you can't get that on a microcontroller. Also, notes Farrell, some microprocessors, like the PowerPC, have so much processing power on them that the die would become unwieldy and large if you put the memory on the silicon.
Microcontrollers are finding their way into almost every electronic product imaginable. Just this year, the number of controllers in an average new car exceeded the number of controllers in the office.