Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

Similar documents
Chapter 2 Sections 1 8 Dr. Iyad Jafar

DERTS Design Requirements (1): Microcontroller Architecture & Programming

Lecture (02) PIC16F84 (I)

Embedded System Design

ME 515 Mechatronics. A microprocessor

ME 6405 Introduction to Mechatronics

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

Lecture (03) PIC16F84 (2)

Lecture (04) PIC 16F84A programming I

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

EEE111A/B Microprocessors

Midrange 8b PIC Microcontrollers. ECE Senior Design 14 February 2017

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

CHAPTER 6 CONCLUSION AND SCOPE FOR FUTURE WORK

PIC Discussion. By Eng. Tamar Jomaa

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

ME 475 Lab2 Introduction of PIC and Programming. Instructor: Zhen Wang

PIC 16F84A programming (II)

Embedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

M PIC16F84A. 18-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller. High Performance RISC CPU Features: Pin Diagrams. Peripheral Features:

PIC16C84. 8-bit CMOS EEPROM Microcontroller PIC16C84. Pin Diagram. High Performance RISC CPU Features: CMOS Technology: Peripheral Features:

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL

PIC Microcontroller Introduction

Learning Objectives:

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

Microcontroller Overview

AVR Microcontrollers Architecture

n/a PIC12F629-I/P (RC) n/a PIC12F629-I/SN (RC) n/a PIC12F675-I/P (RC) n/a PIC12F675-I/SN MICROCONTROLLER (RC)

ENE 334 Microprocessors

Professor E. Ambikairajah UNSW Sydney

PIC16F84A. 18-pin Enhanced Flash/EEPROM 8-Bit Microcontroller. Devices Included in this Data Sheet: Pin Diagrams. High Performance RISC CPU Features:

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

Module 2: Introduction to AVR ATmega 32 Architecture

Outline. Micriprocessor vs Microcontroller Introduction to PIC MCU PIC16F877 Hardware:

Introduction to general architectures of 8 and 16 bit micro-processor and micro-controllers

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

8051 Microcontroller

Introducing Microcontrollers System Design

Micro II and Embedded Systems

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers

Microcontrollers. Microcontroller

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

Introduction to Embedded Systems

PIC16F8X. 8-Bit CMOS Flash/EEPROM Microcontrollers PIC16F8X PIC16CR8X. Pin Diagram. Devices Included in this Data Sheet:

Embedded Systems Design (630414) Lecture 1 Introduction to Embedded Systems Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

UNIT IV MICROCONTROLLER

8051 microcontrollers

Section 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics:

Introduction to Microcontrollers

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Basic Components of Digital Computer

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Using Timers of Microchip PIC18F Microcontrollers

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE6008 Microcontroller based system design

Laboratory 9. Programming a PIC Microcontroller - Part I

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

University of Hawaii EE 361L MPLab Quick Tutorial and Project 2.1 Last updated September 1, 2011

University of Dayton. Electrical & Computer Engineering. ECE 536 Microprocessor Applications. Dr. Ralph Barrera. Assignment (4)

MICROCONTROLLERS 8051

Microcontroller systems Lec 2 PIC18LF8722 Microcontroller s s core

Department of Electronics and Instrumentation Engineering Question Bank

EE 361L Digital Systems and Computer Design Laboratory

8051 Microcontroller Interrupts

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

Lecture (04) PIC16F84A (3)

PIC Discussion By Eng. Tamar Jomaa

MICROPROCESSOR BASED SYSTEM DESIGN

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

CENG-336 Introduction to Embedded Systems Development. Timers

8051 Microcontrollers

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

FLASH Microcontroller Programming Specification PIN DESCRIPTIONS (DURING PROGRAMMING): PIC18FXX20. During Programming

CN310 Microprocessor Systems Design

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours

Fig 1. Block diagram of a microcomputer

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Question Bank Microprocessor and Microcontroller

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

Section 28. WDT and SLEEP Mode

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

Mod-5: PIC 18 Introduction 1. Module 5

DESIGN AND FABRICATION OF FARE METER OF TAXICAB USING MICROCONTROLLER

EasyPIC5 Development System

ATmega128. Introduction

Programming for PIC18FXX2/FXX8 FLASH MCUs PIN DESCRIPTIONS (DURING PROGRAMMING): PIC18FXX2/XX8. During Programming. Pin Name Pin Type Pin Description

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab

8051 Microcontroller

Interconnects, Memory, GPIO

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work

Laboratory Exercise 7 - Extended I/O & Parallel Processing

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

Transcription:

Embedded Systems PIC16F84A Internal Architecture Eng. Anis Nazer First Semester 2017-2018

Review Computer system basic components? CPU? Memory? I/O? buses? Instruction? Program? Instruction set? CISC, RISC? Memory? address? Volatile? non volatile? Computer architecture? Von Neumann, Harvard? Microprocessor? Microcontroller?

Steps to design an Embedded System Specify requirements: Inputs / outputs of the system what should the system do Choose a suitable Microcontroller Flow chart and write the program Simulate the system if everything is OK, download program to microcontroller using a special hardware programmer Build circuit and test

Microcontroller families Wide range of MCUs Each MCU manufacturer has families (groups of similar MCUs) Each family has members Families differ in the core processor (have different instruction sets) Members deffer in capabilities (memory size, I/O ports, number of timers...others?)

Microchip families In this course we will use the PIC microcontroller form Microchip manufacturer Families: Baseline, Mid-range, High-Performance

Assignment Assignment: Search for another microcontroller type name the available families give and an example of a microcontroller in each family chose a micorontroller from a family and name its main features

PIC 16F84A We will use the PIC16F84A microcontroller Features: 18 pin Clock Speed: up to 20MHz 1K Program Memory 68 Byte RAM 64 byte EEPROM one 8-bit timer one 5-bit I/O port (PORTA) one 8-bit I/O port (PORTB) ICSP (In Circuit Serial Programming)

PIC16F84A pin diagram

PIC16F84 pins Power supply pins VDD: power (+) VSS: Ground ( - ) I/O ports: RA0-RA4 and RB0-RB7 Used to connect inputs / outputs all pins are digital (accept two values: logic 0, or logic 1) Master clear (reset): MCLR (active low, reset when logic zero) T0CKI: Timer0 Clock input the input that will drive the timer/counter in the microcontroller Question: name an example where a timer is useful

PIC16F84 pins External Interrupt: INT when active, this pin will stop the normal operation of the microcontroller to respond to an external event Oscillator OSC1, OSC2: used to connect a clock signal the PIC microcontroller needs a clock signal to operate clock signal: is periodic square wave signal alternating between logic 0 and logic 1 logic 1 logic 0 time

Clock Signal Definitions: period: time between pulses (unit second) frequency: 1 / period ( unit Hertz) period Question: A 2GHz signal has a period of ns

Clock and Instruction Frequency In the PIC microcontroller, the CPU needs 4 clock pulses to execute an instruction clock cycle = period instruction cycle = 4 clock cycles So, if you attach a 4 MHz clock, the PIC will execute 1M instruction cycle per second ( 1MIPS ) What is the clock frequency if you want the instruction cycle to be 5us? how long would it take the PIC to execute 30000 instruction cycles if the clock frequency is 12MHz? How may instruction cycles should be executed to get a delay of 1 second if the clock frequency is 32768Hz

Reset Reset: restart the MCU Reset occurs: after a power up externally activating MCLR after the watchdog timer overflows MCLR pin is active low (a clear will occur if the pin is logic 0) For normal operation of the PIC microcontroller, MCLR pin should be connected to logic 1

Master clear ( MCLR ) Connecting MCLR pin:

Program Memory Program Counter Call Stack Program Memory

Program Memory Program Memory: FLASH 1K x 14 Program starts at address 0 What is the address of the last instruction? 1023 in decimal = 11 1111 1111 in binary = 3FF in hex = 0x3FF Program counter: holds the address of the next instruction to be executed Call Stack: holds the return address after a function call 8 levels, up to 8 nested function calls Last in First out organization (LIFO) Interrupt vector : the instruction that will be executed when an interrupt occurs

Data Memory Data memory (SRAM) : two parts: Special function registers (SFR) 68 x 8 general purpose Data Memory: EEPROM 64 x 8 name an example where EEPROM is useful

Data Memory (SRAM) Two categories: General Purpose Registers (GPR) : general use, any kind of data Special Function Registers (SFR) : have a special purpose, can control the operation of the PIC. Ex. Select port A as input Organized in two banks: selection through STATUS register to access bank 0, clear bit RP0 in status register to access bank 1, set bit RP0 in status register

Data Memory (SRAM) Special Function Registers (SFR) General Purpose Registers (GPR) Unimplemented

SFR Example: Status Register Status register is one of the special function registers It holds the flags of the last operation, similar to FLAGS in intel 8086 Holds other information related to the state of the microcontroller The register is at location 0x03 in data memory (bank 0) The register is duplicated at address 0x83 (bank 1) if you access the location 0x03 or 0x83 you get the same data

Status Register bits C: Carry/Borrow flag 1 if there is a carry-out of the MSB in the last operation 0 if no carry-out of the MSB in the last operation in case of subtraction borrow bit is reversed DC: digit carry, same as carry but for the 4 th bit Z: zero flag 1 if result is zero 0 if result is not zero (confusing, good for a trick question:)

Status Register bits RP0: bank select bit 0 to select bank 0 1 to select bank 1 TO: time-out bit (active low) PD: power down bit (active low)

Question The pairs of numbers shown below are added in a 16F84A program. What is the result in each case and the value of the Status register bits Z, DC and C after each addition? 1001 1101 added to 0001 0011 0001 0101 added to 0110 1001 1110 1001 added to 0001 0111

Data memory: EEPROM Non-volatile memory, keeps data after power is off Accessed using SFRs: EEDATA, EEADR Read/Write operation is controlled using SFR: EECON1, EECON2 Reading or writing data to EEPROM requires a certain procedure. Writing takes a long time (relatively), so a certain procedure is followed to ensure a correct write

Pipelining The PIC microcontroller has a two step pipeline two steps for each instruction: fetch and execute steps are pipelined, ie: while an instruction is executed the next instruction is fetched.

Configuration Bits Part of program memory Specified during program download Cannot be read during program execution. Used to configure the PIC

Configuration Bits CP: code protect PWRTE: power up timer enable WDTE : watchdog timer enable FOSC0,1: oscillator selection bits 11: RC oscillator 10: HS oscillator 01: XT oscillator 00: Low Power oscillator