81,99 €
Describing the use of displays in microcontroller based projects, the author makes extensive use of real-world, tested projects. The complete details of each project are given, including the full circuit diagram and source code. The author explains how to program microcontrollers (in C language) with LED, LCD and GLCD displays; and gives a brief theory about the operation, advantages and disadvantages of each type of display. Key features: * Covers topics such as: displaying text on LCDs, scrolling text on LCDs, displaying graphics on GLCDs, simple GLCD based games, environmental monitoring using GLCDs (e.g. temperature displays) * Uses C programming throughout the book - the basic principles of programming using C language and introductory information about PIC microcontroller architecture will also be provided * Includes the highly popular PIC series of microcontrollers using the medium range PIC18 family of microcontrollers in the book. * Provides a detailed explanation of Visual GLCD and Visual TFT with examples. * Companion website hosting program listings and data sheets * Contains the extensive use of visual aids for designing LED, LCD and GLCD displays to help readers to understand the details of programming the displays: screen-shots, tables, illustrations, and figures, as well as end of chapter exercises Using LEDs, LCDS, and GLCDs in Microcontroller Projects is an application oriented book providing a number of design projects making it practical and accessible for electrical & electronic engineering and computer engineering senior undergraduates and postgraduates. Practising engineers designing microcontroller based devices with LED, LCD or GLCD displays will also find the book of great use.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 437
Veröffentlichungsjahr: 2012
Contents
Cover
Title Page
Copyright
Preface
Acknowledgements
Chapter 1: Introduction to Microcontrollers and Display Systems
1.1 Microcontrollers and Microprocessors
1.2 Evolution of the Microcontroller
1.3 Parts of a Microcontroller
1.4 Display Devices
1.5 Summary
Exercises
Chapter 2: PIC18F Microcontrollers
2.1 The PIC18F2410 Microcontroller
2.2 PIC18F2410 Architecture
2.3 Summary
Exercises
Chapter 3: C Programming Language
3.1 C Languages for Microcontrollers
3.2 Your First mikroC Pro for PIC Program
3.3 Functions in mikroC Pro for PIC
3.4 mikroC Pro for PIC Built-in Functions
3.5 mikroC Pro for PIC Libraries
3.6 Using the mikroC Pro for PIC Compiler
3.7 Using the mikroC Pro for PIC Simulator
3.8 Other mikroC Pro for PIC Features
3.9 Summary
Exercises
Chapter 4: PIC Microcontroller Development Tools – Including Display Development Tools
4.1 PIC Hardware Development Boards
4.2 PIC Microcontroller Display Development Tools
4.3 Using the In-Circuit Debugger with the EasyPIC7 Development Board
4.4 Summary
Exercises
Chapter 5: Light Emitting Diodes (LEDs)
5.1 A Typical LED
5.2 LED Colours
5.3 LED Sizes
5.4 Bi-Colour LEDs
5.5 Tri-Colour LEDs
5.6 Flashing LEDs
5.7 Other LED Shapes
5.8 7-Segment LEDs
5.9 Alphanumeric LEDs
5.10 mikroC Pro for PIC 7-Segment LED Editor
5.11 Summary
Exercises
Chapter 6: Liquid Crystal Displays (LCDs) and mikroC Pro for PIC LCD Functions
6.1 HD44780 Controller
6.2 Displaying User Defined Data
6.3 DDRAM Addresses
6.4 Display Timing and Control
6.5 LCD Initialisation
6.6 Example LCD Display Setup Program
6.7 mikroC Pro for PIC LCD Functions
6.8 Summary
Exercises
Chapter 7: Graphics LCD Displays (GLCD)
7.1 The 128 × 64 Pixel GLCD
7.2 Operation of the GLCD Display
7.3 mikroC Pro for PIC GLCD Library Functions
7.4 Example GLCD Display
7.5 mikroC Pro for PIC Bitmap Editor
7.6 Adding Touch-screen to GLCDs
7.7 Summary
Exercises
Chapter 8: Microcontroller Program Development
8.1 Using the Program Description Language and Flowcharts
8.2 Examples
8.3 Representing for Loops in Flowcharts
8.4 Summary
Exercises
Chapter 9: LED Based Projects
9.1 PROJECT 9.1 – Flashing LED
9.2 PROJECT 9.2 – Binary Counting Up LEDs
9.3 PROJECT 9.3 – Rotating LEDs
9.4 PROJECT 9.4 – Wheel of Lucky Day
9.5 PROJECT 9.5 – Random Flashing LEDs
9.6 PROJECT 9.6 – LED Dice
9.7 PROJECT 9.7 – Connecting more than one LED to a Port Pin
9.8 PROJECT 9.8 – Changing the Brightness of LEDs
9.9 PROJECT 9.9 – LED Candle
9.10 Summary
Exercises
Chapter 10: 7-Segment LED Display Based Projects
10.1 PROJECT 10.1 – Single Digit Up Counting 7-Segment LED Display
10.2 PROJECT 10.2 – Display a Number on 2-Digit 7-Segment LED Display
10.3 PROJECT 10.3 – Display Lottery Numbers on 2-Digit 7-Segment LED Display
10.4 PROJECT 10.4 – Event Counter Using 4-Digit 7-Segment LED Display
10.5 PROJECT 10.5 – External Interrupt Based Event Counter Using 4-Digit 7-Segment LED Display with Serial Driver
10.6 Summary
Exercises
Chapter 11: Text Based LCD Projects
11.1 PROJECT 11.1 – Displaying Text on LCD
11.2 PROJECT 11.2 – Moving Text on LCD
11.3 PROJECT 11.3 – Counting with the LCD
11.4 PROJECT 11.4 – Creating Custom Fonts on the LCD
11.5 PROJECT 11.5 – LCD Dice
11.6 PROJECT 11.6 – Digital Voltmeter
11.7 PROJECT 11.7 – Temperature and Pressure Display
11.8 PROJECT 11.8 – The High/Low Game
11.9 Summary
Exercises
Chapter 12: Graphics LCD Projects
12.1 PROJECT 12.1 – Creating and Displaying a Bitmap Image
12.2 PROJECT 12.2 – Moving Ball Animation
12.3 PROJECT 12.3 – GLCD Dice
12.4 PROJECT 12.4 – GLCD X-Y Plotting
12.5 PROJECT 12.5 – Plotting Temperature Variation on the GLCD
12.6 PROJECT 12.6 – Temperature and Relative Humidity Measurement
12.7 Operation of the SHT11
12.8 Acknowledgement
12.9 Summary
Exercises
Chapter 13: Touch Screen Graphics LCD Projects
13.1 PROJECT 13.1 – Touch Screen LED ON-OFF
13.2 PROJECT 13.2 – LED Flashing with Variable Rate
13.3 Summary
Exercises
Chapter 14: Using the Visual GLCD Software in GLCD Projects
14.1 PROJECT 14.1 – Toggle LED
14.2 PROJECT 14.2 – Toggle more than One LED
14.3 PROJECT 14.3 – Mini Electronic Organ
14.4 PROJECT 14.4 – Using the SmartGLCD
14.5 PROJECT 14.5 – Decimal to Hexadecimal Converter using the SmartGLCD
14.6 Summary
Exercises
Chapter 15: Using the Visual TFT Software in Graphics Projects
15.1 PROJECT 15.1 – Countdown Timer
15.2 PROJECT 15.2 – Electronic Book
15.3 PROJECT 15.3 – Picture Show
15.4 Summary
Exercises
Bibliography
Index
This edition first published 2012
© 2012, John Wiley & Sons, Ltd
Registered office
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com.
The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought.
Library of Congress Cataloging-in-Publication Data
Ibrahim, Dogan.
Using LEDs, LCDs, and GLCDs in microcontroller projects / Dogan Ibrahim.
p. cm.
Includes bibliographical references and index.
ISBN 978-1-119-94070-8 (cloth)
1. Information display systems. 2. Liquid crystal devices–Automatic control. 3. Light emitting diodes–Automatic control. 4. Microcontrollers.
I. Title.
TK7882.I6I185 2012
629.8′9–dc23
2012009481
A catalogue record for this book is available from the British Library.
Print ISBN: 9781119940708
Preface
A microcontroller is a single chip microprocessor system, which contains data and program memory, serial and parallel I/O, timers, and external and internal interrupts, all integrated into a single chip that can be purchased for as little as £2.00. About 40% of microcontroller applications are in office automation, such as PCs, laser printers, fax machines, intelligent telephones, and so on. About one-third of microcontrollers are found in consumer electronic goods. Products such as CD players, hi-fi equipment, video games, washing machines, cookers and so on fall into this category. The communications market, automotive market and the military share the rest of the application areas.
Input and output are very important parts of any microcontroller system. Typical input devices are push-button switches, keypads and various analog and digital sensors. Typical output devices are Light Emitting Diodes (LEDs), Liquid Crystal Displays (LCDs), Graphics Liquid Crystal Displays (GLCDs), motors, actuators, buzzers, and so on. This book is about the theory and applications of display devices in microcontroller based systems. The book explains briefly the theory of the commonly used display devices, namely LEDs, 7-Segment LED displays, LCDs, monochrome GLCDs and TFT based colour LCDs. In addition, the use of each display device is explained with several working and tested projects. The description, block diagram, circuit diagram, operation and full program code of all the projects are given. PIC18F series of high-end microcontrollers are used in all the projects. The projects are developed using the highly popular mikroC Pro for PIC compiler. Knowledge of the C programming language will be useful. Also, familiarity with at least one member of the PIC16F series of microcontrollers will be an advantage. The knowledge of assembly language programming is not required because all the projects in the book are based on using the C language.
This book is written for students, for practising engineers and for hobbyists interested in developing display based projects using the PIC series of microcontrollers.
Chapter 1 presents the basic features of microcontrollers and the basic features of display devices used in such systems.
Chapter 2 provides a review of the PIC18 series of microcontrollers. Various features of these microcontrollers are described in detail. The PIC18F2410 is chosen as a typical microcontroller.
Chapter 3 provides a short tutorial on the C language and then examines the features of the mikroC Pro for PIC compiler used in PIC series of microcontrollers.
Chapter 4 is about the important topic of microcontroller development tools. Both the software and hardware development tools are described in detail. In addition, the use of microcontroller simulators and in-circuit debuggers are described with examples.
Chapter 5 provides the basic theory of LEDs. The use of simple LEDs and 7-Segment simple and multiplexed LEDs are explained with examples.
Chapter 6 provides some simple projects using the PIC18 series of microcontrollers and the mikroC Pro for PIC C language compiler. All the projects in this chapter are based on the PIC18F452 microcontroller and all the projects have been tested and are working. This chapter should be useful for those who are new to PIC microcontrollers, and for those who want to extend their knowledge of programming PIC18F series of microcontrollers using the mikroC Pro for PIC language.
Chapter 7 covers the theory of LCD displays. The basic working principles of LCDs and the mikroC Pro for PIC built-in LCD functions are explained with several examples.
Chapter 8 is about the Program Development Language (PDL) used to describe the operation of software in general. Various building blocks of the PDL are described in this chapter.
Chapter 9 provides simple LED based projects, ranging from LED flashing to more complex LED projects.
Chapter 10 is about 7-Segment LED based projects. Several single digit and multiplexed working and tested projects are given in this chapter with full source code.
Chapter 11 provides several text based LCD projects. The use of LCDs is described in this chapter through simple and complex projects, ranging from displaying simple text on an LCD to developing an LCD based voltmeter project.
Chapter 12 is about the use of GLCDs in microcontroller projects. The use of standard monochromatic 128 × 64 pixel GLCD is used in the projects in this chapter.
Touch screen displays are important application areas of microcontrollers. Chapter 13 gives several projects on using touch screens in graphics applications.
The Visual GLCD software package is used for the development of projects based on several different types of monochromatic GLCD displays. Chapter 14 explains the use of this software package and gives the steps required to develop GLCD based applications. Several projects are given in this chapter using the Visual GLCD software package with both 128 × 64 pixel and 240 × 128 pixel GLCD displays.
Finally, Chapter 15 is about the Visual TFT software package used for the development of TFT based colour graphics applications. The chapter describes the steps required to create microcontroller based TFT graphics applications using the MikroMMB graphics development board.
Dogan IbrahimLondon, 2012
Acknowledgements
The following material is reproduced in this book with the kind permission of the respective copyright holders and may not be reprinted, or reproduced in any way, without their prior consent.
Figures 2.1–2.6, 2.10, 2.11, 2.13, 2.17, 2.28, 2.30, 2.32–2.37 are taken from Microchip Technology Inc. Data Sheet PIC18F2X1X/4X1X (DS39636D). Figures 4.2–4.4 are taken from the web site of Microchip Technology Inc.
Figure 4.1 is taken from the web site of microEngineering Labs Inc.
Figure 4.5 and 4.6 are taken from the web site of Custom Computer Services Inc.
Figure 4.7 is taken from the web site of Futurlec Inc.
Figures 4.8 and 4.9 are taken from the web site of mikroElektronica.
PIC®, PICSTART® and MPLAB® are all trademarks of Microchip Technology Inc.
Chapter 1
Introduction to Microcontrollers and Display Systems
The basic building blocks of any digital computer are the central processing unit (CPU), the memory and the input-output (I/O). The CPU is like the human brain, as it controls all internal operations of the computer. Instructions are fetched from the memory under the control of the CPU, which it then decodes and controls various internal parts of the computer so that the required operations are performed. The CPU also includes an arithmetic and logic unit (ALU), which is used to perform mathematical and logical operations. The result of an operation is stored either in the memory, in a temporary register, or is sent to an I/O port. Two types of memories are used in a computer, as far as memory functionality is concerned. The program memory stores the user instructions and this memory is normally non-volatile, that is the data is not lost after removal of the power. The second type of memory is the data memory, which stores the temporary user data, such as the result of an operation. The I/O ports allow the computer to communicate with the external world. For example, a keyboard is an input device, enabling the user to enter data to the computer. Similarly, a printer is an output device, enabling the user to print out a hard copy of data in paper form. Depending on the actual application and the requirements, a computer may include additional components, such as timers, counters, interrupt logic, clock logic, and so on.
A computer program consists of a collection of instructions for performing a specific task. In the early days of computers, programs were written in Assembly language, which was a short way of specifying instructions using words called mnemonics. Although Assembly language was fast, it had several disadvantages. Writing a long and complex program using Assembly language was difficult. More importantly, it was difficult to maintain a program written in Assembly language. Also, different processors had different instruction sets and different Assembly language instructions, resulting in no portability. Consequently, it was a tedious task to convert a program written for one processor to function on another processor. Over the last decade, nearly all programs have been written using a high level language such as C, BASIC or Pascal. High level languages have several advantages. First, learning to program in a high level language is easy. Second, the developed code is highly portable. For example, a C program written for a processor can easily be modified to work on another type of processor. This is true, even if the two processors are manufactured by different vendors. Third, high level programs are much easier to develop and maintain.
A microcontroller is basically a single chip computer, generally requiring no external components. A microprocessor differs from a microcontroller in many ways. Perhaps the main difference is that a microcontroller can function as a computer without the need of any external hardware. A microprocessor, on the other hand, is just the CPU of a computer, and requires several other external components before it becomes a useful computer. Because a microcontroller consists of a single chip, its power consumption is low. The development of a microcontroller based system is also easy, as the processing hardware consists of a single chip. Perhaps the only advantage of a microprocessor over a microcontroller is that a microprocessor can easily be expanded to have more memory or I/O. The expansion of microcontrollers is more difficult and a different model is usually chosen when higher performance, more memory or more I/O are required.
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!