Embedded System Spring, 2011 Lecture 4: The PIC Microcontrollers Eng. Wazen M. Shbair.

Slides:



Advertisements
Similar presentations
The 8051 Microcontroller and Embedded Systems
Advertisements

Chapter 2 HARDWARE SUMMARY
Embedded System Spring, 2011 Lecture 9: I/O Programming Eng. Wazen M. Shbair.
ECP2036 Microprocessor and Interfacing
EEE226 MICROPROCESSORBY DR. ZAINI ABDUL HALIM School of Electrical & Electronic Engineering USM.
Course Overview and The 8051 Architecture
MICRO PROCESSER The micro processer is a multipurpose programmable, clock driven, register based, electronic integrated device that has computing and decision.
Microcontroller – PIC – 4 PIC types PIC architecture
By Muhammad Ali Mazidi, Rolin McKinlay, Danny Causey
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.
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.
Microcontroller Architecture— PIC18F Family
Microcontroller based system design
Microcontroller Architecture PIC18F Family
Embedded System Spring, 2011 Lecture 3: The PIC Microcontrollers Eng. Wazen M. Shbair.
Programming 8-bit PIC Microcontrollers in C Martin Bates Elsevier 2008.
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
Lecture - 3 PIC18 family architecture and program development
Today’s Lecture List the Timers of PIC18 and their associated registers Describe the various modes of the PIC18 timers Program the PIC18 timers in Assembly.
Revised: Aug 1, ECE 263 Embedded System Design Lesson 1 68HC12 Overview.
Directives, Memory, and Stack. Directives Special commands to the assembler May or may not generate machine code Categories by their function Programming.
Eng.Samra Essalaimeh Philadelphia University 2013/ nd Semester PIC Microcontrollers.
November SSI Small Scale Integration Up to 12 equivalent gate circuits on a single chip Includes basic gates and flip-flops.
The 8051 Microcontroller and Embedded Systems
Aum Amriteswaryai Namah:. HHHHave separate program memory and data Memory AAAAccessed by separate busses.
Internal Input/Output Devices (I/O Subsystems)
Embedded System Spring, 2011 Lecture 10: Arithmetic, Logic Instruction and Programs Eng. Wazen M. Shbair.
Embedded System Spring, 2011 Lecture 5: The PIC Microcontrollers Eng. Wazen M. Shbair.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Ch. 2 Data Manipulation 4 The central processing unit. 4 The stored-program concept. 4 Program execution. 4 Other architectures. 4 Arithmetic/logic instructions.
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.
Embedded System Spring, 2011 Lecture 11: Bank Switching Eng. Wazen M. Shbair.
Today’s Lecture Unconditional branch instruction
Eng. Husam Alzaq The Islamic Uni. Of Gaza
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
ARM Assembly Language Programming and Architecture by Mazidi et al
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).
1 EKT 225 MICROCONTROLLER I CHAPTER ASSEMBLY LANGUAGE PROGRAMMING.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Embedded System Spring, 2011 Lecture 11: Bank Switching Eng. Wazen M. Shbair.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Chapter Microcontroller
8051 Micro Controller. Microcontroller versus general-purpose microprocessor.
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
MICROPROCESSOR INTEL 8086/8088 BY: SERA SYARMILA SAMEON.
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.
CEng3361/18 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2007 Recitation 01.
Dr. Iyad Jafar Introducing the PIC 16 Series and the 16F84A.
1.  List all addressing modes of PIC18 uCs  Contrast and compare the addressing modes  Code PIC18 instructions to manipulate a lookup table.  Access.
Memory Organization 1.  3 types of memory are used in PIC18 microcontroller devices: Program Memory - Flash Memory Data RAM - Static RAM Data EEPROM.
STUDY OF PIC MICROCONTROLLERS.. Design Flow C CODE Hex File Assembly Code Compiler Assembler Chip Programming.
CHAPTER ADDRESSING MODES.
CPU How computers work Address bus Data bus Control bus A ALU B PC: C
Microprocessor Systems Design I
Microprocessor Systems Design I
The 8051 Microcontroller and Embedded Systems
Microprocessor Systems Design I
PIC – ch. 2b Md. Atiqur Rahman Ahad.
Microprocessor Systems Design I
Introduction to Microprocessors and Microcontrollers
Computer Programming Machine and Assembly.
מבנה בסיסי של מיקרו בקר מבוא למיקרו מבנה בסיסי דיאגרמת מלבנים
Microprocessors And Microcontrollers
Unit – Microcontroller Tutorial Class - 2 ANITS College
Chapter 4 Instruction Set.
Figure 2-1. PIC WREG and ALU Using Literal Value
EECE.3170 Microprocessor Systems Design I
8051 ASSEMBLY LANGUAGE PROGRAMMING
Presentation transcript:

Embedded System Spring, 2011 Lecture 4: The PIC Microcontrollers Eng. Wazen M. Shbair

2 IUG- Embedded System Today’s Lecture  The WREG Register  The PIC File Register

3 The WREG Register  Many registers for arithmetic and logic operation.  The WREG (WORking Register) Register is one of the most widely used registers of the PIC 8-bit register  any data larger than 8 bits must be broken into 8-bits chunks before it is processed. There is only one. 3-3 D7D6D5D2D4D3D1D0

4 MOVLW  Moves 8-bit data into WREG MOVLW k; move literal value k into WREG  Example MOVLW 25H MOVLW A5H  Is the following code correct? MOVLW 9H MOVLW A23H 1-4

5 ADDLW r ADDLW k; Add literal value k to WREG (k +WREG) r Example: r MOVLW 12H r ADDLW 16H

6 PIC WREG and ALU Using Literal Value

7 The WREG Register  When programming the WREG of PIC, the following points should be noted: Values can be loaded directly into the WREG. If values 0 to F are moved into an 8-bit register such as WREG, the rest of the bits are assumed to be all zeros. Moving a value larger than 255 (FF in hex) into the WREG register will truncate the upper byte and cause a warning in the.err file.

8 The WREG Register  MOVLW 7F2H; Illegal, becomes F2H  MOVLW 456H ; Illegal, becomes 56H  MOVLW 60A5H; Illegal, becomes A5H

9 The PIC File Register  It is the data memory. Read/Write  Static RAM Used for data storage, scratch pad and registers for internal use and function 8-bit width PIC File Register General Purpose RAM GP RAMEEPROM Special Function Registers

Register File Concept Data Bus d Decoded Instruction from Program Memory: Arithmetic/Logic Function to be Performed Result Destination Address of Second Source Operand  Register File Concept: All of data memory is part of the register file, so any location in data memory may be operated on directly  All peripherals are mapped into data memory as a series of registers  Orthogonal Instruction Set: ALL instructions can operate on ANY data memory location wf wf ALU WREG Data Memory (Register File) 07h 08h 09h 0Ah 0Bh 0Ch 0Dh 0Eh 0Fh 10h Opcode d d a a Address

11 Special Function Registers  Dedicated to specific functions such as ALU status, timers, serial communication, I/O ports, ADC,…  The function of each SFR is fixed by the CPU designer at the time of design it is used for control of the microcontroller or peripheral  8-bit registers  Their numbers varies from one chip to another. 1-11

12 General Purpose RAM  Group of RAM locations  8-bit registers  Larger than SFR Difficult to manage them by using Assembly language Easier to handle them by C Compiler.  The microchip website provides the data RAM size, which is the same as GPR size.

13

Figure 2-2. File Registers of PIC12, PIC16, and PIC18

15 GP RAM vs. EEPROM in PIC chips  GPRs are used by the CPU for internal data storage.  EEPROM are considered as add-on memory that one can add externally to the ship.  So PIC chip may have zero byte of EEPROM data memory, but impossible for a PIC have zero size for the file register.

16 File Register and access bank in the PIC18  The PIC18 Family can have a max. of 4096 Bytes.  The File Register has addresses of 000- FFFH divided into 256-byte banks Max. 16 banks (How?)  At least there is one bank Known as default access bank.  Bank switching is a method used to access all the banks. 1-16

17 Access bank in the PIC18  It is 256-Byte bank.  Divided into equal two discontinuous sections (each 128 B). GP RAM, from 0 to 7FH SFR, from F80H to FFFH 1-17

18 SFRs of the PIC18 Family.

19 IUG- Embedded System19 References  Jie Hu, ECE692 Embedded Computing Systems, Fall  PIC Microcontroller And Embedded Systems: using Assembly and C for PIC 18, M. Mazidi, R. McKinlay and D. Causey, Prentice Fall,  Eng. Husam Alzaq, Embedded System Course, IUG, 2010