Design of Embedded Systems Using 68HC12/11 Microcontrollers

0 avg rating
( 0 ratings by GoodReads )
 
9780130832085: Design of Embedded Systems Using  68HC12/11 Microcontrollers

This is the first book to describe, in detail, the new Motorola 68HC12 microcontroller, how to program it, and how to design embedded systems using the 68HC12. It shows how WHYP (a version of Forth written specifically for this book) can be used to program the new 68HC12 microcontroller in an efficient and interactive way. It includes an abundance of worked examples and complete C++ code for the WHYP host that runs on the PC. Subroutines and Stacks. 68HC12 Arithmetic. WHYP-An Extensible Language. Branching and Looping. Parallel Interfacing. The Serial Peripheral Interface (SPI). Analog-to-Digital Converter. Timers. The Serial Communications Interface (SCI). Designing with Interrupts. Strings and Number Conversions. Program Control and Data Structures. Fuzzy Control. Special Topics. WHYP12 C++ Classes. WHYP12 C++ Main Program. For electrical and computer engineers who want to learn about the new Motorola 68HC12 microcontroller, how to program it, and how to design embedded systems using it.

"synopsis" may belong to another edition of this title.

From the Inside Flap:

Preface

Many people think of a computer as a PC on a desk with a keyboard and video monitor. However, most of the computers in the world have neither a keyboard nor a video monitor. Rather they are small microcontrollers—a microprocessor, memory, and 1/0 all on a single chip—that are embedded in a myriad of other products such as automobiles, televisions, VCRs, cameras, copy machines, cellular telephones, vending machines, microwave ovens, medical instruments, and hundreds of additional products of all kinds. This book is about how to program microcontrollers and use them in the design of embedded systems.

A popular microcontroller that has been used in a wide variety of different products is the Motorola 68HC11. Motorola has recently introduced an upgrade of this microcontroller, the 68HC12, that has new, more powerful instructions and addressing modes. This book emphasizes the use of the 68HC12 while at the same time providing information about the 68HC11. It can therefore be used in courses that use both 68HC12 and 68HCll microcontrollers.

This book is the result of teaching various microcomputer interfacing courses over the past 20 years. While the technology may change, the basic principles of microcomputer interfacing remain largely the same and these basic principles are stressed throughout this book. However, microcomputer interfacing is a subject that is learned only by doing. The courses that I have taught using this material have all been project-oriented courses in which the students design and build real microcomputer interfacing projects.

A definite trend in microcomputer interfacing and in digital design in general is a shift from hardware design to software design. Microcomputer interfacing has always involved both hardware and software considerations. However, the increasingly large-scale integration of the hardware together with sophisticated software tools for designing hardware means that even traditional hardware design is becoming more and more a software activity.

In the past most software for microcomputer interfacing has been written in assembly language. This means that each time a new and better microprocessor comes out the designer must first learn the new assembly language. The advantage of assembly language is that it is "closest to the hardware" and will allow the user to do exactly what he or she wants in the most efficient manner. While some feel that assembly language programs are more difficult to write and maintain than programs written in a high-level language, the major disadvantage of assembly language programs is related to the obsolescence of the microprocessor—when upgrading to a new or different microprocessor, all of the software has to be rewritten! Even when upgrading from a 68HCI I to a 68HC12, which is upward compatible at the sourcecode level, to get the best performance from the 68HC12 you will need to rewrite the code to use the newer, more powerful instructions and addressing modes.

This has led to a trend of using high-level languages such as C or C+ + for microcomputer interfacing. While this helps to solve the obsolescence problem—much of the same high-level code might be reusable with a new microprocessor—high-level languages come with their own problems. The development environment is not always the most convenient. One has to edit the program, compile it, load it, and then run it to test it on the real hardware. This edit-compile-test cycle can be very time consuming for large programs. Without sophisticated run-time debugging tools the debugging of the program on real hardware can be very frustrating. When designing microcomputer interfaces you would like to be as close to the hardware as possible.

What you would like is a computer language with the advantages of both a high-level language and assembly language, with none of the disadvantages. It would be nice if the language were also interactive so that you could sit at your computer terminal and literally "talk" to the various hardware interfaces. The language should also produce compact code so that you can easily embed the code in PROMS or flash memory for a stand-alone system. While you're at it why not embed the entire language in your target system so that you can develop your program "on-line" and even upgrade the program in the field once the product is delivered. Impossible, you say? In fact, just such a language exists for almost any microprocessor you may want to use. The language is Forth and we will use a derivative of it in this book to illustrate how easy microcomputer interfacing can be.

We will use a unique version of Forth called WHYP (pronounced whip) that is designed for use in embedded systems. WHYP stands for Words to Help You Program. It is a subroutine threaded language which means that WHYP words are just the names of 68HC12(11) subroutines. New WHYP words can be defined simply by stringing previously defined WHYP words together.

A unique feature of Forth—and WHYP—is its simplicity. It is a simple language to learn, to use, and to understand. In fact, in this book we will develop the entire WHYP language from scratch. We will see that WHYP consists of two parts—some 68HC12 subroutines that reside on the target system (typically an evaluation board) and a C+ + program that runs on a PC and communicates with the 68HC12 target system through a serial line. In the process of developing the WHYP subroutines on the target system you will learn 68HC12 assembly language programming. When you finish the book you will also know Forth. Previous knowledge of C + + will be helpful in understanding the C+ + portion of WHYP that resides on the PC. The complete C+ + source code is included on the disk that accompanies this book and in discussed in Chapters 16 and 17. However, these chapters are optional and are not required in order to use WHYP to program the 68HC12.

You will discover that you can develop large software projects using WHYP in a much shorter time than you could develop the same program in either assembly language or C. You might be surprised at the number of industrial embedded systems projects that have been developed in Forth. Many small companies and consultants that use Forth don't talk much about it because many consider it a competitive advantage to be able to develop software in a shorter time than others who program in assembly language or C.

In Chapter 1 you will learn about the architecture of the 68HC12 and how to write a simple assembly language program, assemble it, download it to the target board, and execute it. You will see how to write 68HC12 subroutines in Chapter 2 where you will learn how the system stack works. We will then develop a separate data stack, using the 68HC12 index register, X, as a stack pointer. This data stack will be used throughout the book to pass parameters to and from our 68HC12 subroutines (WHYP words). We will see in Chapter 2 that this makes it possible to access our 68HC12 subroutines interactively, by simply typing the name of the subroutine on the PC keyboard.

In Chapter 3 we will study 68HC12 arithmetic with emphasis on the new 16-bit signed and unsigned multiplication and division instructions available on the 68HC12. We will use these instructions to create WHYP words for all of the arithmetic operations.

The power of WHYP comes from the fact that you can define new WHYP words in terms of previously defined words. This makes WHYP an extensible language in which every time you write a WHYP program you are really extending the language by adding new words to its dictionary. You will learn how to do this in Chapter 4.

In Chapter 5 we will took at the 68HC12 branching and looping instructions and see how we can use them to build some high-level WHYP branching and looping words such as an IF ... ELSE ... THEN construct and a FOR ... NEXT loop. We will also see in this chapter how we can do recursion in WHYP, that is, how we can have a WHYP word call itself.

After the first five chapters you should have a good understanding of the 68HC12 instructions and how they are used to create the WHYP language. The next six chapters will use WHYP as a tool to explore and understand the 1/0 capabilities of the 68HC12 (and 68HC11). The important topic of interrupts is introduced in Chapter 6 and specific examples of using interrupts in conjunction with various 1/0 functions are given in Chapters 7-11.

Parallel interfacing will be discussed in Chapter 7 where examples will be given of interfacing a 6SHC12 to seven-segment displays, hex keypads, and liquid crystal displays. Real-time interrupts are used to program interrupt-driven traffic lights.

Chapter 8 will cover the 68HC12 Serial Peripheral Interface (SPI) where it will be shown how to interface keypads and sevensegment displays using the SPI. The 68HCll and 68HC12 Analog-to-Digital (A/D) converter is described in Chapter 9 where an example is given of the design of a digital compass.

The 68HC12 programmable timer is discussed in Chapter 10 where examples are given of using output compares, input captures, an

From the Back Cover:

This is the first book to describe, in detail, the new Motorola 68HC12 microcontroller, how to program it, and how to design embedded systems using the 68HC12. It shows how WHYP (a version of Forth written specifically for this book) can be used to program the new 68HC12 microcontroller in an efficient and interactive way.

FEATURES/BENEFITS

  • A bridge between the 68HC12 and the 68HC11—Focuses on the 68HC12, but includes material for (and provides software for) the older 68HC11.
  • A new version of ForthWHYP (Words to Help You Program)—designed for use in embedded systems—WHYP can easily be installed on any 68HC12 system, including the most popular development boards from Motorola and Axiom Manufacturing. It consists of two parts-some 68HC12 subroutines that reside on the target system (typically an evaluation board) and a C++ program that runs on a PC and communicates with the 68HC12 target system through a serial line. It is a sub-routine threaded language, which means that WHYP words are just the names of 68HC12(11) subroutines. New WHYP words can be defined simply by stringing previously defined WHYP words together. The first five chapters of the text explain how to make the programming of the 68HC12 simple and interactive, and in the process develops the entire WHYP language from scratch, step by step. (The software is provided on disk with the text, and the latest versions of the software will be available on the author's web site.)
  • An abundance of worked examples and many chapter-end exercises—Ranges from simple reinforcing exercises to complete term projects. Some suggest significant design projects using some of the latest peripheral chips with references to specific web sites where data sheets can be obtained.
    • Users can see examples of complete designs and have quick references to data sheet URLs.
  • A detailed description of the new 68HC12 multiplication and division instructions.
    • Users can use the easier method (WHYP, Forth) for doing arithmetic, rather than using assembly language.
  • A chapter on Fuzzy Control—Provides a detailed description of fuzzy logic as well as a discussion of how to use the built-in 68HC12 fuzzy control instructions.
    • Develops special WHYP words that make it easier to design a fuzzy controller.
  • Complete C++ code for the WHYP host that runs on the PC—Provided with the book and described in Chs. 16 and 17. Includes both the C++ program that runs on the PC, and the 68HC12 assembly language program that runs on the target 68HC12 board.

"About this title" may belong to another edition of this title.

Top Search Results from the AbeBooks Marketplace

1.

Haskell, Richard E.
Published by Prentice Hall (1999)
ISBN 10: 0130832081 ISBN 13: 9780130832085
New Paperback Quantity Available: 1
Seller
Irish Booksellers
(Rumford, ME, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 1999. Paperback. Book Condition: New. book. Bookseller Inventory # 0130832081

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 52.19
Convert Currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, Rates & Speeds

2.

Haskell, Richard E.
Published by Prentice Hall (1999)
ISBN 10: 0130832081 ISBN 13: 9780130832085
New Softcover Quantity Available: 1
Seller
Book Deals
(Lewiston, NY, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 1999. Book Condition: New. Brand New, Unread Copy in Perfect Condition. A+ Customer Service!. Bookseller Inventory # ABE_book_new_0130832081

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 58.72
Convert Currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, Rates & Speeds

3.

Haskell, Richard E.
Published by Prentice Hall (1999)
ISBN 10: 0130832081 ISBN 13: 9780130832085
New Paperback Quantity Available: 3
Seller
Murray Media
(North Miami Beach, FL, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 1999. Paperback. Book Condition: New. Bookseller Inventory # P110130832081

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 55.75
Convert Currency

Add to Basket

Shipping: US$ 2.99
Within U.S.A.
Destination, Rates & Speeds

4.

Haskell, Richard E.
Published by Prentice Hall
ISBN 10: 0130832081 ISBN 13: 9780130832085
New PAPERBACK Quantity Available: 1
Seller
Cloud 9 Books
(West Palm Beach, FL, U.S.A.)
Rating
[?]

Book Description Prentice Hall. PAPERBACK. Book Condition: New. 0130832081 New Condition. Bookseller Inventory # NEW6.0044979

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 59.99
Convert Currency

Add to Basket

Shipping: US$ 4.99
Within U.S.A.
Destination, Rates & Speeds

5.

Haskell, Richard E.
Published by Prentice Hall (1999)
ISBN 10: 0130832081 ISBN 13: 9780130832085
New Paperback Quantity Available: 1
Seller
Ergodebooks
(RICHMOND, TX, U.S.A.)
Rating
[?]

Book Description Prentice Hall, 1999. Paperback. Book Condition: New. 1. Bookseller Inventory # DADAX0130832081

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 132.75
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds

6.

Haskell, Richard E.
ISBN 10: 0130832081 ISBN 13: 9780130832085
New Quantity Available: 1
Seller
Castle Rock
(Pittsford, NY, U.S.A.)
Rating
[?]

Book Description Book Condition: Brand New. Book Condition: Brand New. Bookseller Inventory # 97801308320851.0

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 157.12
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds

7.

Haskell, Richard E.
Published by Prentice Hall (1999)
ISBN 10: 0130832081 ISBN 13: 9780130832085
New Paperback Quantity Available: 1
Seller
Revaluation Books
(Exeter, United Kingdom)
Rating
[?]

Book Description Prentice Hall, 1999. Paperback. Book Condition: Brand New. 1st edition. 569 pages. 9.75x7.50x1.00 inches. In Stock. Bookseller Inventory # 0130832081

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 280.37
Convert Currency

Add to Basket

Shipping: US$ 7.40
From United Kingdom to U.S.A.
Destination, Rates & Speeds