Microcontroller Architecture and programming M. Sc 3rd semester ELE-19305DCE Er. Abida Yousuf PG Department of Electronics& Instrumentation Technology, University of Kashmir E-mail:-134ece@gmail.com overview Basic computer system Introduction to microprocessor and microcontroller Brief evolution of microcontroller Criteria for choosing a controller Need of a microcontroller Features of microprocessor and microcontroller Microprocessor VS microcontroller Basic computer system A basic computer system combines Processor, RAM, ROM, I/O to form the basic hardware of the computer system contd… Microprocessor:-CPU on a single integrated chip (IC), is a small processor, where small refers to size and not computational capability. For example intel,pentium and power pc are microprocessors. Microcomputer:- A microcomputer is a small computer, where again small refers to size not computational capability. For example Desktop pc is a microcomputer Microcontroller:-Computer on a Chip, i.e contains all the components of a computer like RAM, ROM I/O, Timers, Serial ports on a single chip or IC. Microprocessor Evolution of microcontroller In the year 1976, Motorola created a microprocessor chip called 6801 which replaced 6800 with certain add on chips to make a computer this paved the way for the new revolution in the history of the chip design and give birth to new entity called microcontroller. The intel bagged the credit of producing the first microcontroller 8048 with a CPU and 1K bytes of EPROM ,64 bytes of RAM ,an 8 bit timer and 27 I/O pins in 1976. Then followed the most popular controller 8051 in the year 1980 with 4K bytes of ROM ,128 Bytes of RAM, a serial port, two 16 bit timers, and 32 I/O pins. Contd… The same INTEL introduced a 16 bit controller 8096 in year 1982. Later intel introduced 80c196 series of 16 –bit microcontrollers for many industrial applications Microchip, another company has introduced a microcontroller PIC 16C64 an 8 –bit in the year 1985. 32-bit microcontroller have been developed by IBM And motorola –MPC 505 is a 32 bit RISC controller of motorola. The 405 GA is a 32 –bit RISC embedded controller of IBM In recent times ARM (Advanced RISC machines )has developed and introduced 32 bit controllers which are highend application devices,especially communication devices. Microcontroller Microcontroller and embedded system Microcontroller may be considered as a Specialized computer on a chip or a single chip computer .The word micro means device is small and controller means device may be used to control one or more functions of objects, processes or events. It is also called as embedded controller as it is always embedded in the device or the system that it controls. The word embedded means “hidden inside so one cannot see it” the software that controls how the program is fixed inside ROM and is not accessible to the user of the device. The first microcontroller was developed in 1971 by Texas Instruments and is called TMS 1000. It was made available for commercial use in 1974. Important four characteristics of embedded system Typically embedded systems perform single function. They are tightly constrainted. Many embedded systems must operate in real time. Small memory requirements. Common Microcontrollers ATMEL ARM 8 BIT E.G MCS48,MCS51, 8XC42 ,8XC251 INTEL National Semiconductor Microchip 16 BIT E.G MCS96,MXCS296 14 BIT PIC E.G PIC16F84 16 BIT PIC Texas Instruments E.G MSP 430, TMS 370 Zilog E.G Z8,Z86E02 8 bit E.G 68HC05,68HC08 Motorola 16 bit E.G 68HC12, 68HC17 Microcontroller classification Criteria for choosing a microcontroller Meeting the computing needs of the task efficiently and cost effectively speed, the amount of ROM and RAM, the number of I/O ports and timers, size, packaging, power consumption easy to upgrade cost per unit Availability of software development tools assemblers, debuggers, C compilers, emulator, simulator, technical support Wide availability and reliable sources of the microcontrollers. Typical features of microprocessor and microcontroller Smaller size Cost reduction Higher reliability Lower power consumption Higher versatility More power in the sense that todays processors are built with millions of transistors on a single chip. Need of a microcontroller There is no electronic gadget on the earth which is designed without a microcontroller. For example communication devices, digital entertainment, portable devices etc Personal information products:cell phones, pager, watch ,pocket, recorder, calculator Laptop components:Mouse , keyboard, modem ,fax card , sound card, battery charger Home appliances:Doorlock,alarmclock, thermostat, airconditioner, TV remote, Refrigrator, microwave oven Contd.. Industrial equipments:-Temperature/pressure controllers, counters, timers, RPM controllers Toys:- video games, cars, dolls Test and measurement equipments:-signal generators,multimeters, frequency counters, oscilloscopes In Automobiles:-microcontrollers used for engine control,car cruise control, antilock brakes. Microprocessor vs Microcontroller MICROPROCESSOR MICROCONTROLLER INTERNAL STRUCTURE •CPU is standalone ,RAM,ROM,I/O, timer are separate. •Microprocessor assimilates the function of a CPU on a single IC CPU,RAM,ROM,I/O and timer are all on a single chip. Mirocontroller can be considered as a small computer on an IC PROCESSING POWER AND MEMORY •Clock speed:-1GHZ-4GHZ •RAM:- 512MB-32GB •ROM:-128GB-2TB •Peripheral:-UART,USB •Clock speed:-1MHZ-300MHZ •RAM:- 2KB-250KB •ROM:-32KB-2MB •Peripheral:-UART POWER CONSUMPTION AND COST •Power consumption is high bcz of external devices hence it requires cooling system. •Overall cost high bcz of requirement of •Power consumption is low •Overall cost less as all components are readily available Microprocessor vs Microcontroller MICROPROCESSOR MICROCONTROLLER MEMORY ARCHITECTURE •Microprocessor is based on von-Neumann •Microcontroller is based on harvard architecture architecture. DESIGN •Flexible from design point of view .i.e •Since there is fixed amount of on chip designer can decide the amount of RAM,ROM RAM,ROM so it is not so flexible from design and I/O ports needed to fit the task point of view. APPLICATION •Microprocessor used in general purpose applications •It is used in applications where intensive processing is required •They are basic components of PCs •Microcontrollers are dedicated to one task and run on one specific program •Microcontroller is application specific not used in applications where intensive processing is required. •They are used in embedded systems. Contd… MICROPROCESSOR MICROCONTROLLER •They are used in designing general purpose •They are used in automatically controlled systems and super computers systems •Computational capacity of microprocessor is v •Less computational capacity usually used for high hence can perform complex tasks simple tasks •Microprocessor have integrated math •Generally they don’t have math co-processors coprocessor complex mathematical calculations they used software to perform floating point which involve floating point arthimetics can be calculations which slows down the devices performed with graet ease •Instruction throughput is given higher priority •In contrast microcontrollers are designed to than interrupt latency. optimise interrupt latency •Have few bit manipulation instructions •They have instructions. •Not used in real time systems •Used to handle real time tasks numerous bit manipulation Memory architecture classification Harvard architecture:- The most obvious characteristic of harvard architecture is it has physically separate signals ,buses and storage for code and data memory. Von-neumann(princeton)architecture:-von-neumann machines have shared signals ,buses and memory for code and data thus program can be easily modified by itself since it is stored in RAM. Contd… Instruction set architecture(ISA) Classification ISA is a set of processor design techniques used to implement the instruction work flow on hardware. It tells us how the processor is going to process instructions for program. Two major approaches to processor architecture are CISC and RISC . Complex instruction set processors use complex instructions intended for direct implementation of high level operations. Reduced instruction set processors design approach uses simple instructions. Contd… Common CISC processors are Intel 8086 Motorola 68xxx National semiconductor 32xxx Intel pentium Common RISC processors are Freescale/IBM The ARM The ATMEL The Microchip PIC. Contd…