Example: bachelor of science

Chapter 1: Introduction to PIC18 The PIC18 Microcontroller ...

The PIC18 MicrocontrollerChapter 1: Introduction to PIC18 The PIC18 MicrocontrollerHan-Way HuangMinnesota State University MankatoMinnesota State University, MankatoH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerWhat is a computer?SoftwareHardwareHardwareCompute r Hardware OrganizationProcessorControl UnitCo m m on Bus (address, data, & co ntrol)DatapathArithm eticLogic UnitMemoryRegistersProgramStorageDataSto rageOutputUnitsInputUnitsH. Huang Transparency @ 2005 Thomson Delmar LearningFigure 1 .1 Com puter Organizatio nThe PIC18 MicrocontrollerThThe processorRegisters -- storage locations in the processorArithmetic logic unitArithmetic logic unitControl unitprogram countercontains the address of the next instruction to be executedpgstatus registerflags the instruction execution resultThe microprocessorA processor implemented on a very large scale integration (VLSI) chipPeripheral chips are needed to construct

The PIC18 Microcontroller Embedded SystemsEmbedded Systems - A product that uses one or more microcontrollers as controller (s). - End users are only interested in the functionality of the product but not on the microcontroller itself. - Cell phones, home security system, automobiles, and many other products are examples of embedded products.

Tags:

  Embedded, Microcontrollers, Embedded microcontroller

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Chapter 1: Introduction to PIC18 The PIC18 Microcontroller ...

1 The PIC18 MicrocontrollerChapter 1: Introduction to PIC18 The PIC18 MicrocontrollerHan-Way HuangMinnesota State University MankatoMinnesota State University, MankatoH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerWhat is a computer?SoftwareHardwareHardwareCompute r Hardware OrganizationProcessorControl UnitCo m m on Bus (address, data, & co ntrol)DatapathArithm eticLogic UnitMemoryRegistersProgramStorageDataSto rageOutputUnitsInputUnitsH. Huang Transparency @ 2005 Thomson Delmar LearningFigure 1 .1 Com puter Organizatio nThe PIC18 MicrocontrollerThThe processorRegisters -- storage locations in the processorArithmetic logic unitArithmetic logic unitControl unitprogram countercontains the address of the next instruction to be executedpgstatus registerflags the instruction execution resultThe microprocessorA processor implemented on a very large scale integration (VLSI) chipPeripheral chips are needed to construct a productThe MicrocontrollerThe processor and peripheral functions implemented on one VLSI chipH.

2 Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerFeatures of the PIC18 microcontrollerFeatures of the PIC18 Microcontroller -8-bit CPU-2 MB program memory space-256 bytes to 1KB of data EEPROM-Up to 3968 bytes of on-chip SRAM-4 KB to 128KB flash program memory-Sophisticated timer functions that include: input capture, output compare,PWM, real-time interrupt, and watchdog timer-Serial communication interfaces: SCI SPI I2C and CANS erial communication interfaces: SCI, SPI, I2C, and CAN-Background debug mode (BDM)- 10-bit A/D converterMt tibilit-Memory protection capability-Instruction pipelining-Operates at up to 40 MHz crystal oscillatorH.

3 Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerEmbedded SystemsEmbedded Systems- A product that uses one or more microcontrollers as controller (s).- End users are only interested in the functionality of the product but not on the Microcontroller Cell phones, home security system, automobiles, and many other products are examples of embedded Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerSemiconductor memoryy Random-access memory(RAM): same amount of time is required to access any location on the same chipRdl(ROM)l bd b ttittt b th Read-only memory(ROM): can only be read but not written to by the processorRandom-access memory Dynamic random-access memory(DRAM): need periodic refresh Static random-access memory(SRAM).

4 No periodic refresh is requiredRead-only memory Mask-programmed read-only memory(MROM): programmed when beingMaskprogrammed readonly memory(MROM): programmed when being manufactured Programmable read-only memory(PROM): can be programmed by the end userH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerErasable programmable ROM (EPROM)Erasable programmable ROM (EPROM) 1. electrically programmable many times2. erased by ultraviolet light (through a window)3bliblk(hl hiiti )3. erasable in bulk (whole chip in one erasure operation)Electrically erasable programmable ROM (EEPROM)1. electrically programmable many times2.

5 Electrically erasable many times3. can be erased one location, one row, or whole chip in one operationFlash memory1. electrically programmable many times2. electrically erasable many times3. can only be erased in bulk (either a block or the whole chip)H. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerComputer software-Computer programs are known as software-A program is a sequence of instructionsMachine instruction-A sequence of binary digits which can be executed by the processordddddb f hbi-Hard to understand, program, and debug for human beingAssembly language-Defined by assembly instructions-An assembly instruction is a mnemonic representation of a machine instructionAbltb tltdbfitbtd-Assembly programs must be translated before it can be executed --translated by an assembler-Programmers need to work on the program logic at a very low level and can t achieve high Huang Transparency @ 2005 Thomson Delmar LearninggpyThe PIC18 MicrocontrollerHigh-level languageHigh-level language-Syntax of a high-level language is similar to English-A translator is required to translate the program written in a high-level language -- done by a compiler-Allows

6 The user to work on the program logic at higher codeSource code-A program written in assembly or high-level languageObject code-The output of an assembler or compilerH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerSource code and object code examplesaddress object code line codej----------------------------------- ---------------------------------------- -------------------00001E 0E06 00010 movlw 0x06000020 6E11 00011 movwf 0x11,A,000022 0E07 00012 movlw 0x07000024 6E12 00013 movwf 0x12,A000026 0E08 00014 movlw 0x080000 6008000ov w008000028 6E13 00015 movwf 0x13.

7 A00002A 0E05 00016 movlw 0x0500002C5E1000017subwf0x10,F,A00002C 5E10 00017 subwf 0x10,F,A00002E 5E11 00018 subwf x11,F,AH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerRadix Specificationp- Hexadecimal (or hex) number is specified by adding the prefix 0xor by enclosing the number with single quotes and preceding it by an `2040 are hex numbers-0x02, 0x1234, H 2040 are hex numbers- Decimal numbers are enclosed by single quotes and preceded by letter `10 and D`123 are decimal numbers- Octal and binary numbers are similarly `234 is an octal number; B 01011100 is a binary number.

8 H. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerMemory Addressing-Memory consists of a sequence of directly addressable location is referred to as an information memory location can be used to store data, instruction, and the statusof peripheral memory location has two components: an addressand its The components of a memory locationH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerThe PIC18 Memory Organization-Data Memory and Program Memory are separatedData Memory and Program Memory are separated-Separation of data memory and program memory makes possible the simultaneous access of data and memory are used as general-purpose registers or special function registers-On-chip Data EEPROM are provided in some PIC18 MCUsppH.

9 Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerSeparation of Data Memory and Program MemoryInside the c chipProgramMemorySpaceDataMemory21-bit progam address12-bit register addressSpace(a portionof thisspace is onthPIC18 CPUS pace(Specialfunctionregisters andlthe cchip)generalpurposeRAM)16-bit instruction bus8-bit data busFigure The PIC18 memory spacesH. Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerPIC18 Data Memory-Implemented in SRAM and consists of general-purpose registersand special-function registers. Both are referred to as data PIC18 MCU may have up to 4096 bytes of data 8 CUay ave up to 096 bytes o datae o Data memory is divided into banks.

10 Each bank has 256 General-purpose registers are used to hold dynamic Special-function registers are used to control the operation of peripheral one bank is active at any time. The active bank is specified by the Bank switching is an overhead and can be error-prone- PIC18 implements the access bankto reduce the problem caused by bank bankconsists of the lowest 96 bytes and the highest 160 bytes of the data memory Huang Transparency @ 2005 Thomson Delmar LearningThe PIC18 MicrocontrollerAccess RAM000h05 FhBSR<3:0>=0000 GPRs05Fh060h0 FFh100h1 FFhGPRsBank 0 Bank 1 0000= 0001200h2 FFh300hGPRsGPRsARAMl000hAccess BankBank 2 Bank 3= 0010= 00113 FFh400hGPRsAccess RAM lowAccess RAM highSFRs000h05Fh060h0 FFhBank 4toBk13 GPRsDFFhE00hEFFhBank 13 Bank 14= 1110 Note.


Related search queries