This book is a collection of projects based around various microcontrollers from the PIC family. The reader is carefully guided through the book, from very simple to more complex projects in order to gradually build their knowledge about PIC microcontrollers and digital electronics in general. On completion of this book, the reader should be able to design and build their own projects and solve other practical problems in digital electronics.
Many books in this area are theory based and can tend toward being overly explanatory in their approach to the subject. Courses are moving towards being more practically oriented and this book provides the ideal companion to students completing projects with PIC microcontrollers.
Die Inhaltsangabe kann sich auf eine andere Ausgabe dieses Titels beziehen.
Hassan Parchizadeh is a principal lecturer at the University of Portsmouth. He has been lecturing for over 20 years and currently teaches a number of subjects including microcontrollers, power electronics and signal processing. He as also published two books on microcontrollers.
Dr. Branislav Vukanovic is a senior lecturer at the University of Portsmouth, previously he was a lecturer and the University of Derby and a research fellow at the University of Sheffield. He teaches in the areas of digital electronics, microprocessors and digital signal processing. He has published a significant number of papers in his fields.
1.1 Introduction 1.2 Overview of PIC Microcontroller 1.3 Basics of PIC Assembly Language 1.4 Introduction to C Programming for PIC Microcontroller 1.5 MPLAB Integrated Development Environment (IDE) 1.6 Advanced Debugger Features - Stimulus
1.1 Introduction
The aim of this chapter is to consider a number of issues that need to be taken into account before doing almost any microcontroller-based project. First, the reader will be introduced to a PIC (programmable interface controller) microcontroller by a brief discussion of one of the models from the PIC microcontroller family - the PIC16F627A. This model is now a common choice for low-cost PIC projects and has practically replaced the very popular PIC16F84 model. The PIC16F627A is therefore a choice for a large number of projects from this book although some other simpler and more complex models are also being used. The rest of the PIC family will be considered briefly, introducing some other models used for the projects in this book. We will then discuss the basics of two programming languages commonly used to develop PIC programs in practice and throughout this book - assembly and C. This will by no means be a detailed discussion of those two languages; a separate book would be needed for that. The aim instead is to provide a short overview of the basic features of both languages and to enable readers to learn the rest of it while doing projects from the other chapters of this book. Material covered in this chapter should therefore be sufficient to allow the reader to start with the first programs and projects from Chapter 2 and gradually build knowledge to domore complex projects fromthe rest of the book. Finally, we will demonstrate how to develop and test a simple PIC program using the MPLAB(r) -Integrated Development Environment (IDE).
1.2 Overview of PIC Microcontroller
The name PIC denotes several families of microcontrollers manufactured by Microchip Technology. This range is huge and very versatile so discussing even a small number of microcontrollers would be a difficult and time-consuming task. Instead, in this section, we will concentrate on the basic features and layout of one of the most popular members of the mid-range PIC16 family: PIC16F627A. Once the basic features of this device are explained it will be easier to introduce and understand the operations of more complex PICs used in later chapters of this book.
1.2.1 PIC16F627 Building Blocks
Every computer system, however complicated or simple, consists of a number of common building blocks. Those are: the CPU (central processing unit or microprocessor) block, the memory block (RAM and ROM) and the input/output (I/O) block (interface circuitry). The CPU performs all the logic and arithmetic functions; memory is used to store programs and data while the interface provides means of communication and data exchange between the microcomputer system and the external world.
A microcontroller is a stripped-down version of the computer system architecture with one important difference - all of the system blocks are placed on one chip. The microcontroller-based system therefore requires very little additional circuitry for its proper operation. All that is needed in most cases is a clock input to provide timing for the system operation.
The PIC16F27A microcontroller contains all of the previously mentioned blocks. Components of this microcontroller, described in slightly more detail, are:
The CPU. The 'brain' of a microcontroller. It is responsible for finding and fetching the right instruction to be executed, for decoding that instruction, and finally for its execution.
Memory. Split into two physically separate blocks - program and data memory. This so-called Harvard architecture is used to speed up the operation of the microcontroller as both data and instructions can be fetched from separate memories using separate buses simultaneously.
Program memory. Used to store a program to be executed in the central processing unit of the microcontroller. It is of flash type so the microcontroller can be programmed many times before a system developer is happy with its performance and the programmed PIC is finally installed into some bigger system. If the power to the microcontroller is switched off, the content of the flash-type memory is not lost. The size of the program memory on the PIC16F27A is 1024 words (1 kwords), where one word holds 14 bits.
Data memory. Used to store microcontroller data. It is further divided into EEPROM and RAM memory: EEPROM memory holds important data that need to be saved when there is no power supply to the microcontroller; RAM is used by a program to store inter-results or temporary data during the program execution. EEPROM contains 128 bytes of data whereas RAM holds 224 bytes (1 byte contains 8 bits so the widths of program and data memories are different).
PORTA and PORTB. Physical connections between the microcontroller and the outside world. Both of those ports have eight pins and those pins are bidirectional - they can be used for input or output of data provided they are properly configured as input or output pins in the program. The exception is pin 5 of port A (RA5), which is an input-only type pin. Two special function registers within PIC, TRISA and TRISB, control the direction of the port pins. Writing '1' in the particular bit of the TRISA register configures the corresponding pin of port A as an input pin; '0' in TRISA makes it an output pin. The same is true for the port B pins and TRISB register. Some of these port pins are multiple-purpose pins and can be used for other peripheral functions of the processor. This will be explained in more detail in Section 1.2.3 where the layout (pin out) of the PIC16F27A chip is discussed.
The PIC blocks mentioned above communicate through a complex system of communication lines called buses. The data buses are used for the transfer of data through the system and address buses communicate addresses of data and program instructions to be accessed during program execution. Various other communication lines exist in the PIC and those are usually referred to as control bus lines. Note that since two separate memories exist in the PIC, both data and address bus systems are doubled, i.e. PIC16F27A (Figure 1.1) has a data memory (DM) address bus as well as program memory (PM) address bus. Similarly, this processor also has a DM data bus and PM data bus.
1.2.2 EEPROM and RAM Memories on PIC16F27A
The EEPROM memory on the PIC16F27A holds 128 bytes of non-volatile information. This memory is electronically programmable so it is not a fast RAM-type memory and it can be awkward to access it within the program. It is normally used to store data that is not frequently changed.
The RAM memory on the PIC16F27A is actually split into four memory banks where each bank holds access to 80 memory locations. This, however, does not mean that the total capacity of the RAM memory on the PIC16F27A is 320 bytes. It is more complicated than that. Here is the explanation.
This memory can be considered to consist of two different types of registers - special...
„Über diesen Titel“ kann sich auf eine andere Ausgabe dieses Titels beziehen.
Anbieter: Shakespeare Book House, Rockford, IL, USA
Zustand: new. Bestandsnummer des Verkäufers EBBV.0470694610.N
Anzahl: 1 verfügbar
Anbieter: WeBuyBooks, Rossendale, LANCS, Vereinigtes Königreich
paperback. Zustand: Like New. Most items will be dispatched the same or the next working day. An apparently unread copy in perfect condition. Dust cover is intact with no nicks or tears. Spine has no signs of creasing. Pages are clean and not marred by notes or folds of any kind. Bestandsnummer des Verkäufers rev3328550642
Anzahl: 1 verfügbar
Anbieter: PBShop.store UK, Fairford, GLOS, Vereinigtes Königreich
PAP. Zustand: New. New Book. Shipped from UK. Established seller since 2000. Bestandsnummer des Verkäufers FW-9780470694619
Anzahl: 15 verfügbar
Anbieter: Brook Bookstore On Demand, Napoli, NA, Italien
Zustand: new. Bestandsnummer des Verkäufers af12f33fb0422e50d96f245938eab970
Anzahl: Mehr als 20 verfügbar
Anbieter: GreatBookPrices, Columbia, MD, USA
Zustand: New. Bestandsnummer des Verkäufers 5509684-n
Anzahl: Mehr als 20 verfügbar
Anbieter: GreatBookPrices, Columbia, MD, USA
Zustand: As New. Unread book in perfect condition. Bestandsnummer des Verkäufers 5509684
Anzahl: Mehr als 20 verfügbar
Anbieter: THE SAINT BOOKSTORE, Southport, Vereinigtes Königreich
Paperback / softback. Zustand: New. This item is printed on demand. New copy - Usually dispatched within 5-9 working days. Bestandsnummer des Verkäufers C9780470694619
Anzahl: Mehr als 20 verfügbar
Anbieter: GreatBookPricesUK, Woodford Green, Vereinigtes Königreich
Zustand: New. Bestandsnummer des Verkäufers 5509684-n
Anzahl: Mehr als 20 verfügbar
Anbieter: Ria Christie Collections, Uxbridge, Vereinigtes Königreich
Zustand: New. In English. Bestandsnummer des Verkäufers ria9780470694619_new
Anzahl: Mehr als 20 verfügbar
Anbieter: Chiron Media, Wallingford, Vereinigtes Königreich
Paperback. Zustand: New. Bestandsnummer des Verkäufers 6666-IUK-9780470694619
Anzahl: 10 verfügbar