Microprocessor and Interfacing 261313 PIC Code Execution

Slides:



Advertisements
Similar presentations
Control structures Hot to translate high level control structures to assembler.
Advertisements

Machine cycle.
Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4 Computer Organization.
The Microprocessor and its Architecture
Prof. Jorge A. Ramón Introducción a Microcontroladores.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 30: PIC data memory.
1 Sec (2.3) Program Execution. 2 In the CPU we have CU and ALU, in CU there are two special purpose registers: 1. Instruction Register 2. Program Counter.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Chapter 4 Starting to Program – an Introduction to Assembler The aims of this chapter are to introduce: the essentials of Assembler programming; the Microchip.
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
Microcontroller Programming How to make something almost do something else Raffi Krikorian MAS November 2003.
CPU Fetch/Execute Cycle
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Processor Structure & Operations of an Accumulator Machine
Building Assembler Programs Chapter Five Dr. Gheith Abandah1.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Directives, Memory, and Stack. Directives Special commands to the assembler May or may not generate machine code Categories by their function Programming.
Stack Stack Pointer A stack is a means of storing data that works on a ‘Last in first out’ (LIFO) basis. It reverses the order that data arrives and is.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Experiment 7 VHDL Modeling of Embedded Microprocessors and Microcontrollers.
Topic 1Topic 2Topic 3Topic 4Topic
PIC18F Programming Model and Instruction Set
Embedded System Spring, 2011 Lecture 5: The PIC Microcontrollers Eng. Wazen M. Shbair.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
 Mini-Computer  Microprocessor  The Brains  Arithmetic Logic Unit (ALU)  Control Unit  Program/ Data Storage  Peripherals (Input/Output) Low-Cost.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Sample Code (Simple) Run the following code on a pipelined datapath: add1 2 3 ; reg 3 = reg 1 + reg 2 nand ; reg 6 = reg 4 & reg 5 lw ; reg.
EEE237 Introduction to Microprocessors Week x. SFRs.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
PIC Code Execution How does the CPU executes this simple program? void main() { int i; i = 1; i++; }
Department of Electronic & Electrical Engineering Introduction to microcontrollers A microcontroller is a small computer on a single integrated circuit.
Department of Electronic & Electrical Engineering Lecture 2. PIC16F84A Architecture / Instructions Memory. Program/Data (Harvard) File Registers (Data).
Embedded System Spring, 2011 Lecture 11: Bank Switching Eng. Wazen M. Shbair.
PIC12F629/675. “Wide variety” 8-84 pin RISC core, 12/14/16bit program word USART/AUSART, I 2 C, ADC, ICSP, ICD OTP/UV EPROM/FLASH/ROM Families: PIC12,
RISC / CISC Architecture by Derek Ng. Overview CISC Architecture RISC Architecture  Pipelining RISC vs CISC.
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
Microcontrollers A Practical Approach Ernesto Arroyo
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Department of Electronic & Electrical Engineering Lecture 4. ➢ Loops ➢ Delays ➢ Conditional instructions ➢ Simple clock example.
Department of Electronic & Electrical Engineering Lecture 3. ● Template program. ● Introduction to IO ● PORTA PORTB TRISA TRISB ● Using a subroutine ●
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
1.  List all addressing modes of PIC18 uCs  Contrast and compare the addressing modes  Code PIC18 instructions to manipulate a lookup table.  Access.
Microprocessor Systems Design I
CPU Organisation & Operation
Microprocessor Systems Design I
Microprocessor Systems Design I
Micro-processor vs. Micro-controller
Microprocessor Systems Design I
HTP Programme: Assembler
Microprocessor Systems Design I
PIC – ch. 2b Md. Atiqur Rahman Ahad.
16.317: Microprocessor System Design I
Microprocessor Systems Design I
The fetch-execute cycle
Computer Organization and ASSEMBLY LANGUAGE
EECE.3170 Microprocessor Systems Design I
The Little Man Computer
Chapter 4 Instruction Set.
INSTRUCTION SET.
Figure 6-1a. MOVFF Direct Addressing Opcode
MARIE: An Introduction to a Simple Computer
ARM7TDMI Block Diagram Barrel Shifter Booth Multiplie r Data Out Register. D[31:0] Control Lines Data In Register. B busA bus ALU bus PC A[31:0] A.L.U.
ARM7TDMI Block Diagram Barrel Shifter Booth Multiplie r Data Out Register. D[31:0] Control Lines Data In Register. B busA bus ALU bus PC A[31:0] A.L.U.
EECE.3170 Microprocessor Systems Design I
Program Execution.
EECE.3170 Microprocessor Systems Design I
Instruction execution and ALU
Computer Architecture Assembly Language
Figure 3-1. Flowchart for the DECFSZ Instruction
Sec (2.3) Program Execution.
Presentation transcript:

Microprocessor and Interfacing PIC Code Execution

How does the CPU executes this simple program? void main() { int i; i = 1; i++; }

Assembly Code MOVLW 01 BCF 03.5 MOVWF 21 INCF 21,F

Machine Code

File Register Map

Status Register (Address 03) Zero Bit = จะเป็น 0 เมื่อใดก็ตาม ที่ ALU คำนวณค่าออกมาเป็น 0

The 4 Qs Q1 = Instruction Decode Q2 = Fetch Operand Q3 = Process the Data Q4 = Write Result Data

Instruction Pipeline Flow Flash->Ins Reg Q1Q2Q3Q4 Flash->Ins Reg Q1Q2Q3Q4 Flash->Ins Reg Q1Q2Q3Q4 time Fetch Execute

Pipeline interruption Flash->Ins Reg Q1Q2Q3Q4 Flash->Ins Reg Q1Q2Q3Q4 time Goto Fetch Execute

Program Execution Example int i; i=1; 000D: MOVLW E: BCF F: MOVWF i++; 0010: INCF 21,F

Converting Assembly to Machine Code MOVLW 01 BCF 03.5 MOVWF 21 INCF 21,F

Program Execution Ex int i; i = 5; 000D: MOVLW E: BCF F: MOVWF do { i--; 0010: DECF 21,F } while (i>0); 0011: MOVF 21,F 0012: BTFSS : GOTO 010