Top Banner
Microprocessors and Microcontrollers
56

MicroprocessorMicrocontrollers.ppt

Nov 08, 2015

Download

Documents

microprocessor and micro controller overview
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Microprocessors and Microcontrollers

  • Syllabus

  • CP356: Microprocessors and MicrocontrollersCREDITS =6 (L=4, T=0, P=2)

    (Prerequisite: EL206 Digital Circuits)1. Introduction to Microcontrollers : Intel 8051 architecture. Software architecture. details of SFRs. Port structures. External memory interface. Interrupt. Serial and Timer/counters facility. Instruction set and programming of 8051.2. Programmable I/O ports: Study of Intel 8255 in modes 0, 1 and 2. Interface of A/D and D/A converters with microcontroller and related Software.3 Memory and device selection : Generation of chip select logic; address decoding for memory and I/O ports; latching and buffering; development of a small 8051 based microcomuter system.

  • 4. Study of programmable peripheral controllers : Timer/counter device Intel 8253; keyboard and display controller Intel 8279.5. Serial communication : Synchronous and asynchronous communication. Study of the Western Digital 8250 communication controller. Principle of operation of modems. The EIA RS-232C serial interface standard.6. Special purpose and 16 bit microcotrollers7. Microcontroller applications : Interfacing of input/output devices, keyboard, switches, seven segment dispaly, LCD display. Design of microcontroller based systems for industrial applications, Temperature scanner and weight measurement systems. Embeded Systems, its hardware and software requirements.

  • REFERENCE BOOKS:1. R.S. GaonkarMicroprocessor Architecture, Programming and Applications with 8085APenram International2. Muhammad Ali MazidiJanice Gillispie MazidiThe 8051 Microcontroller and Embedded systemsPrentice Hall of India3. Kenneth J. AyalaThe 8051 Microcontroller Architecture, Programming & ApplicationsPenram International4. V Udayashankara & M S Mallikarjunaswamy8051 Microcontroller Hardware, software and applications

  • CP356: Microprocessors and MicrocontrollersCREDITS =6 (L=4, T=0, P=2)

    List of Experiments:1. Programs using arithmetic instructions of 80512. Programs using logical instructions of 80513. Programs using control and branch instructions of 80514. Programs using subroutine instructions of 80515. Programs using inbuilt timers of 80516. Programs using inbuilt interrupts of 80517. Programs using inbuilt interrupts of 80518. Programs using inbuilt serial facility of 80519. Interfacing of 8255 with 805110. Interfacing of 8255 with 805111. Interfacing of ADC with 805112. Interfacing of DAC with 8051

  • Marks DistributionMarks distribution70 + 20 + 10 = 100 (theory)15 (10- Evaluation + 5 - attendance) + 20 (Performance) + 15(Viva) = 50 (Practical)Seminar Presentation (In Performance) -> 5 Class work Notebook(In Evaluation)->3Theory Assignments(In Evaluation) -> 2Quizzes(In Viva)->5

  • Brief DiscussionWhat is Computer?CPU -> CU + ALU + registersMemory -> RAM (2 TYPES)/ ROM(4 TYPES)I/P AND O/P DEVICES

  • Cont.What is Microprocessor?1960s CPU designed with logic gatesLSI Large Scale IntegrationSSI to LSI called MicroprocessorMicrocomputerIntel 4 bit microprocessor 4004 in 19718 bit microprocessor 80808-bit 8085 (8 bit data bus + 16 bit address bus)16-bit 8086 (16 bit data bus + 20 bit address bus)16 bit processors 8088,80186,80188, 8028632 bit processors 80386 , 80486, 80586 (P)

  • CPUGeneral-Purpose Micro-processorRAMROMI/O PortTimerSerial COM PortData BusAddress BusGeneral-Purpose Microprocessor SystemMicroprocessors:CPU for ComputersNo RAM, ROM, I/O on CPU chip itselfExampleIntels x86, Motorolas 680x0Many chips on mothers boardGeneral-purpose microprocessor

  • Limitations of (8085) MicroprocessorOperates with Low speedLess powerful addressing mode and instruction setLimited no. of 8 bit general purpose registersLow memory 64kbytes addressingRequires external memory to execute a programCannot directly interfaced with I/O devices. Peripheral chips are needed to interface with I/O devices

  • What is Microcontroller?LSI to VLSI called MicrocontrollerTo build Microprocessor, memory and I/O devices on a single chipComponentsMicroprocessorA/D ConverterD/A ConverterParallel I/O InterfaceSerial I/O InterfaceTimers and Counters

  • RAM ROMI/O PortTimerSerial COM PortMicrocontrollerCPUA smaller computerOn-chip RAM, ROM, I/O ports...ExampleMotorolas 6811, Intels 8051, Zilogs Z8 A single chipMicrocontroller :

  • Microprocessor CPU is stand-alone, RAM, ROM, I/O, timer are separatedesigner can decide on the amount of ROM, RAM and I/O ports.expansiveversatility general-purpose

    MicrocontrollerCPU, RAM, ROM, I/O and timer are all on a single chipfix amount of on-chip ROM, RAM, I/O portsfor applications in which cost, power and space are criticalsingle-purposeMicroprocessor vs. Microcontroller

  • Microcontroller vs. Microprocessors

  • Cont.Which is the first task faced when learning to use a new computer?Internal hardware design (architecture)Type, number and size of registersOther circuitryHardware and software of microcontroller

  • Embedded Computing SystemsUse a microprocessor or microcontroller to do one task onlyPrinterPC used for any number of applicationsWord processor, print-server, bank teller terminal, video game player, network server, internet terminalPC contains or is connected to various embedded productsKeyboard, printer, modem, disk controller, sound card, CD-ROM driver, mouse

  • Embedded Products Using MicrocontrollersHomeAppliances, intercom, telephones, security systems, garage door openers, answering machines, fax machines, home computers, TVs, cable TV tuner, VCR, camcorder, remote controls, video games, cellular phones, musical instruments, sewing machines, lighting control, paging, camera, pinball machines, toys, exercise equipment

  • Embedded Products Using MicrocontrollersOfficeTelephones, computers, security systems, fax machines, microwave, copier, laser printer, color printer, paging

  • Embedded Products Using MicrocontrollersAutoTrip computer, engine control, air bag, ABS, instrumentation, security system, transmission control, entertainment, climate control, cellular phone, keyless entry

  • Choosing A MicrocontrollerComputing needsSpeed, packaging, power consumption, RAM, ROM, I/O pins, timers, upgrade to high performance or low-power versions, costSoftware development toolsAssembler, C compiler, SimulatorsAvailability

  • Companies Producing 8051

    CompanyWeb SiteIntelwww.intel.com/design/mcs51Atmelwww.atmel.comPhilips/Signeticswww.semiconductors.philips.comSiemenswww.sci.siemens.comDallas Semiconductorwww.dalsemi.com

  • 8051 Family

    Feature805180528031 ROM (on chip program space in bytes)4K8k 0kRAM (bytes)128256128Timers232I/O pins323232Serial port111Interrupt sources686

  • Timer ::Timer:

  • Interrupt :

  • Various 8051 Microcontrollers8751 microcontrollerUV-EPROMAT89C51 from Atmel Corporation (IN LAB WITH KEIL COMPILER)Flash (erase before write)DS5000 from Dallas SemiconductorNV-RAM (changed one byte at a time), RTC (real-time clock)OTP (one-time-programmable) version of 80518051 family from PhilipsAD, DA, extended I/O, OTP and flash

  • 8051 Microcontroller

  • Block Diagram of 8051CPUOn-chip RAMOn-chip ROM for program code4 I/O PortsTimer 0Serial PortOSCInterrupt ControlExternal interruptsTimer 1Timer/CounterBus ControlTxD RxDP0 P1 P2 P3Address/DataCounter Inputs

  • Features8 bit CPU16-bit program counter(PC) and data pointer (DPTR)8-bit program status word(PSW)8-bit stack pointer4 Kbytes of on-chip program memory(ROM)128 bytes of on-chip data random access memory(RAM)

  • 64Kbytes of program memory address space64Kbytes of data memory address spaceTwo 16 bit timers/counters16 bit address bus multiplexed with port 0 and port 232 bidirectional I/O lines can be either used as 8 bit portsOn-chip clock oscillatorControl RegistersSerial data receiver/transmitterInterrupt sources

  • Architecture of 8051Processor includesArithmetic and logic unitInstruction decoderTiming generation unitAccumulatorB registerStatus register

  • Arithmetic and Logic UnitPerforming computing functionsAccumulator is 8-bit registerArithmetic and logical operations one of the operands is in A registerResult is stored in only AC(carry), AC(auxiliary carry), O(overflow) and P(Parity) status register

  • Instruction decoder and controlWhen an instruction is fetched it is loaded in the instruction registerDecoder decodes the instruction and establishes the sequence of events to followInstruction cycle: Instruction cycle is defined as the time required for completing the execution of an instruction

  • Instruction register is not programmableIt cannot be accessed through any instructionControl unit generates control signals necessary for communication between the processor and peripherals

  • CPU RegistersA Register(E0H)8 bitDirect connection with ALUIn multiplication- one of 8 bit operands stored in A and after operation it stores lower byte in AIn division- holds 8 bit dividend & quotient is stored in A B Register(F0H)8 bitUsed with multiply and divide operationsIn multiplication- after operation it stores higher byte in BIn division- holds 8 bit divisor & reminder is stored in B

  • Registers

  • Program status word(D0H)Add numbers 56H and 95H AND show how CY,AC and P flags affected???

    CYACF0RS1RS0OV--P

    CYPSW.7Carry flagAC PSW.6Auxiliary carryF0 PSW.5General purposeRS1-PSW.4Register bank selector bit 1RS0-PSW.3Register bank selector bit 0OV-PSW.2Overflow flag--User defined bitPPSW.0Parity flag

  • MOV A,#56HMOV A,#95H56 -- 0101 0110 +95 --- 1001 0101-------------------------------------EBH -1110 1011CY = 0 (No carry between D7)AC = 0 (No carry from D3 to D4)P = 0 (Accumulator has an even number of bits)

  • Second Exercise!Show status of CY,AC and P flags after the addition of 9CH and 64H What is the size of flag register in the 8051?FIND C,AY,P FOR ----MOV A,#02H ADD A,#3DH0000 0010 0011 1101-------------- 0 0 1 1 1 1 1 1

  • MOV A,#95ADD A,#120ANS = 44 IN HEX

  • Third Exercise!Show the contents of PSW register after execution of following instrucitons:MOV A,#0BFHADD A,#1BHBF 1011 11111B 0001 1011---------------------DA 1101 1010 Cy=0,ac=1,f0=0,rs1=0,rs0=0,ov=0,not used=0, p=1

  • Answers: 1(CY) 1(AC) 0(P)1001 11000110 0100-------------0000 0000Answers: contents of psw = 0100 0001= (65)10= (41)16

  • Stack Pointer(81H)8 BITContains data item on the top of stackIncremented before data is storedInitialized to 07H

  • Data PointerDPTR (Data Pointer) consists of two 8 bit registers high byte (DPH) and low byte (DPL)16 bit addressTo furnish address information for internal and external program memory and for external data memory

  • Program Counter16 bit registerSpecifies the address of next instruction to be executedAfter reset PC will be set to 0000H8051 fetches the instruction one byte at a timeAfter increments, it increments PC by 1

  • MEMORY4k bytes on chip ROM128 bytes RAMProgram memory is used to hold start up programData random access memory is divided into 4 parts:First 128 bytes : 00H TO 1FH (31) Register Banks20H TO 2FH(47) Bit addressable RAM30H TO 7FH (127) General purpose registersNext 128 bytes : 80H TO FFH (255) Special function registers

  • Register BanksLowest 32 bytes4 banks each having 8 registersRS1 and RS0 (4TH BIT AND 3RD BIT) program status word select the bankEach bank contains R0 TO R7 Ex: add A,R2 adds the value contained in R2 to the accumulatorRS1=0 and RS0=0 BANK 0 IS SELECTEDR2 is which memory location? ADD A,02H

  • Internal RAM Organization

    Special function registers80 FFGeneral purpose registers30-7FBit addressable space20-2FBANK 3 (R0-R7)18-1FBANK 2 (R0-R7)10-17BANK 1 (R0-R7)08-0FBANK 0 (R0-R7)00-07

  • PSW bits bank selection

    RS1 PSW.4RS0- PSW.3BANK 000BANK 101BANK 210Bank 311

  • Bit Addressable RAM 20H TO 2FH16 BYTESBit variables can have value 0 or 1SETB 25H // sets the bit 25H (becomes 1)CLR 25H // clears the bit 25H (becomes 0)SETB 19H // WRONG

  • General Purpose RAM 30H TO 7FH80 BYTESInstructions of single byte operands use this area of storageDirect or indirect addressing modes

  • SFR Register 80h to ffh21 SFR registers are definedSome registers are bit addressableAccess by internal RAM locationsCPU and internal peripheral modules use SFR for controlling the desired operation of the deviceContains I/O ports, control registers, timers, serial ports etc.Ex : acc, B, PSW, sp, dptr etc.

  • MOV A,R5 is equivalent to?Which register bank of r0-r7 do we have access to when 8051 is powered up? Ans register bank 0RAM LOCATIONS 0,1 to 7By r0 to r7How to switch register banks?By bit addressable instructions SETB and CLRSETB PSW.3 - will make PSW.3 =1 so 0(PSW.4)AND 1 BANK1 IS SELECTED

  • Which is the other way to write below programState the contents of RAM LOCATIONS after following program:MOV R0,#99HMOV R1,#50HMOV R2,#60HMOV R3,#90HMOV R4,#65HRAM LOCATION 0 HAS VALUE 99HRAM LOCATION 1 HAS VALUE 50HRAM LOCATION 2 HAS VALUE 60HRAM LOCATION 3 HAS VALUE 90HRAM LOCATION 4 HAS VALUE 65H

  • Write instructions to use the registers of bank 3 and load the same value 05H in reg. r0-r3

    SETB PSW.4SETB PSW.3MOV R0,#05HMOV R1,#05HMOV R2,#05HMOV R3,#05H

  • Example: the following instructions enable register bank 3 and move the content of R7 (address 1FH) to the accumulatorSETB RS1SETB RS0MOV A,R7

    *Intels x86: 8086,8088,80386,80486, PentiumMotorolas 680x0: 68000, 68010, 68020,68030,6040*versatility : any number of applications for PC*