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.
Dogan Ibrahim, Department of Computer Engineering, Near East University,Cyprus Professor Ibrahim is currently Head of the Department of Computer Engineering at Near East University, Cyprus. He has been a lecturer at Near East University since 1999, and prior to this held a range of roles including Principal Research Engineer at GEC Hirst Research Centre, London and Lecturer at South Bank University, London. He is an IEE Fellow.
Chapter 2
PIC18F Microcontrollers
PIC is a family of Harvard architecture microcontrollers (except the 32-bit devices) manufactured by Microchip Technology Inc. PIC microcontrollers are available in over 1000 models. Depending upon the data width used, we can classify these microcontrollers in three groups: 8-bit, 16-bit and 32-bit microcontrollers. Figure 2.1 shows an overview of the PIC series of microcontrollers.
Figure 2.1 PIC microcontroller series
The PIC 10, 12, 16 series are the low-end 8-bit microcontrollers with low speed, low pin count, low cost, small memories, with only 35 instructions, making them easy to learn and program. PIC18 series are medium-end 8-bit microcontrollers with medium speed, higher pin count, large memories, and having over 80 instructions. These microcontrollers include various on-chip modules, such as CAN, USB, SPI, multiple USARTs, several timers, multiplier hardware, and clock speeds up to 40 MHz. These microcontrollers are currently used in most new complex PIC microcontroller projects. PIC24 and dsPIC series are 16-bit high-speed microcontrollers with large memories and peripheral support, designed for time-critical applications where real-time processing is very important. These microcontrollers find applications in digital signal processing (DSP) and in high-speed automatic digital control systems. The architectures of these 16-bit microcontrollers are different to the 8-bit microcontrollers, as they are configured for high-speed processing required in DSP applications, having fast multiplication and addition modules (MACs).
The new PIC32 microcontroller family are 32-bit processors with standard Von Neumann architecture, having large memories and peripheral support, offering very high speed processing in highly precision applications. One of the advantages of PIC microcontrollers is that they support easy migration across product families. For example, a project designed using a PIC16 series microcontroller can easily be upgraded to use a PIC18 series microcontroller. This is especially true if the development was carried out using a high-level language such as C, which is compatible across all the 8-bit families.
Currently, most medium-speed general purpose projects with graphical display requirements are based on the PIC18F series, as they provide the required speed, large data and program memories, and large number of input-output capabilities.
PIC18 microcontrollers are available in many models, from small 18-pin chips to 100-pin chips, program memories from 4 KB to 128 KB, data memories from 256 bytes to 4 KB, and input-output pins from 15 to 70.
In this chapter we look in detail at the architecture of a medium-end PIC18 microcontroller, namely the PIC18F2410, as it will be necessary to know the basic architecture of the PIC18 series of microcontrollers when we begin creating display based projects in later chapters. The reason for choosing the PIC18F2410 is because it is a low-cost, yet powerful microcontroller, having only 28 pins, and its architecture can be considered as representative of the PIC18F series.
2.1 The PIC18F2410 Microcontroller
The PIC18F2410 microcontroller belongs to the family PIC18F2X1X/4X1X. There are 8 microcontrollers in this family, with slightly different specifications. Table 2.1 gives the basic specifications of the microcontrollers in this family.
Table 2.1 The PIX18F2X1X/4X1X microcontroller family.
The basic features of the PIC18F2410 microcontroller are:
- 16 KB program memory;
- 768 bytes data memory;
- 25 I/O pins;
- each I/O pin has 25 mA source/sink capability;
- 10-bit 10 channel A/D converters;
- 18 interrupt sources;
- interrupt priority levels;
- 4 timers;
- DC to 40 MHz operating frequency;
- capture/compare/PWM modules;
- USART module;
- master synchronous serial port module (MSSP);
- low-voltage detection module (LVD);
- power-on reset (POR), power-up timer (PWRT), oscillator startup timer (OST);
- watchdog timer (WDT);
- 75 instructions (83 with extended instruction set enabled);
- 20 nA current consumption in sleep mode (CPU and peripherals off);
- 28-pin package.
2.2 PIC18F2410 Architecture
The pin configuration (DIP package) of the PIC18F2410 microcontroller is shown in Figure 2.2. As we shall see later, most of the pins are multiplexed and can be used for different purposes. For example, pin 2 is named as RA0/AN0 and this is the PORT A least significant port pin. This pin can be used as an analogue input (named AN0), or as a digital I/O (named RA0).
Figure 2.2 PIC18F2410 pin configuration (DIP package). (Reproduced with permission from Microchip Inc)
Figure 2.3 shows the simplified internal architecture of the PIC18F2410 microcontroller. The CPU is at the centre of the diagram and consists of an 8-bit ALU, an accumulator register (WREG), and an 8 × 8 multiplier module. The multiplier takes data from the accumulator register and the data bus, and provides the 16-bit result in registers PRODH and PRODL, where the result can be read through the data bus.
Figure 2.3 Internal architecture of the PIC18F2410 microcontroller. (Reproduced with permission from Microchip Inc)
The program memory and the program counter are shown at the top left corner of the figure. The memory address consists of 21 bits, capable of addressing up to 2 MB of memory data, although here only 16 KB is used. The program counter consists of two 8-bit registers PCH and PCL, and a 5-bit register PCU. A 32-level deep stack can be seen at the bottom of the program counter. The stack is used to store the return addresses when a subroutine is called or when an interrupt occurs. The stack is independent of the data memory and is addressed with a 5-bit stack pointer STKPTR. The stack pointer is initialised to 00 000 after a reset.
The data memory can be seen at the top right corner of the figure. The data addresses are 12 bits, thus up to 4 KB data can be addressed, although here only 768 bytes of data memory are implemented.
The instruction decode and control logic, located at the centre of the figure, decodes the instructions fetched from the program memory and sends the appropriate control signals to all parts of the microcontroller to implement the required operation.
Just below the instruction decode and control logic, we see the timing and power control module. This module is responsible for generating the clock timing pulses for both the external and internal clock. In addition, this module controls the power-on timer, oscillator startup, POR, watchdog timer, brown-out reset, single-supply programming, in-circuit debugger, and the fail safe clock monitoring.
At the bottom of the figure we can see the four timer modules, comparator/capture/pwm modules, master synchronous serial port module (MSSP), USART module, and the A/D converter module.
There are 4 I/O ports named PORTA, PORTB, PORTC and PORTE, and 25 I/O pins shown at the right side of the figure. PORTA, PORTB and PORTC are 8-bit ports, while PORTE has only 1 bit. All ports pins are bi-directional when configured as digital I/O.
2.2.1 The Program Memory
Figure 2.4 shows a memory map of the PIC18F2410 microcontroller. The device has a 21-bit program counter (PC <20: 0>), capable of addressing up to 2 MB of memory, although here only 16 KB is used, ranging from 00 000 h to 03 FFFh. Memory addresses above 0400 h are read as 0 and are not available. The Reset vector is at address 00 000 h and the program counter is loaded with this address after a reset, causing the program starting at this address to be executed. Addresses 00 008 h and 00 018 h are the high and low priority interrupt vectors, respectively. Thus, for example, when a low priority interrupt occurs, the program jumps to address 00 008 h.
Figure 2.4 Program memory map of the PIC18F2410 microcontroller. (Reproduced with permission from Microchip Inc)
An instruction cycle in an 8-bit PIC microcontroller consists of 4 cycles (Q1 to Q4). A fetch cycle begins with the program counter incrementing in Q1. The fetched instruction is decoded and executed in cycles Q2, Q3 and Q4. A data memory location is read during the Q2 cycle and written during the Q4 cycle. Because an instruction cycle consists of 4 cycles, the performance of a PIC microcontroller is measured by dividing the operating clock frequency by 4. For example, a processor operating with a 40 MHz clock frequency has a MIPS (Million Instructions Per Second) rating of 10 MIPS.
2.2.2 The Data Memory
Figure 2.5 shows the data memory of the PIC18F2410 microcontroller. Data memory is addressed with 12 bits, capable of addressing up to 4 KB of memory. The memory is usually divided into 16 banks, each bank 256 bytes long. The PIC18F2410 microcontroller uses only the first 3 banks (BANK 0, BANK 1 and BANK 2) from address 000 h to 2 FFh. The remaining banks, except half of BANK 15, are not used and return 0 when accessed. The upper part of BANK 15 is reserved for the SFR (Special Function Registers) registers. SFR registers control internal modules of the microcontrollers, such as A/D converter, interrupts, timers, USART, I/O ports, and so on.
Figure 2.5 Data memory map of the PIC18F2410 microcontroller. (Reproduced with permission from Microchip Inc)
2.2.3 Power Supply Requirements
The PIC18F2410 microcontroller operates with a power supply of 4.2 to 5.5 V, at...
| Erscheint lt. Verlag | 22.8.2012 |
|---|---|
| Sprache | englisch |
| Themenwelt | Informatik ► Weitere Themen ► Hardware |
| Technik ► Elektrotechnik / Energietechnik | |
| Schlagworte | author • author explains • Brief • Code • Computer Engineering • Computertechnik • Details • diagram • Displays • Electrical & Electronics Engineering • Electrical Engineering - Displays • Elektronische Displays • Elektrotechnik u. Elektronik • Embedded Systems & Smart Cards • Embedded Systems u. Smart Cards • extensive • full • Games • GLCD • glcds • graphics • language • LCDs • LED • Microcontroller • Microcontrollers • Mikrocontroller • Operation • Program • Projects • realworld • theory • Topics • Type • use |
| ISBN-13 | 9781118361030 / 9781118361030 |
| Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
| Haben Sie eine Frage zum Produkt? |
Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich