Department of Electronic & Electrical Engineering Lecture 2. PIC16F84A Architecture / Instructions Memory. Program/Data (Harvard) File Registers (Data).

Slides:



Advertisements
Similar presentations
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Advertisements

Computer Organization and Architecture
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
EE1A Revision What should you be expected to do in a typical exam question ? Understanding of basic principles. Ability to perform simple circuit analysis.
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
Low-Level Programming Languages
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Stored Program Concept: The Hardware View
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Computer Architecture
Microcontroller Architecture— PIC18F Family
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Microcontroller Architecture PIC18F Family
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
CPU Registers PC Arith Logic Unit Bus Interface I/O Bridge System bus Memory bus Main Memory USB Controller Graphics Adapter Disk Controller I/O Bus Mouse.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
Atmega32 Architectural Overview
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Computer Structure.
Basic Operational Concepts of a Computer
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
Information Representation: Machine Instructions
CPU Computer Hardware Organization (How does the computer look from inside?) Register file ALU PC System bus Memory bus Main memory Bus interface I/O bridge.
4-1 Chapter 4 - The Instruction Set Architecture Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of.
Microprocessor and Interfacing PIC Code Execution
Lecture #30 Page 1 ECE 4110– Sequential Logic Design Lecture #30 Agenda 1.von Neumann Stored Program Computer Architecture Announcements 1.N/A.
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
Chapter 4 The Von Neumann Model
Von Neumann Machine Objectives: Explain Von Neumann architecture:  Memory –Organization –Decoding memory addresses, MAR & MDR  ALU and Control Unit –Executing.
1 Instruction Set Architecture (ISA) Alexander Titov 10/20/2012.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Computer Structure & Architecture 7b - CPU & Buses.
Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Computer Organization 1 Instruction Fetch and Execute.
Assessment Covering… Von Neuman architecture Registers – purpose and use, the fetch execute cycle.
Department of Electronic & Electrical Engineering Template program. Input / Output (IO) ● Template program. ● Introduction to IO ● Setting up for IO ●
Lecture 7: Overview Microprocessors / microcontrollers.
Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Department of Electronic & Electrical Engineering Introduction to microcontrollers A microcontroller is a small computer on a single integrated circuit.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
CBP 2002ITY 270 Computer Architecture1 Module Structure Whirlwind Review – Fetch-Execute Simulation Instruction Set Architectures RISC vs x86 How to build.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Microprocessor Fundamentals Week 2 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Department of Electronic & Electrical Engineering Lecture 3. ● Template program. ● Introduction to IO ● PORTA PORTB TRISA TRISB ● Using a subroutine ●
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ read/write and clock inputs Sequence of control signal combinations.
Atmega32 Architectural Overview
CPU Organisation & Operation
Microprocessor and Assembly Language
Computer Architecture
The Processor and Machine Language
Functional Units.
Introduction to Assembly Chapter 2
MARIE: An Introduction to a Simple Computer
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
Introduction to Assembly Chapter 2
Chapter 4 The Von Neumann Model
CS334: MIPS language _Mars simulator Lab 2_1
Information Representation: Machine Instructions
Computer Architecture Assembly Language
Computer Operation 6/22/2019.
Embedded Systems- Instruct set
Presentation transcript:

Department of Electronic & Electrical Engineering Lecture 2. PIC16F84A Architecture / Instructions Memory. Program/Data (Harvard) File Registers (Data). IO (memory mapped) Machine/Assembly code.

Department of Electronic & Electrical Engineering Understanding the architecture To program a PIC you need to know about the device. Not like high level programming (Matlab JAVA C?). The internal structure of the device is called its architecture. The following slide shows the internal structure of the PIC16F84A File Registers  Store data (8 bits) ALU (arithmetic logic unit)  Calculations Buses  Carry data/addresses Program Memory  Stores the program

Department of Electronic & Electrical Engineering Program memory 1K of instructions each instruction 14bits PC -Address of next instruction Instructions Program Memory (code)

Department of Electronic & Electrical Engineering General purpose memory 688bit words You can use this to store information Busses are sets of lines that carry data/addresses PIC puts an address on this bus BUSES USER DATA ADDRESSES

Department of Electronic & Electrical Engineering Special registers are used for IO Access these just like user data. Using an addresses TRISA 5bits to set input/out 85h is it's hexidecimal address read/write data to PORTB to read/set the state of the pins. IO Data Direction (in or out?) PINS

Department of Electronic & Electrical Engineering Arithmetic logic unit does the sums (ADD SUB OR..) Working register can be used to store results. Result is put in the working register OR a file register? STATUS register Z – result was 0 C – carry bit DC -... Data can come from instruction of a file register ALU

Department of Electronic & Electrical Engineering Registers and addresses Each register has a unique address. Instructions use this address to read/write a particular register

RPO Selects the bank 7 bits from opcode Don't worry about this yet! Address FILE REGISTERS Special USER DATA

Department of Electronic & Electrical Engineering Important registers STATUS : result of an operation (e.g. 0) also used to select register bank W: register used to store result of operation (not got an address) PC: program counter. Address in program memory of next instruction. Usually incremented by 1 after instruction has been executed.

Department of Electronic & Electrical Engineering PIC16F84A program memory Program memory is separate from user data (Harvard architecture) ● 1024 words of program memory (instructions) ● Each instruction has 14 bits ● You can not read or write to program memory ● Execution starts at address 0

Department of Electronic & Electrical Engineering Opcode and Operands The bits in an instructions can encoded: ● opcode ➔ what it does (e.g. move something) ● operand(s) ➔ What it does it too (e.g. what we move)

Department of Electronic & Electrical Engineering Example Machine Instructions (PIC16F84A) ● Each instruction is 14 bits ● For example ● subtract the contents of a register from W ● were we put result (W or file register) ● which register In this case opcode (instruction) operand (data or address of data)

Department of Electronic & Electrical Engineering Different types of instruction use different bits.

Department of Electronic & Electrical Engineering Assembly code We would go mad trying to program in machine code so we use ASSEMBLY CODE For example is written as subwf 20h, w Subtract W from register number 20h and put the result in W. A program called an assembler converters assembly code into machine code (MPLABX uses mpasm).

Department of Electronic & Electrical Engineering

Instruction Descriptions (page 37...)

Department of Electronic & Electrical Engineering mpasm reference (Assembly language). If you want to know more about the assembler please look at the E_Book mpasm_reference.pdf You can find this on moodle. It might be easier to learn from the examples (depends on how your brain works). There are many features of mpasm that are not in the examples.

Department of Electronic & Electrical Engineering Simple program. Initialize contents of a register. movlw 5 ; Put the number 5 into W movwf H'16' ; copy W to register 16 Addresses of the registers (hexadecimal)

Department of Electronic & Electrical Engineering Simulator doing previous slide