PIC Microcontrollers: An Introduction to Microelectronics / Edition 2 available in Paperback
- Pub. Date:
- Elsevier Science
The use of microcontroller based solutions to everyday design problems in electronics, is the most important development in the field since the introduction of the microprocessor itself. The PIC family is established as the number one microcontroller at an introductory level.
Assuming no prior knowledge of microprocessors, Martin Bates provides a comprehensive introduction to microprocessor systems and applications covering all the basic principles of microelectronics.
Using the latest Windows development software MPLAB, the author goes on to introduce microelectronic systems through the most popular PIC devices currently used for project work, both in schools and colleges, as well as undergraduate university courses. Students of introductory level microelectronics, including microprocessor / microcontroller systems courses, introductory embedded systems design and control electronics, will find this highly illustrated text covers all their requirements for working with the PIC.
Part A covers the essential principles, concentrating on a systems approach. The PIC itself is covered in Part B, step by step, leading to demonstration programmes using labels, subroutines, timer and interrupts. Part C then shows how applications may be developed using the latest Windows software, and some hardware prototyping methods.
The new edition is suitable for a range of students and PIC enthusiasts, from beginner to first and second year undergraduate level. In the UK, the book is of specific relevance to AVCE, as well as BTEC National and Higher National programmes in electronic engineering.
· A comprehensive introductory text in microelectronic systems, written round the leading chip for project work
· Uses the latest Windows development software, MPLAB, and the most popular types of PIC, for accessible and low-cost practical work
· Focuses on the 16F84 as the starting point for introducing the basic architecture of the PIC, but also covers newer chips in the 16F8X range, and 8-pin mini-PICs
|Edition description:||Older Edition|
|Product dimensions:||7.46(w) x 9.80(h) x 0.82(d)|
About the Author
Martin Bates is one of the leading authors specializing in introductory level texts on PIC microcontrollers for the academic, professional and hobby markets, with 20 years’ experience of teaching microprocessor systems.
Read an Excerpt
PIC MicrocontrollersAn Introduction to Microelectronics
By Martin Bates
NewnesCopyright © 2011 Martin Bates
All right reserved.
Chapter OneComputer Systems
1.1. Personal Computer System 5 1.1.1. PC Hardware 6 1.1.2. PC Motherboard 7 1.1.3. PC Memory 9 1.2. Word-Processor Operation 10 1.2.1. Starting the Computer 10 1.2.2. Starting the Application 10 1.2.3. Data Input 11 1.2.4. Data Storage 11 1.2.5. Data Processing 11 1.2.6. Data Output 12 1.3. Microprocessor Systems 13 1.3.1. System Operation 14 1.3.2. Program Execution 15 1.3.3. Execution Cycle 16 1.4. Microcontroller Applications 17 1.4.1. Microcontroller Application Design 17 1.4.2. Programming a Microcontroller 23 Questions 1 25 Activities 1 26
A microprocessor system consists of data input, storage, processing and output devices, under the control of a CPU.
The main unit of a desktop PC is a modular system, consisting of the motherboard, power supply and disk drives.
The motherboard carries the microprocessor (CPU), RAM, BIOS ROM, bus controllers and I/O interfaces.
The CPU communicates with the main system chips via a shared set of address and data bus lines.
The microcontroller provides most of the features of a conventional microprocessor system on one chip.
In this chapter, we will start with something familiar, looking at how a personal computer (PC) works when running a word processor, to establish a few technical concepts that are used in microcontrollers (MCUs). Hopefully, most readers will be familiar with this, and will know how the application functions from the user's point of view. Some basic microcontroller system ideas will be introduced by analyzing how software interacts with computer hardware, allowing the user to enter, store and process documents. For example, we will see why different kinds of memory are needed to support the system operation. If you are familiar with these concepts, you can skip this chapter.
The PC also provides the hardware platform for the PIC® program development system. The programs for the PIC are written using a text editor, and the machine code program is created and downloaded to the PIC chip using the PC. The PIC development system hardware can be seen connected in Figure 1.1. We will see how this works later.
We will also have a quick look at a basic microcontroller system, set up to operate as a simple equivalent of the microprocessor-based PC system, to see how it compares. Here, the microcontroller has a keypad with only 12 keys instead of a keyboard, and a seven-segment display instead of a screen. Its memory is much smaller than the PC, yet it can carry out the same basic tasks. In fact, it is far more versatile; the Intel™ processors used in the PC are designed specifically for that system. The microcontroller can be used in a great variety of circuits, and it is much cheaper.
1.1. Personal Computer System
The conventional desktop system comprises a main unit, separate keyboard and mouse, and monitor. The main unit has connectors for these (when wireless peripherals are not available) and universal serial bus (USB) ports for memory sticks, printers, scanners, etc., as well as hardwired (Ethernet), or wireless (Wi-Fi) network interfaces. The circuit board (motherboard) in the main unit carries a group of chips which work together to provide digital processing of information and control of input and output devices. A power supply for the motherboard and the peripheral devices is included in the main unit.
The laptop has the same components in a compact form, with integrated keyboard and screen, while tablet computers are even more compact with a touch-sensitive screen and no keyboard. The difference between a microprocessor and microcontroller system is illustrated quite well by comparing a desktop computer with a touch-screen game console or mobile phone. The facilities and applications are similar, they just differ in scale and complexity.
A block diagram (Figure 1.2a) is a good way to show such a system in simplified form, so we can identify the main components and how they connect. In the case of the disk drives and network, for example, the information flow is bidirectional, representing the process of saving data to, and retrieving data from, the hard disk or server. The internal architecture of a microcontroller is shown in its data sheet as a block diagram.
Any microprocessor or microcontroller system must have software to run on the hardware. In a desktop, this is stored on a hard disk inside the main unit; this can hold a large amount of data that is retained when the power is off. There are two main types of software required: the operating system (e.g. Microsoft® Windows) and the application (e.g. Microsoft® Word). As well as the operating system and application software, the hard disk stores the data created by the user, in this case, document files.
The keyboard is used for data input, and the screen displays the resulting document. The mouse provides an additional input device, allowing control operations to be selected from menus or by clicking on icons and buttons. This provides a much more user-friendly interface than earlier computers, which had a command-line interface. Then, actions were initiated by typing a text command such as 'dir' to show a directory (folder) of files. Network specialists still use this type of interface as it allows batch files (list of commands) to be created to control system operation. The network interface allows us to download data or applications from a local or remote server, or share resources such as printers over a local area network (LAN) and provide access to a wide area network (WAN), usually the Internet. In the domestic environment, a modem is currently needed to connect to the Internet via a telephone line or cable service. The network browser (e.g. Microsoft® Internet Explorer) is then another essential application.
1.1.1. PC Hardware
Inside the PC main unit (Figure 1.2b), the traditional motherboard has slots for expansion boards and memory modules to be added to the system. The power supply and disk drives are fitted separately into the main unit frame. The keyboard and mouse interface are integrated on the motherboard. In older designs, expansion boards carried interface circuits for the disk drives and external peripherals such as the display and printer, but these functions are now increasingly incorporated into the motherboard itself. Peripherals are now usually connected via USB or wirelessly.
The desktop PC is a modular system, which allows the hardware to be put together to meet the individual user's requirements, with components sourced from different specialist suppliers, and allows subsystems, such as disk drives and keyboard, to be easily replaced if faulty. This also allows easy upgrading (e.g. fitting extra memory chips) and also makes the PC architecture well suited to industrial applications. In this case, the PC can be 'ruggedized' (put into a more robust casing) for use on the factory floor. This modular architecture is one of the reasons for the success of the desktop PC hardware, which has continued in the same basic form for many years, as a universal processor platform. The laptop is the main alternative for the general user, but it is not so flexible, and tends to be replaced rather than upgraded. Another reason for its success is the dominance of Microsoft operating systems, which have developed in conjunction with the Intel-based hardware, providing a standard platform for domestic, commercial and industrial computers.
1.1.2. PC Motherboard
The main features of typical motherboards are shown in Figure 1.3. The heart of the system is the microprocessor, a single chip, or central processing unit (CPU). The CPU controls all the other system components, and must have access to a suitable program in memory before it can do anything useful. The blocks of program required at any one time are provided by both the operating system and the application software, which are downloaded to random access memory (RAM) from the hard disk as required. The programs consist of lists of machine code instructions (binary code) that are executed in sequence by the CPU.
The Intel CPU has undergone rapid and continuous development since the introduction of the PC in the early 1980s. Intel processors are classified as complex instruction set computer (CISC) chips, which means they have a relatively large number of instructions that can be used in a number of different ways. This makes them powerful, but relatively slow compared with processors that have fewer instructions; these are classified as reduced instruction set computer (RISC) chips, of which the PIC microcontroller is an example.
The CPU needs memory and input/output devices for getting data in, storing it and sending it out again. The main memory block is made up of RAM chips, which are generally mounted in Dual In-line Memory Modules (DIMMs). As far as possible, input/output (I/O) interfacing hardware is fitted on the motherboard (keyboard, mouse, USB, etc., preferably wireless), but additional peripheral interfacing boards may be fitted in the expansion card slots to connect the main board to extra disk drives and other specialist peripherals, traditionally using the PCI bus, a parallel data highway 32 bits wide.
All these parts are connected together via a pair of bus controller chips, which handle parallel data transfers between the CPU and the system. The 'northbridge' provides fast access to RAM and the graphics (screen) interface, while its partner, the 'southbridge', handles slower peripherals such as the disk drives, network and PCI bus. The motherboard itself can be represented as a block diagram (Figure 1.4) to show how the components are interconnected.
The block diagram shows that the CPU is connected to the peripheral interfaces by a set of bus lines. These are groups of connections on the motherboard, which work together to transfer the data from the inputs, such as the keyboard, to the processor, and from the processor to memory. When the data has been processed and stored, it can be sent to an output peripheral, such as the screen.
Buses connect all the main chips in the system together, but, because they mainly operate as shared connections, can only pass data to or from one peripheral interface or memory location at a time. This arrangement is used because separate connections to all the main chips would need an impossible number of tracks on the motherboard. The disadvantage of bus connection is that it slows down the program execution speed, because all data transfers use the same set of lines, and only one data word can be present on the bus at any one time. To help compensate for this, the bus connections are as wide as possible. For example, a 64-bit bus, operating at 100 MHz (108 Hz), can transfer 6.4 gigabits (6.4 × 109 bits) per second. The current generation of Intel® CPUs also use multiple (typically 4) 64-bit cores in one chip to improve performance.
1.1.3. PC Memory
There are two principal types of memory in the PC system. The main memory block is RAM, where input data is stored before and after processing in the CPU. The operating system and application program are also copied to RAM from disk for execution, because access to data in RAM is faster. Unfortunately, RAM storage is 'volatile', which means that the data and application software disappear when the PC is switched off, and these have to be reloaded each time the computer is switched back on.
Excerpted from PIC Microcontrollers by Martin Bates Copyright © 2011 by Martin Bates. Excerpted by permission of Newnes. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.
Table of Contents
A Simple PIC Application;
PIC Program Development;
PIC 16F84 Architecture;
Further Programming Techniques.
More PIC Microcontrollers;
More PIC Applications and Devices;
Other Control Systems.