- Shopping Bag ( 0 items )
PIC Microcontrollers provides a comprehensive and fully illustrated introduction to microelectronic systems principles using the best-selling PIC16 range. Building on the success of previous editions, this third edition will enable readers to understand PIC products and related programming tools, and develop relevant design skills in order to successfully create new projects. Key features include:
The book is aimed principally at students of electronics on advanced vocational and undergraduate courses, as well as home enthusiasts and professional engineers seeking to incorporate microcontrollers into industrial applications.
Audience: First / second year undergraduate courses in microelectronics e.g. Microelectronic Systems; Introduction to Microprocessor / Microcontrollers Systems; introductory Embedded Systems Design; Control Electronics. Student projects using the PIC. Electronics engineers (including embedded systems designers, control engineers), technicians in industry, hobbyists.
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.
Preface Introduction Chapter 1 Computer Systems Chapter 2 Microcontroller Operation Chapter 3 A Simple PIC Application Chapter 4 PIC Program Development Chapter 5 Internal Architecture Chapter 6 Programming Techniques Chapter 7 Development Systems Chapter 8 Application Design Chapter 9 Program Debugging Chapter 10 Hardware Prototyping Chapter 11 Motor Applications Chapter 12 More PIC Microcontrollers Chapter 13 More PIC Applications Chapter 14 More Control Systems Appendix A: Binary Numbers Appendix B: Microelectronic Devices Appendix C: Digital Systems Appendix D: DIZI84 Board Appendix E: DIZI690 Board References & Links Index