Dr. Iyad Jafar Introducing the PIC 16 Series and the 16F84A.

Slides:



Advertisements
Similar presentations
Chapter 2 HARDWARE SUMMARY
Advertisements

Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Processor System Architecture
Microcontroller – PIC – 4 PIC types PIC architecture
Operating Systems Béat Hirsbrunner Main Reference: William Stallings, Operating Systems: Internals and Design Principles, 6 th Edition, Prentice Hall 2009.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 26: PIC microcontroller intro.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 30: PIC data memory.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 29: Microcontroller intro.
Smarter systems and the PIC® 18FXX2 Chapter One 12.1 – 12.5 Dr. Gheith Abandah1.
Microcontroller Architecture— PIC18F Family
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Rabel Talpur:12BME#025.  40-pin chip  Developed by Motorola in 1975  16 address lines and 8 data lines  Used only +5V.
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
9/20/6Lecture 21 -PIC Architecture1 PIC Architecture Programmers Model and Instruction Set.
Atmega32 Architectural Overview
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Minimum Systems and the PIC 16F84A Chapter Two Dr. Gheith Abandah1.
Directives, Memory, and Stack. Directives Special commands to the assembler May or may not generate machine code Categories by their function Programming.
Prepared by Eng. Musa Alyaman1 Chapter Seven Chapter Seven PIC16F87x.
Aum Amriteswaryai Namah:. HHHHave separate program memory and data Memory AAAAccessed by separate busses.
Computer Organization CT213 – Computing Systems Organization.
Chapter 2 Introducing the PIC Mid-Range Family and the 16F84A The aims of this chapter are to introduce: The PIC mid-range family, in overview The overall.
8051 Micro controller. Architecture of 8051 Features of 8051.
Microprocessor. Interrupts The processor has 5 interrupts. CALL instruction (3 byte instruction). The processor calls the subroutine, address of which.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
Z80 Overview internal architecture and major elements of the Z80 CPU.
EEE237 Introduction to Microprocessors Week x. SFRs.
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
INTRODUCTION TO PIC MICROCONTROLLER. Overview and Features The term PIC stands for Peripheral Interface Controller. Microchip Technology, USA. Basically.
Presented by Sadhish Prabhu
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
JUMP, LOOP, AND CALL INSTRUCTIONS
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
8051 Micro Controller. Microcontroller versus general-purpose microprocessor.
1 Computer Architecture. 2 Basic Elements Processor Main Memory –volatile –referred to as real memory or primary memory I/O modules –secondary memory.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
AVR Architecture Prepared By: Avdhesh Soni ( ) Sarthak Patel ( ) Akshay Parekh ( ) Fenil Sachla ( ) Guided.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
“Atmega32 Architectural Overview” SIGMA INSTITUTE OF ENGINEERING Prepared By: SR.NO NAME OF STUDENT ENROLLMENT 1 Parihar Shipra A Guided By:-
Memory Organization 1.  3 types of memory are used in PIC18 microcontroller devices: Program Memory - Flash Memory Data RAM - Static RAM Data EEPROM.
Hoda Roodaki AVR Family Overview Hoda Roodaki
Atmega32 Architectural Overview
Microprocessor Systems Design I
C. K. Pithawalla College of Engineering and Technology, Surat
Overview of Architecture Assembly Programming Concepts
MCI PPT AVR MICROCONTROLLER Mayuri Patel EC-1 5th sem
Microprocessor Systems Design I
UNIT – Microcontroller.
Microprocessor Systems Design I
Microprocessor Systems Design I
PIC 16F877.
PIC 8 BIT AND 16 BIT MICROCONTROLLER ARCHITECTURE
Microprocessor Systems Design I
The Arduino Microcontroller: Atmel AVR Atmega 328
مقدمه با توجه به اهميت و گسترش روزافزون كاربردهاي ميكروكنترلرها و محدوديت هايي كه ميكروكنترلرهاي خانواده ي MCS51 ايجاد مي كرد،شركت Microchipنسل جديدي.
PIC Microcontroller What is PC LATH?????.
Instruction and Control II
Architectural Overview
Introducing the PIC Mid-Range Family and the 16F84A
Chapter 4 Instruction Set.
INSTRUCTION SET.
Important 8051 Features On chip oscillator 4K bytes ROM 128 bytes RAM
EECE.3170 Microprocessor Systems Design I
Microcontroller – 2 PIC.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Computer Operation 6/22/2019.
Presentation transcript:

Dr. Iyad Jafar Introducing the PIC 16 Series and the 16F84A

Outline Overview of the PIC 16 Series An Architecture Overview of the 16F84A The 16F84A Memory Organization Memory Addressing 2

Overview of the PIC 16 Series The PIC 16 series is classified as a mid range microcontroller The series has different members all built around the same core and instruction set, but with different memory, I/O features, and package size 3

4

18 Pins / DC to 20MHz / 1K program Memory/ 68 Bytes of RAM / 64 Bytes of EEPROM / 1 8-bit Timer / 1 5-bit Parallel Port / 1 8-bit Parallel Port An Architecture Overview of the 16F84A 5

6

The PIC 16F84A Memory and Registers Program Related 7

The PIC 16F84A Memory and Registers Program Memory 1K x 14 Bits Address range 0000H – 03FFH Flash (nonvolatile) erase/write cycles Location 0000H is reserved for the reset vector Location 0004H is reserved for the Interrupt Vector Program Counter Holds the address of the next instruction to be executed Stack 8 levels (each is 13 bits) SRAM (volatile) Used to store the return address with instruction like CALL, RETURN,RETFIE, and RETLW (interrupts and procedures) Instruction Register Holds the instruction being executed 8

The PIC 16F84A Memory and Registers Data Memory and Special Function Registers (SFRs) SRAM (volatile) Banked addressing to reduce address bus size Special Function Registers SFRs Locations 01H-0BH in bank 0 and 81H- 8BH in bank 1 Used to communicate with I/O and control the microcontroller operation Some of them hold I/O data General Purpose Registers Addresses 0CH – 4FH (68 Bytes) Used for storing general data 9

The PIC 16F84A Memory and Registers Special Function Registers (SFRs) 10

The STATUS Register (03H, 83H) The PIC 16F84A Memory and Registers 11

The PIC 16F84A Memory and Registers Special Function Registers (SFRs) interacting with peripherals 12

The Working Register Inside the CPU Holds the result of the last instruction executed by the CPU The PIC 16F84A Memory and Registers 13

Data Memory Addressing For PIC 16F84A, we need to select one of two banks (1-bit) and 7-bits to select on of the locations Bank selection is done through using bits 5 and 6 of the STATUS registers (RP0 and RP1) For the 16F84A, only RP0 is needed since we have two banks In general, two forms to address the RAM (File Registers) Direct addressing – the 7-bit address is part of the instruction Indirect addressing – the 7-bit address is loaded in File Select Register (FSR, 04H) The PIC 16F84A Memory and Registers 14

Data Memory Addressing The PIC 16F84A Memory and Registers 15

Data Memory Addressing Indirect Addressing Direct addressing is capable of accessing single bytes of data Working with list of values using direct addressing is inconvenient since the address is part of the instruction Instead we can use indirect addressing where the File Select Register FSR register acts as a pointer to data location. The FSR can be incremented or decremented to change the address The address stored in FSR is used to address the memory whenever the INDF (0x00) register is accessed in an instruction This forces the CPU to use the FSR register to address memory 16

Data Memory Addressing Direct/Indirect Addressing in 16F84A 17

Data Memory Addressing Example: a program to add the values found locations 0x10 through 0x1F and store the result in 0x20 18 STATUSequ0x03; define SFRs FSRequ0x04 INDFequ0x00 RESULTequ0x20 NequD’15’ COUNTERequ0x21 org 0x0000; reset vector goto START org 0x0005 STARTmovlwN ; initialize counter movwfCOUNTER ; movlw0x11 ; initialize FSR as a pointer movwfFSR movf0x10, 0 ; get 1 st number in W LOOPaddwfINDF, 0 ; add using indirect addressing incfFSR, 1 ; point to next location decfszCOUNTER, 1; decrement counter gotoLOOP movwfRESULT DONEgoto DONE end

Subroutines In many cases, we need to use a block of code in a program in different places Instead of writing the code wherever it is needed, we can use subroutines/functions/procedures Blocks of code saved in memory and can be called/used from anywhere in the program When a subroutine is called, execution moves to place where the subroutine is stored Once the subroutine is executed, execution resumes from where it was before calling the subroutine 19

Subroutines 20

Subroutines The program counter holds the address of the instruction to be executed In order to call a subroutine, the program counter has to be loaded with the address of the subroutine Before that, the current value of the PC is saved in stack to assure that the main program can continue execution from the following instruction 21

Subroutines In PIC, to invoke a subroutine we use the CALL instruction followed by the address of the subroutine The address is usually specified by a symbolic label in the program To exit a subroutine and return to the main program, we use the RETURN or RETLW instructions 22

Subroutines - Example ; using a subroutine to select memory bank based on the value in W STATUSequ0x03; define SFRs org 0x0000; reset vector goto START org 0x0005 STARTmovlw0x01 ; load W to select bank 1 callSET_BANK ; call the procedure …….. movlw0x00 ; load W to select bank 0 callSET_BANK ; call the procedure …….. DONEgotoDONE ; endless loop SET_BANKsublw0x01 ; check value in W btfssSTATUS, 2 ; check the zero flag, if set select bank 1 gotoBANK0 ; Z = 0, select bank 0 bsfSTATUS, 5; select bank 1 gotoRET BANK0bcfSTATUS, 5 ; Z = 0, select bank 0 RETreturn end 23