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

Similar documents
DERTS Design Requirements (1): Microcontroller Architecture & Programming

PIC Discussion By Eng. Tamar Jomaa

EEE111A/B Microprocessors

ME 6405 Introduction to Mechatronics

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

Lecture (04) PIC16F84A (3)

Embedded System Design

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

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

Learning Objectives:

PIC Discussion By Eng. Tamar Jomaa

Micro II and Embedded Systems

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

PIC 16F84A programming (II)

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

Chapter 2 Sections 1 8 Dr. Iyad Jafar

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers

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

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

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

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

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

These 3 registers contain enable, priority,

PIC Discussion. By Eng. Tamar Jomaa

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

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

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

PIC16F8X PIC16F8X. 18-pin Flash/EEPROM 8-Bit Microcontrollers

CENG-336 Introduction to Embedded Systems Development. Timers

Embedded Systems Lab Lab 8 EEPROM

/* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 2. PIC and Programming

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

Micro-Controller: PIC16C74 < Part 5: Interrupt >

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

Assembly Language Instructions

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

PIC16C432 OTP 8-Bit CMOS MCU with LIN bus Transceiver

Lecture (02) PIC16F84 (I)

D:\PICstuff\PartCounter\PartCounter.asm

Section 16. Basic Sychronous Serial Port (BSSP)

Interrupts. ELEC 330 Digital Systems Engineering Dr. Ron Hayne. Images Courtesy of Ramesh Gaonkar and Delmar Learning

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

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

Chapter 11: Interrupt On Change

PIC16F818/819 Data Sheet

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

PIC16F870/ /40-Pin, 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features:

ME 515 Mechatronics. A microprocessor

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!!

Mod-5: PIC 18 Introduction 1. Module 5

EE 361L Digital Systems and Computer Design Laboratory

8051 Microcontroller

Instuction set

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

Performance & Applications

PIC16C62X Data Sheet. EPROM-Based 8-Bit CMOS Microcontrollers Microchip Technology Inc. DS30235J

CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT. Spring 2006

When JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model)

Interrupts on PIC18F252 Part 2

PIC12F629/675 Data Sheet

Lecture (03) PIC16F84 (2)

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh

Chapter 13. PIC Family Microcontroller

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

To Our Valued Customers

PIC16F872 Data Sheet. 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D Microchip Technology Inc. DS30221C

PIC16F630/676 Data Sheet

PIC Microcontroller Embedded Systems Hadassah College Spring 2012 PIC Microcontroller Dr. Martin Land

Semester 1. Module Code: EEE305J1. Module Title: MICROCONTROLLER SYSTEMS

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

ECE 354 Introduction to Lab 2. February 23 rd, 2003

ELCT 912: Advanced Embedded Systems

ENE 334 Microprocessors

Laboratory: Introduction to Mechatronics

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

GUIDE TO USE OF PIC 16F690 EEProm. The 16F690 PIC has a 256 byte EEProm (mapped to 0x x21FF).

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS 2008/9. Semester One

Flow Charts and Assembler Programs

SOLUTIONS!! DO NOT DISTRIBUTE!!

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

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

4) In response to the the 8259A sets the highest priority ISR, bit and reset the corresponding IRR bit. The 8259A also places

Input/Output Ports and Interfacing

Week1. EEE305 Microcontroller Key Points

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

Chapter 09. Programming in Assembly

PIC16F630/676 Data Sheet

Section 14. Timer1 HIGHLIGHTS. Timer1. This section of the manual contains the following major topics:

DRPIC166X IP Core. High Performance 8-bit RISC Microcontroller v. 2.17

ECE 354 Computer Systems Lab II. Interrupts, Strings, and Busses

Laboratory 9. Programming a PIC Microcontroller - Part I

Documentation Design File Formats

LPTCOM. Bruce Misner Lakehead University h d3 RD2 pin 21. RD3 pin h d4. RD4 pin 27 RD5 pin h d5. RD6 pin 29 RD7 pin H d6

The XPIC. Scott Masch

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design

Transcription:

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

Memory Organization: PIC16F84 has two separate memory blocks, for data and for program. EEPROM memory with GPR and SFR registers in RAM memory make up the data block, while FLASH memory makes up the program block. Program Memory Program memory has been carried out in FLASH technology. The size of program memory is 1024 locations with 14 bits width where locations zero and four are reserved for reset and interrupt vector. Data Memory Data memory consists of EEPROM and RAM memories. EEPROM memory consists of 64 eight bit locations. EEPROM is not directly addressable, but is accessed indirectly through EEADR and EEDATA registers. EEPROM memory usually serves for storing important parameters. RAM memory for data occupies space on a memory map from location 0x0C to 0x4F which comes to 68 locations (GPR registers). SFR registers take up first 12 locations in banks 0 and 1.

Memory Banks Memory map is divided in 'width' to two areas called 'banks'. Selecting one of the banks is done via RP0 bit in STATUS register. Example: bcf STATUS, RP0 Instruction BCF clears bit RP0 in STATUS register and thus sets up bank 0. bsf STATUS, RP0 Instruction BSF sets the bit RP0 in STATUS register and thus sets up bank1. What would happen if the wrong bank was selected? BANK0 macro bcf STATUS, RP0 ;Select memory bank 0 endm BANK1 macro bsf STATUS, RP0 ;Select memory bank 1 endm

Stack: PIC16F84 has a 13-bit stack with 8 levels. Its basic role is to keep the value of PC after a jump from the main program to an address of a subprogram. In order for a program to know how to go back to the point where it started from, it has to return the value of a PC from a stack. When moving from a program to a subprogram, PC is being pushed onto a stack. When executing instructions such as RETURN, RETLW or RETFIE which were executed at the end of a subprogram, PC was taken from a stack so that program could continue where was stopped before it was interrupted. These operations of placing on and taking off from a program counter stack are called PUSH and POP.

Data Memory: Data memory is partitioned into two areas: - SFR Area. - GPR Area. The GPR area allow greater than 116 bytes of GP RAM. The data memory can be accessed either directly using the absolute address of each register file or indirectly through the file select register (FSR).

Addressing Modes: RAM memory locations can be accessed directly or indirectly. Direct Addressing: Direct Addressing is done through a 9-bit address. Example: Bsf STATUS, RP0 ;Bankl movlw 0xFF ;w=0xff movwf TRISA ;address of TRISA register is taken from instruction movwf

Indirect Addressing: Indirect unlike direct addressing does not take an address from an instruction but derives it from IRP bit of STATUS and FSR registers. Addressed location is accessed via INDF register which in fact holds the address indicated by a FSR.

Interrupts: Interrupts are a mechanism which enables MC to respond to some events, regardless of what MC is doing at that time. Each interrupt changes the program flow, interrupts it and after executing an interrupt routine, it continues from that same point on.

INTCON Register: Bit 7: GIE (Global Interrupt Enable bit): enables or disables all INTs. Bit 6: EEIE (EEPROM Write Complete Interrupt Enable bit): enables an INT at the end of a writing routine to EEPROM. If EEIE and EEIF are set simultaneously, an INT will occur. bit 5: T0IE (TMR0 Overflow Interrupt Enable bit): enables INTs during TMR0 overflow. If T0IE and T0IF are set simultaneously, interrupt will occur. Bit 4: INTE (INT External Interrupt Enable bit): enables external INT from pin RB0/INT. Bit 3 RBIE (RB port change Interrupt Enable bit): enables INTs to occur at the change of status of pins 4, 5, 6, and 7 of port B. If RBIE and RBIF are simultaneously set, an INT will occur. Bit 2: T0IF (TMR0 Overflow Interrupt Flag bit): Overflow of counter TMR0. Bit must be cleared in program in order for an INT to be detected. Bit 1: INTF (INT External Interrupt Flag bit) External INT occurred. If a rising or falling edge was detected on pin RB0/INT, INTF is set. Bit 0: RBIF (RB Port Change Interrupt Flag bit): informs about changes on pins 4, 5, 6 and 7 of port B.

PIC16F84 has four interrupt sources: 1. Termination of writing data to EEPROM 2. TMR0 interrupt caused by timer overflow 3. Interrupt during alteration on RB4, RB5, RB6 and RB7 pins of port B. 4. External interrupt from RB0/INT pin of microcontroller.

External interrupt on RB0/INT pin: External interrupt on RB0/INT pin is triggered by rising signal edge (if bit INTEDG=1 in OPTION<6> register), or falling edge (if INTEDG=0). When correct signal appears on INT pin, INTF bit is set in INTCON register. INTF bit (INTCON<1>) must be cleared in interrupt routine, so that interrupt wouldn't occur again while going back to the main program. Interrupt can be turned off by resetting INTE control bit (INTCON<4>). Interrupt during a TMR0 counter overflow: Overflow of TMR0 counter (from FFh to 00h) will set T0IF (INTCON<2>) bit. This is very important interrupt because many real problems can be solved using this interrupt.

Interrupt upon a change on pins 4, 5, 6 and 7 of port B Change of input signal on PORTB <7:4> sets RBIF (INTCON<0>) bit. Four pins RB7, RB6, RB5 and RB4 of port B, can trigger an interrupt which occurs when status on them changes from logic one to logic zero, or vice versa. For pins to be sensitive to this change, they must be defined as input. If any one of them is defined as output, interrupt will not be generated at the change of status. If they are defined as input, their current state is compared to the old value which was stored at the last reading from port B. Interrupt upon finishing write-subroutine to EEPROM This interrupt is of practical nature only. Since writing to one EEPROM location takes about 10ms (which is a long time in the notion of a MC), it doesn't pay off to a MC to wait for writing to end. Thus interrupt mechanism is added which allows the MC to continue executing the main program, while writing in EEPROM is being done in the background. When writing is completed, interrupt informs the MC that writing has ended. EEIF bit, through which this informing is done, is found in EECON1 register. Occurrence of an interrupt can be disabled by resetting the EEIE bit.

Interrupt initialization: Touse an interrupt mechanism of a MC, some initialization tasks need to be performed. By initialization we define to what interrupts the MC will respond, and which ones it will ignore. The above example shows initialization of external interrupt on RB0 pin of a MC. Occurrence of other interrupts is not allowed, and interrupts are disabled altogether until GIE bit is set to one.