Programming and Customizing the HC11 Microcontroller

Programming and Customizing the HC11 Microcontroller

5.0 2
by Thomas Fox
     
 
A comprehensive introduction to the HC11 microcontroller from the basics to complete applications.

Overview

A comprehensive introduction to the HC11 microcontroller from the basics to complete applications.

Product Details

ISBN-13:
9780071344067
Publisher:
McGraw-Hill Companies, The
Publication date:
12/21/1999
Edition description:
BK&CD ROM
Pages:
268
Product dimensions:
7.39(w) x 9.21(h) x 1.24(d)

Read an Excerpt

Chapter 1: What is a Computer

Amicrocontroller unit (MCU) is essentially a "computer on a chip." But what is a computer? During the "electronic hobbyist's golden decade" (1955-1965), some of the most fascinating projects described in electronic hobbyist magazines and books were simple electromagnetic or electronic computers. Unlike the computer projects described in magazines in the mid-1970s and later, these early computers often consisted merely of a bank of relays or four to eight bistable flip-flops in series with an old phone dial as an input. For output, they used either no. 48 bulbs for the transistorized or relay version or NE-2 bulbs for the tube version. About the only thing this "computer" could do was translate decimal numbers to binary numbers and add them. For instance, if you dialed "3," the first from the right, and the second light would go on-all others would remain off. This indicated that "Y in decimal was "I I" in binary. If you dialed "51" lights I and 2 would go out, and light 4 would go on-this indicated "8" in binary. Of course, since a dial doesn't turn that fast, you could "see" the action taking place, with each light going on for an instant and then off as the "computer" counted upward in binary. This visible action meant that the process was slow, but it also added to the "computer's" mysterious charisma.

If you hooked up eight of these flip-flops in series (which, in those days, verged on a supercomputer), you were able to record a number as large as I I I I I I I I in binary, which is 255 in decimal. Now, doesn't something look familiar here? Eight flip-flops in seriesalong with 8 indicator lights in a row. What we have is an 8-bitregister-very similar in concept to the 8-bit registers in 8-bit microcontrollers. Quick question: What is the size of most registers in the HC I I and other 8-bit microcontrollers?

To get the concept of an 8-bit register etched in your mind, let's describe how to wire up a twenty-first-century version of the mid-twentieth-century hobbyist computer. Here we will use flip-flops in integrated chips (ICs) instead of making them from junction transistors, electron tubes, or even electromagnetic relays. Before I show the schematic and how to breadboard it, let's look at solderless breadboards and power supplies.

Solderless Breadboards

Solderless breadboards (also referred to as experimenter ~ breadboards) could be described as "high-tech Legos"-and are almost as easy to use. See Figs. 1-1, 1-2, and 1-3. If you use one of these, circuits can be tested quickly and easily. These breadboards come in many sizes and shapes and are produced by several companies. Radio Shack, for one, sells several sizes and types of these boards.

Solderless breadboards have plug-in points that are 0. 1 in apart and accept DIP ICs, diodes, W resistors, most capacitors, low-power transistors, light-emitting diodes (LEDs), 22-gauge wire, and many other parts that use 22- or 24-gauge leads. For more information, refer to the instructions that usually come with the boards. These boards are simple to use.

Power Sources

While you can power the first experiment (circa 1965 hobbyist computer) with two D-cells in series (3 V) or a 6-V battery, like most experiments and projects in this book, it is best powered by a regulated 5-V power supply capable of supplying 100 mA.

Keep in mind that this first experiment is a "get acquainted with the book's technique" project. While the circuit's operation is informative and helps ingrain the all-important concept of an 8-bit (1 -byte) number into your noggin, even more important, it enables you to gain experience with a solderless breadboard. What is most important, however, it gives me an excellent opportunity to discuss a piece of equipment you should own (not must, just should)-a regulated 0to 12-V power source capable of producing 250 mA. See Fig. 1-3. Ideally, this power supply should have the capability of monitoring the current drawn and the voltage produced. An alternative to this 0- to 12-V regulated supply is a +5-V regulated supply. If you have trouble finding either power supply at a reasonable price, you may be interested in this next section.

An Inexpensive +5-V Regulated Power Supply With Current Monitor

This simple power supply can be used to power most projects and experiments in this book. Figure 1-4 shows a schematic of a + 5-V power source capable of supplying at least 100 mA continually and more than twice this for short periods of time. You can use either a solderless breadboard or a printed circuit board for this power supply. Figure I -I provides two views of this circuit breadboard. If you breadboard the power supply, take care when inserting the LM293 1 T leads in the board-they are slightly on the large size.

If you get serious and make a printed circuit (PC) board for this power supply, follow Fig. 1-5 for the solder-side foil pattern. Figure 1-6 provides the component mounting guide so that you know which part goes where. For tips on making PC boards, see Appendix E.

If you do use a PC board, it is wise to lay down the LM293 IT and use a screw and nut to fasten it to the board. The reason for this is that the foil on the solder side aids in dissipating heat. If you are using the optional PR2 flashlight bulb in the circuit, first solder I in lengths of no. 22 wire to its two connections before inserting it in either the breadboard or the PC board.

Notice that this power supply uses an LM293 IT low-dropout regulator IC. Like the HC 11, this IC was designed originally for automotive applications and has a whole bunch of safeguards built in. According to the data sheet, this chip is almost impossible to destroy, even if you don't know what you are doing! For instance, the data sheet claims that you can connect the power supply backward or connect it to 25 V or even temporarily to 60 V and not only will blue smoke not be seen or an acrid burnt odor fill your sinuses, but the chip should still regulate nicely. This tiny piece of high-tech sand is supposed to act like nothing ever hit it! The manufacturers claim that you can even stick it in a circuit backward, and as long as you take it out before it starts smoking too much, no damage is done. Awesome! While I haven't been this rough on the chip, I have used it extensively without a problem. Did I mention that it also has short-circuit and thermal-overload protection and that its dropout voltage is typically less than 0.5 V?

Notice the optional PR2 flashlight bulb in the circuit. Its purpose is as a current monitor. If you omit the PR2, make sure you connect a jumper wire in its place. Under normal low-current operation, the PR2 should not glow. It takes about 100 mA to light the filament just a little. If you see the filament lit, shut the power down and check for trouble. There is no doubt that this bulb is quite useful-but it isn't as good as a milliammeter! Did I mention that it is cheap, though?

One caution when using the LM293 IT in your design: Make sure you connect at least a 100-iff capacitor across its output. This unusually large capacitor is required for stability...

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >

Programming and Customizing the HC11 Microcontroller 5 out of 5 based on 0 ratings. 2 reviews.
Guest More than 1 year ago
Tom Fox's book takes you on a grand tour of the 68HC11 microcontroller. He begins with the simplest idea of what a computer is and ends with several applications of this particular family of microcontrollers. This is not your PC that is being examined here, but rather a single chip computer (well OK, most applications will probably require a few additional ones). The 68HC11 family is one of the latest of Motorola's line of microcontrollers that started with the 6800 about 25 years ago. You don't need to be an engineer or technician to tackle this book, but you will need some basic background. To build any of the project boards some printed circuit board soldering and component identification skills are required. This is not a Heathkit, with detailed, illustrated assembly instructions. However the author does provide some insight and well thought out testing procedures. What makes any computer useful are the software programs. The author provides the ones needed for the exercises and applications that are in the book, but the point is to have the reader come up with the ones needed for other applications. These programs are written in assembly language, which is much simpler than it sounds. Tom Fox explains the basics of the language and provides a listing of the Instruction Set (the commands that tell the 68HC11 what to do). Anyone who has written simple BASIC language programs should have no problem. The book and accompanying CD ROM have some of the supporting documentation and the author gives a lot of information on how to obtain more. Searching the Internet for additional information can be a great learning experience in itself. I highly recommend this book to anyone interested applying microcontrollers to solve control problems.
Guest More than 1 year ago
Tom Fox has created an excellent book on the Motorola 68HC11. His book is designed to build your knowledge up from the beginning and end up with you being able to develop your own HC11 Applications. What I liked most about the book was Tom's explaining about the tools and resources avaiable for the HC11.