The Microcontroller Idea Book Robot Books

Kits and Toys
 Robot Kits
 Stiquito Kit
 Robot Toys
 Solar Kits
 Robot Arms
 Basic Stamp Kits
 Lego MindStorms

 Beginners Books
 Hobby Robots
 Robot Sports
 Robot Minds
 Books for Kids
 Robots at Work
 Advanced Books
 Used Books

More Robotics
 Real Robots
 Robot Motors
 Remote Controls
 Robot Parts
 Robot Tools
 Robot Videos
 Robot News

The Microcontroller Idea Book is a how-to for the 8052-BASIC single-chip computer. Practical designs for use in data loggers, controllers, and other small-computer applications. How to use sensors, relays, displays, clocks/calendars, keypads, wireless links, and more. Complete with schematics, example programs and design theory. Use the described development system for easy, inexpensive testing and EPROM programming.



   The Microcontroller Idea Book

Microcontroller Idea BookExcerpt:

Chapter 1: Microcontroller Basics
This chapter introduces you to the world of microcontrollers, including definitions, some history, and a summary of what's involved in designing and building a microcontroller project.

What's a Microcontroller?
A microcontroller is a computer-on-a-chip, or, if you prefer, a single-chip computer. Micro suggests that the device is small, and controller tells you that the device might be used to control objects, processes, or events. Another term to describe a microcontroller is embedded controller, because the microcontroller and its support circuits are often built into, or embedded in, the devices they control. 


You can find microcontrollers in all kinds of things these days. Any device that measures, stores, controls, calculates, or displays information is a candidate for putting a microcontroller inside. The largest single use for microcontrollers is in automobiles-just about every car manufactured today includes at least one microcontroller for engine control, and often more to control additional systems in the car.

In desktop computers, you can find microcontrollers inside keyboards, modems, printers, and other peripherals. In test equipment, microcontrollers make it easy to add features such as the ability to store measurements, to create and store user routines, and to display messages and waveforms. Consumer products that use microcontrollers include cameras, video recorders, compact-disk players, and ovens. And these are just a few examples.

A microcontroller is similar to the microprocessor inside a personal computer. Examples of microprocessors include Intel's8086, Motorola's 68000, and Zilog's Z80. Both microprocessors and microcontrollers contain a central processing unit, or CPU. The CPU executes instructions that perform the basic logic, math, and data-moving functions of a computer.

To make a complete computer, a microprocessor requires memory for storing data and programs, and input/output (I/O) interfaces for connecting external devices like keyboards and displays.

In contrast, a microcontroller is a single-chip computer because it contains memory and I/O interfaces in addition to the CPU. Because the amount of memory and interfaces that can fit on a single chip is limited, microcontrollers tend to be used in smaller systems that require little more than the microcontroller and a few support components. Examples of popular microcontrollers are Intel's 8052 (including the 8052-BASIC, which is the focus of this book), Motorola's 68HC11, and Zilog's Z8.

A Little History
To understand how microcontrollers fit into the always-expanding world of computers, we need to look back to the roots of microcomputing. In its January 1975 issue, Popular Electronics magazine featured an article describing the Altair 8800 computer, which was the first microcomputer that hobbyists could build and program themselves. The basic Altair included no keyboard, video display, disk drives, or other elements we now think of as essential elements of a personal computer. Its 8080 microprocessor was programmed by flipping toggle switches on the front panel. Standard RAM was 256 bytes and a kit version cost $397 ($498 assembled). A breakthrough in the Altair's usability occurred when a small company called Microsoft offered a version of the BASIC programming language for it.

Of course, the computer world has changed a lot since the introduction of the Altair. Microsoft has become an enormous software publisher, and a typical personal computer now includes a keyboard, video display, disk drives, and Megabytes of RAM. What's more, there's no longer any need to build a personal computer from scratch, since mass production has drastically lowered the price of assembled systems. At most, building a personal computer now involves only installing assembled boards and other major components in an enclosure.

A personal computer like Apple's Macintosh or IBM's PC is a general-purpose machine, since you can use it for many applications-word processing, spreadsheets, computer-aided design, and more-just by loading the appropriate software from disk into memory. Interfaces to personal computers are for the most part standard ones like those to video displays, keyboards, and printers.

But along with cheap, powerful, and versatile personal computers has developed a new interest in small, customized computers for specific uses. Each of these small computers is dedicated to one task, or a set of closely related tasks. Adding computer power to a device can enable it to do more, or do it faster, better, or more cheaply. For example, automobile engine controllers have helped to reduce harmful exhaust emissions. And microcontrollers inside computer modems have made it easy to add features and abilities beyond the basic computer-to-phone-line interface.

In addition to their use in mass-produced products like these, it's also become feasible to design computer power into one-of-a-kind projects, such as an environmental controller for a scientific study or an intelligent test fixture that ensures that a product meets its specifications before it's shipped to a customer.

At the core of many of these specialized computers is a microcontroller. The computer's program is typically stored permanently in semiconductor memory such as ROM or EPROM. The interfaces between the microcontroller and the outside world vary with the application, and may include a small display, a keypad or switches, sensors, relays, motors, and so on.

These small, special-purpose computers are sometimes called single-board computers, or SBCs. The term can be misleading, however, since the computer doesn't have to be on a single circuit board, and many types of computer systems, such as laptop and notebook computers, are now manufactured on a single board.

New Tools
To design and build a computer-controlled device, you need skills in both circuit design and software programming. The good news is that a couple of recent advances have simplified the tasks involved. One is the introduction of microcontrollers themselves, since they contain all of the elements of a computer on a single chip. Using a microcontroller can reduce the number of components and thus the amount of design work and wiring required for a project. The 8052-BASIC microcontroller even includes its own programming language, called BASIC-52.

The other development is personal computers themselves. A desktop computer can help tremendously by serving as a host system for writing and testing programs. As you are developing a project, you can use a serial link to connect the host system to a target system, which contains the microcontroller circuits you are testing. You can then use the personal computer's keyboard, video display, disk drives, and other resources for writing and testing programs and transferring files between the two systems.

Project Steps
Putting together a microcontroller project involves several steps:
Define the task
Design and build the circuits
Write the control program
Test and debug

Sometimes the steps won't follow exactly in this order. You may begin writing your program before you build the circuits, or you may build and test some of the circuits before you start programming. But however you go about it, each of the above steps is part of the process. To see what's involved in each step, let's look at each in more detail.

Defining the Task
Every project begins with an idea, or a problem that needs a solution. For example, How can I monitor light intensity at different locations and times of day to find the best location for a solar collector? Or how can I automate the process of drilling printed-circuit boards? Or how can I create a computer-controlled, animated display for a store window?

Once you know what you want to accomplish, you need to determine whether or not your idea is one that requires a computer at all. In general, a computer is the way to go when the circuits must make complex decisions or deal with complex data. For example, a simple AND gate can easily decide whether or not two inputs are both valid logic highs, and will change its output accordingly. But it would require many small-scale chips to build a circuit that stores a series of values representing sensor outputs and the times they occurred, and displays the information in an easily understandable form....

Table of Contents

Chapter 1: Microcontroller Basics What's a Microcontroller?, A Little History, New Tools, Project Steps

Chapter 2: Inside the 8052-BASIC: Possibilities, Limits, What You Need, The 8051 Family, Elements of the 8052 and 8052-BASIC

Chapter 3: Powering Up: About the Circuit, Circuit Construction, Powering Up, Basic tests, Simple Programs to Try, Exiting Programs

Chapter 4: Saving Programs: Nonvolatile Memory Options, Adding NVRAM or EEPROM, Using the Programming Commands, Adding Bootup Options, Erasing NV Memory, Adding more NVRAM or EEPROM, Adding EPROM, EPROM-programming Circuits, Power Supplies for Programming, Storing Programs on Disk

Chapter 5: Programming: Programming Basics, BASIC-52 Bugs and Things to Watch Out For, Finding Program Errors, BASIC-52 Keywords by Function, Quick Reference to BASIC-52

Chapter 6: Inputs and Outputs: The Memory Map, Uses for I/O Ports, Adding Ports, The 8255 Programmable Peripheral Interface

Chapter 7: Switches and Keypads: Simple Switches, Adding a Keypad

Chapter 8: Displays: Using LEDs, 7-segment Displays, Displaying Messages, Inside the Display Controller, Mounting Displays in an Enclosure

Chapter 9: Using Sensors to Detect and Measure: Sensor Basics, Choosing Sensors, On/off Sensors, Analog Sensors, Sensor Examples, Level Translating, Choosing a Converter

Chapter 10: Clocks and Calendars: BASIC-52's Real-time Clock, A Watchdog Timekeeper

Chapter 11: Control Circuits: Switching Power to a Load, Controlling a Switch Matrix, Op Amp with Programmable Gain, Controlling a Stepper Motor, Speed Control of a Continuous DC Motor

Chapter 12: Wireless Links: Infrared Links, Increasing the Distance, Radio Links

Chapter 13: Calling Assembly-language Routines: Assembly-language Basics, What You Need, Loading a Routine, File Formats for Assembly-language Routines, Assembling a Program, Uploading a Program, Example: Creating a Sine Wave, Avoiding Program Crashes, Interrupts, Adding Custom Commands and Instructions, A General-purpose EPROM Programmer

Chapter 14: Running BASIC-52 from External Memory: Reasons, Copying BASIC-52, System Requirements, Storing BASIC-52 Programs

Chapter 15: Related Products: Enhanced BASIC-52, BASIC compilers, Programming Environments, Pc Boards, BASIC-52 Source Code

Appendix A: Sources, Books, BBS's, Product Vendors
Appendix B: Programs for Loading Files
Appendix C: Number Systems, About Number Systems, Kilobytes and Megabytes

277 Pages   



Advertise your product on

Beginners Books  |  Hobby Robots  |  Robot Sports  |  Electronics  |  Mechanics  |  Robot Minds  |  Robot Fiction
Books for Kids  |  Robots at Work  |  Mars Robotics  |  Advanced Books  |  Recommended  |  Roboxers  |  Robot Kits
Solar Kits  |  Robot Arms   |  Robosapien  |  Basic Stamp  |  BioHazard  |  Robot Toys  |  Muscle Wires  |  Lego Mindstorms
Real Robots  |  Robot Motors  |  Robot Tools  |  Microcontrollers  |  Used Books  |  Robot Parts  |  Magazines  |  Holdem
Robot Videos  |  Robot News  |  RoboLinks  |  Contact