Download presentation
Presentation is loading. Please wait.
1
Microprocessor and Microcontroller Based Systems
بسم الله الرحمن الرحيم The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department Microprocessor and Microcontroller Based Systems EELE 4315 — Fall 2010 Instructor: Eng.Moayed N. EL Mobaied Lecture 3
2
Microcontroller
3
Microcontroller Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices.
4
Microcontroller A microcontroller is a microprocessor designed to perform simple control functions. Microcontrollers usually have these features low cost, physically small, input/output intensive, and capable of easy interfacing, limited memory capability for program and data, instruction set leading to compact code, with limited arithmetic capability, ability to operate in a real-time environment. In certain applications the following further features are essential: ability to operate in hostile environment, e.g. high or low temperature, tolerant to electromagnetic interference, low power, with features adapted to battery power.
5
Microcontroller A microcontroller = microprocessor core + memory + peripherals
6
Microcontroller PIC is a family of microcontrollers made by Microchip Technology. The original one was the PIC1650 developed by General Instruments. This device was called: PIC for “Programmable Intelligent Computer” although it is now associated with “Programmable Interface Controller.” Microchip does not use PIC as brand name . Instead they prefer the brand name PICmicro. PIC is a registered brand in Germany and Microchip is unable to use it internationally.
7
Microcontroller The original PIC was built to be used with General Instruments’ CP1600 processor, which had poor I/O performance. The PIC was designed to take over the I/O tasks for the CPU, thus improving performance. In 1985, the PIC was upgraded with EPROM to produce a programmable controller. Today, a huge variety of PICs are available with many different on-board peripherals and program memories ranging from a few hundred words to 32K.
8
Microcontroller PICs use an instruction set that varies in length from about 35 instructions for the low-end PICs to more than 70 for the high-end devices. The PICs are programmable in their native Assembly Language, which is straightforward and not difficult to learn. In addition, C language and BASIC compilers have been developed for the PIC. Open-source Pascal, JAL, and Forth compilers are also available for PIC programming.
9
Microcontroller interface
10
Microcontroller applications
Digital Integrated Circuit Electronics Design Analogue Electronics Computer Architecture Microcontroller Sensors and Software Engineering Measurements Data Electric Motors & Communications Actuators Control Engineering
11
PIC Microcontroller Architecture
Central Processing Unit (CPU) Data Memory Input/ Output Program Address Data Memory Program Address Central Processing Unit (CPU) Input/ Output a) The Von Neumann Way b) The Harvard Way
12
Instructions and Instruction Sets
A computer “executes” instructions in its Arithmetic Logic Unit (ALU), running through a series of instructions called a program. An ALU can only do a few things, but it can do them very fast. A typical 8-bit ALU can do the list shown below. A is the “Accumulator”, a digital register where the computations actually occur, and M is a location in memory. The ALU in turn forms part of the Central Processing Unit (CPU).
13
How Instruction Sets are Made: the “CISC” Machine
Any CPU has a set of instructions that it recognizes and responds to; all programs are built up in one way or another from this instruction set. We want computers to execute code as fast as possible, but how to achieve this aim is not always an obvious matter. One approach is to build sophisticated CPUs with exotic instruction sets, with an instruction ready for every foreseeable operation. This leads to the CISC, the Complex Instruction Set Computer. A CISC has many instructions, and considerable sophistication. Yet the complexity of the design needed to achieve this tends to lead to slow operation. One characteristic of the CISC approach is that instructions have different levels of complexity. Simple ones can be expressed in a short instruction code, say one byte of data, and execute quickly. Complex ones may need several bytes of code to define them, and take a long time to execute. A CISC machine is generally recognised by: Many instructions (say over one hundred), some with considerable sophistication; Instruction words are of different length; Instructions take different lengths of time to execute.
14
How Instruction Sets are Made: the “RISC” Machine
Another approach is to keep the CPU very simple, and have a limited instruction set. This leads to the RISC approach – the Reduced Instruction Set Computer. The instruction set, and hence overall design, is kept simple. This leads to fast operation. One characteristic of the RISC approach is that each instruction is contained within a single binary word. That word must hold all information necessary, including the instruction code itself, as well as any address or data information also needed. A further characteristic, an outcome of the simplicity of the approach, is that every instruction normally takes the same amount of time to execute. A RISC machine is generally recognised by: Few instructions (say well below one hundred), Each performs a very simple action; All instructions are single word; All, or almost all instructions take the same length of time to execute.
15
PIC 16F84A Microcontroller
The 16F84A is available as an 18-pin device. The pin connection diagram is shown here. This won’t make much sense just yet, but in the coming sessions you will be surprised how quickly you get to know what most (if not all) of these pins are used for.
16
PIC 16F84A Microcontroller
We are going to look at the block diagram of the 16F84A, straight from the manufacturer’s data sheet, shown below right. A good understanding of the block diagram leads to an ability to design with the microcontroller, and to program it. In the diagram, you should in time be able to recognise all the basic features of a microcontroller. Let’s pick out the main features of the 16F84A, in the coming slides.
17
PIC 16F84A Microcontroller: Block diagram
Extra “non-volatile” Data Memory Data Memory Address for Program Memory Program Memory Data from Program Memory, carrying instruction word Address for Data Memory Data bus for Data Memory and peripherals Counter/Timer Peripheral Digital Input/ Output Ports The CPU
18
PIC 16F84A Microcontroller: “Flow“
The Instruction word flows here. The word will contain the instruction, and maybe also address and data information Address info. flows here “Literal” data flows along here Instruction info flows here The core is the “microprocessor inside the microcontroller”, centred around the ALU. It is interesting to see the path that the instruction takes from program memory. The Arithmetic Logic Unit The “Working Register”
19
PIC 16F84A Microcontroller: Block diagram
20
Program Memory and Stack
Program Counter 16 Series instructions which invoke the Stack The program must start here The Interrupt Service Routine must start here Program Counter points to locations in program memory Unimplemented memory space, still addressable by the 13-bit 16F84A program address bus.
21
Interfacing with Peripherals – the Special Function Register
Microcontroller Interaction with its Peripherals, via Special Function Register (SFR) and Interrupt microcontroller peripherals can be configured in software to operate in a number of different modes, to do this certain control data must be sent to them to set them up in the desired way once in use, there will be data flow between core and peripheral, there may still be need for further control data, these needs are commonly met by means of dedicated, memory - mapped registers, sometimes called Special Function Registers, this approach gives the microcontroller manufacturer great flexibility to extend a microcontroller family – SFRs for new peripherals can easily be located in gaps in the memory map.
22
Data Memory and Special Function Register Map
These are the Special Function Registers, which allow the CPU to interact with the peripherals msb is “bank select bit” (Status register). General purpose memory
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.