Micro-Controller: PIC16C74 < Architecture >

Slides:



Advertisements
Similar presentations
Introduction to PIC Microcontrollers
Advertisements

8051 Core Specification.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Microcontroller – PIC – 4 PIC types PIC architecture
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.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 29: Microcontroller intro.
Microcontroller Architecture— PIC18F Family
The domestic refrigerator-An example A car door mechanism.
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
Prepared by Eng. Musa Alyaman1 Chapter Seven Chapter Seven PIC16F87x.
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.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Introduction to Microprocessors
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
INTRODUCTION TO PIC MICROCONTROLLER. Overview and Features The term PIC stands for Peripheral Interface Controller. Microchip Technology, USA. Basically.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
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,
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Components of a typical full-featured microcontroller.
INTRODUCTION TO PIC MICROCONTROLLERS INTRODUCTION TO PIC MICROCONTROLLERS Dr.Y.Narasimha Murthy Ph.D SRI SAIBABA NATIONAL COLLEGE(AUTONOMOUS)
Dr. Iyad Jafar Introducing the PIC 16 Series and the 16F84A.
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
Memory Organization 1.  3 types of memory are used in PIC18 microcontroller devices: Program Memory - Flash Memory Data RAM - Static RAM Data EEPROM.
16F877A.
Seminar On 8085 microprocessor
Embedded Systems Programming
Basic Computer Organization and Design
The 8085 Microprocessor Architecture
Atmega32 Architectural Overview
Microprocessors and Programming Department of Mechatronics Engineering
Microprocessor Systems Design I
UNIT – Microcontroller.
Microprocessor Systems Design I
The 8085 Microprocessor Architecture
Microprocessor Systems Design I
Introduction of microprocessor
PIC 16F877.
PIC 8 BIT AND 16 BIT MICROCONTROLLER ARCHITECTURE
Microprocessor Systems Design I
Dr. Michael Nasief Lecture 2
8085 microprocessor.
8085 Microprocessor Architecture
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
مقدمه با توجه به اهميت و گسترش روزافزون كاربردهاي ميكروكنترلرها و محدوديت هايي كه ميكروكنترلرهاي خانواده ي MCS51 ايجاد مي كرد،شركت Microchipنسل جديدي.
Introduction to Microprocessors and Microcontrollers
PIC Microcontroller What is PC LATH?????.
EE Embedded Systems Fall 2015
Getting the Most Out of Low Power MCUs
Morgan Kaufmann Publishers Computer Organization and Assembly Language
8085 Microprocessor Architecture
Introducing the PIC Mid-Range Family and the 16F84A
Unit – Microcontroller Tutorial Class - 2 ANITS College
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
Chapter 4 Instruction Set.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Important 8051 Features On chip oscillator 4K bytes ROM 128 bytes RAM
The 8085 Microprocessor Architecture
EECE.3170 Microprocessor Systems Design I
8051 Micro Controller.
Introduction to Microprocessor Programming
EECE.3170 Microprocessor Systems Design I
8085 Microprocessor Architecture
Computer Operation 6/22/2019.
Microprocessors and Programming Department of Mechatronics Engineering
Presentation transcript:

Micro-Controller: PIC16C74 < Architecture >

I. Architectural Overview What is a micro Controller ? I/O = + Micro controller Micro Processor I/O interface circuit

I. Architectural Overview PIC16C7X Microcontroller Core Features: • High-performance RISC CPU • Only 35 single word instructions to learn • All single cycle instructions except for program branches which are two cycle • Operating speed: 200 ns instruction execution time @20 MHz clock input • 4K x 14 words of Program Memory(EPROM), 192x 8 bytes of Data Memory (RAM) • Interrupt capability (12 type) • Eight level deep hardware stack • Direct, indirect, and relative addressing modes • Power-on Reset (POR) • Power-up Timer (PWRT) and Oscillator Start-up Timer (OST) • Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation • Power saving SLEEP mode • Selectable oscillator options • Low-power, high-speed CMOS EPROM technology • Wide operating voltage range: 2.5V to 6.0V • High Sink/Source Current 25/25 mA

I. Architectural Overview

I. Architectural Overview GENERAL DESCRIPTION 1) The PIC16C74 is a low-cost, high-performance, CMOS, 8-bit microcontrollers with integrated analog-to-digital (A/D) converters. All PIC16/17 microcontrollers employ an advanced RISC architecture. 2) The PIC16C74 has enhanced core features, eight-level deep stack, and multiple internal and external interrupt sources. The separate instruction and data buses of the Harvard architecture allow a 14-bit wide instruction word with the separate 8-bit wide data. The two stage instruction pipeline allows all instructions to execute in a single cycle, except for program branches which require two cycles. 3) A total of 35 instructions (reduced instruction set) are available. 4) PIC16C74 typically achieve a 2:1 code compression and a 4:1 speed improvement over other 8-bit microcontrollers. 5) The PIC16C74/74A devices have 192 bytes of RAM, 33 I/O pins. In addition several peripheral features are available including: three timer/counters, two Capture/ Compare/PWM modules and two serial ports. The Synchronous Serial Port can be configured as either a 3-wire Serial Peripheral Interface (SPI) or the two-wire Inter-Integrated Circuit (I 2 C) bus. The Universal Synchronous Asynchronous Receiver Transmitter (USART) is also known as the Serial Communications Interface or SCI.

I. Architectural Overview

I. Architectural Overview Introduction The high performance of the PICmicro™ devices can be attributed to a number of architectural features commonly found in RISC microprocessors. These include: • Harvard architecture • Long Word Instructions • Single Word Instructions • Single Cycle Instructions • Instruction Pipelining • Reduced Instruction Set • Register File Architecture

I. Architectural Overview • Harvard Architecture: Harvard architecture has the program memory and data memory as separate memories and are accessed from separate buses. This improves bandwidth over traditional von Neumann architecture in which program and data are fetched from the same memory using the same bus. To execute an instruction, a von Neumann machine must make one or more (generally more) accesses across the 8-bit bus to fetch the instruction.Then data may need to be fetched, operated on, and possibly written. As can be seen from this description, that bus can be extremely conjested. While with a Harvard architecture, the instruction is fetched in a single instruction cycle (all 14-bits). While the program memory is being accessed, the data memory is on an independent bus and can be read and written. These separated buses allow one instruction to execute while the next instruction is fetched.

I. Architectural Overview • Long Word Instructions: Long word instructions have a wider (more bits) instruction bus than the 8-bit Data Memory Bus. This is possible because the two buses are separate. This further allows instructions to be sized differently than the 8-bit wide data word which allows a more efficient use of the program memory, since the program memory width is optimized to the architectural requirements. • Single Word Instructions: Single Word instruction opcodes are 14-bits wide making it possible to have all single word instructions. A 14-bit wide program memory access bus fetches a 14-bit instruction in a single cycle. With single word instructions, the number of words of program memory locations equals the number of instructions for the device. This means that all locations are valid instructions. Typically in the von Neumann architecture, most instructions are multi-byte. In general, a device with 4-KBytes of program memory would allow approximately 2K of instructions. This 2:1 ratio is generalized and dependent on the application code. Since each instruction may take multiple bytes, there is no assurance that each location is a valid instruction.

I. Architectural Overview • Instruction Pipeline: The instruction pipeline is a two-stage pipeline which overlaps the fetch and execution of instruc-tions. The fetch of the instruction takes one TCY, while the execution takes another TCY. However, due to the overlap of the fetch of current instruction and execution of previous instruction, an instruction is fetched and another instruction is executed every single TCY. • Single Cycle Instructions: With the Program Memory bus being 14-bits wide, the entire instruction is fetched in a single machine cycle (TCY). The instruction contains all the information required and is executed in a single cycle. There may be a one cycle delay in execution if the result of the instruction modified the contents of the Program Counter. This requires the pipeline to be flushed and a new instruction to be fetched. • Reduced Instruction Set: When an instruction set is well designed and highly orthogonal (symmetric), fewer instructions are required to perform all needed tasks. With fewer instructions, the whole set can be more rap-idly learned. • Register File Architecture: The register files/data memory can be directly or indirectly addressed. All special function regis-ters, including the program counter, are mapped in the data memory.

I. Architectural Overview Clocking Scheme/Instruction Cycle The clock input (from OSC1) is internally divided by four to generate four non-overlapping quadrature clocks, namely Q1, Q2, Q3, and Q4. Internally, the program counter (PC) is incre-mented every Q1, and the instruction is fetched from the program memory and latched into the instruction register in Q4. The instruction is decoded and executed during the following Q1 through Q4. The clocks and instruction execution flow are illustrated in Figure 4-3, and

I. Architectural Overview Instruction Flow/Pipelining 1) An “Instruction Cycle(Tcy )” consists of four Q cycles (Q1, Q2, Q3, and Q4). Fetch takes one instruction cycle while decode and execute takes another instruction cycle. However, due to Pipelining, each instruction effectively executes in one cycle. If an instruction causes the program counter to change (e.g. GOTO) then an extra cycle is required to complete the instruction (Example 4-1). 2) The instruction fetch begins with the program counter incrementing in Q1. In the execution cycle, the fetched instruction is latched into the “Instruction Register (IR)” in cycle Q1. This instruction is then decoded and executed during the Q2, Q3, and Q4 cycles. Data memory is read during Q2 (operand read) and written during Q4 (destination write). 3) Example 4-1 shows the operation of the two stage pipeline for the instruction sequence shown.

I. Architectural Overview At time TCY0, the first instruction is fetched from program memory. During TCY1, the first instruction executes while the second instruction is fetched. During TCY2, the second instruction is executed while the third instruction is fetched. During TCY3, the fourth instruction is fetched while the third instruction (CALL SUB_1) is executed. When the third instruction completes execution, the CPU forces the address of instruction four onto the Stack and then changes the Program Counter (PC) to the address of SUB_1. This means that the instruction that was fetched during TCY3 needs to be “flushed” from the pipeline. During TCY4, instruction four is flushed (executed as a NOP) and the instruction at address SUB_1 is fetched. Finally during TCY5, instruction five is executed and the instruction at address SUB_1 + 1 is fetched.

I. Architectural Overview

I. Architectural Overview

II. Memory Organization Program Memory Organization(EPROM) : The PIC16C74 has a 13-bit program counter capable of addressing an 4K x 14 program memory Space (0000h-0FFFh ).The reset vector is at 0000h and the interrupt vector is at 0004h.

II. Memory Organization 2. Data Memory Organization(RAM, Register File) : The data memory is partitioned into multiple banks which contain the General Purpose Registers and the Special Function Registers. Bits RP1 and RP0 are the bank select bits. RP1:RP0 (STATUS<6:5>) = 00 ® Bank0 = 01 ® Bank1 Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for the Special Function Registers. Above the Special Function Registers are General Purpose Registers, implemented as static RAM. All implemented banks contain special function registers. Some “high use” special function registers from one bank may be mirrored in another bank for code reduction and quicker access. 2.1 GENERAL PURPOSE REGISTER FILE The register file can be accessed either directly, or indirectly through the File Select Register FSR

II. Memory Organization

II. Memory Organization 2.2 SPECIAL FUNCTION REGISTERS The Special Function Registers are registers used by the CPU and Peripheral Modules for controlling the desired operation of the device. These registers are implemented as static RAM. The special function registers can be classified into two sets (core and peripheral). Those registers associated with the “core” functions are described in this section, and those related to the operation of the peripheral features are described in the section of that peripheral feature.

II. Memory Organization

II. Memory Organization

III. Special Function Register 2.2.1 STATUS REGISTER The STATUS register contains the arithmetic status of the ALU, the RESET status and the bank select bits for data memory. The STATUS register can be the destination for any instruction, as with any other register. If the STATUS register is the destination for an instruction that affects the Z, DC or C bits, then the write to these three bits is disabled. These bits are set or cleared according to the device logic. Furthermore, the TO and PD bits are not writable. Therefore, the result of an instruction with the STATUS register as destination may be different than intended. For example, CLRF STATUS will clear the upper-three bits and set the Z bit. This leaves the STATUS register as 000u u1uu (where u = unchanged). It is recommended, therefore, that only BCF, BSF, SWAPF and MOVWF instructions are used to alter the STATUS register because these instructions do not affect the Z, C or DC bits from the STATUS register.

III. Special Function Register

III. Special Function Register 2.2.2 OPTION REGISTER The OPTION register is a readable and writable register which contains various control bits to configure the TMR0/WDT prescaler, the External INT Interrupt, TMR0, and the weak pull-ups on PORTB.

III. Special Function Register 2.2.3 INTCON REGISTER The INTCON Register is a readable and writable register which contains various enable and flag bits for the TMR0 register overflow, RB Port change and External RB0/INT pin interrupts.

III. Special Function Register 2.2.4 PIE1 REGISTER This register contains the individual enable bits for the peripheral interrupts.

III. Special Function Register 2.2.6 PIE2 REGISTER This register contains the individual enable bit for the CCP2 peripheral interrupt.

III. Special Function Register 2.2.7 PIR2 REGISTER This register contains the CCP2 interrupt flag bit.

III. Special Function Register 2.2.8 PCON REGISTER The Power Control (PCON) register contains a flag bit to allow differentiation between a Power-on Reset (POR) to an external MCLR Reset or WDT Reset. Those devices with brown-out detection circuitry contain an additional bit to differentiate a Brown-out Reset condition from a Power-on Reset condition.

III. Special Function Register 2.3 PCL and PCLATH The program counter (PC) is 13-bits wide. The low byte comes from the PCL register, which is a readable and writable register. The upper bits (PC<12:8>) are not readable, but are indirectly writable through the PCLATH register. On any reset, the upper bits of the PC will be cleared. Figure 4-17 shows the two situations for the loading of the PC. The upper example in the figure shows how the PC is loaded on a write to PCL (PCLATH<4:0> ® PCH). The lower example in the figure shows how the PC is loaded during a CALL or GOTO instruction (PCLATH<4:3> ® PCH).

III. Special Function Register 2.3.1 COMPUTED GOTO A computed GOTO is accomplished by adding an off-set to the program counter (ADDWF PCL). When doing a table read using a computed GOTO method, care should be exercised if the table location crosses a PCL memory boundary (each 256 byte block). 2.3.2 STACK The PIC16CXX family has an 8 level deep x 13-bit wide hardware stack. The stack space is not part of either program or data space and the stack pointer is not readable or writable. The PC is PUSHed onto the stack when a CALL instruction is executed or an interrupt causes a branch. The stack is POPed in the event of a RETURN, RETLW or a RETFIE instruction execution. PCLATH is not affected by a PUSH or POP operation. The stack operates as a circular buffer. This means that after the stack has been PUSHed eight times, the ninth push overwrites the value that was stored from the first push. The tenth push overwrites the second push (and so on).

III. Special Function Register 2.4 Program Memory Paging PIC16C7X devices are capable of addressing a continuous 8K word block of program memory. The CALL and GOTO instructions provide only 11 bits of address to allow branching within any 2K program memory page. When doing a CALL or GOTO instruction the upper 2 bits of the address are provided by PCLATH<4:3>. When doing a CALL or GOTO instruction, the user must ensure that the page select bits are programmed so that the desired program memory page is addressed. If a return from a CALL instruction (or interrupt) is executed, the entire 13-bit PC is pushed onto the stack. Therefore, manipulation of the PCLATH<4:3> bits are not required for the return instructions (which POPs the address from the stack). Example 4-1 shows the calling of a subroutine in page 1 of the program memory. This example assumes that PCLATH is saved and restored by the interrupt service routine (if interrupts are used).

III. Special Function Register

III. Special Function Register 2.5 Indirect Addressing, INDF and FSR Registers The INDF register is not a physical register. Addressing the INDF register will cause indirect addressing. Indirect addressing is possible by using the INDF register. Any instruction using the INDF register actually accesses the register pointed to by the File Select Register, FSR. Reading the INDF register itself indirectly (FSR = '0') will read 00h. Writing to the INDF register indirectly results in a no-operation (although status bits may be affected). An effective 9-bit address is obtained by concatenating the 8-bit FSR register and the IRP bit (STATUS<7>), as shown in Figure 4-18. A simple program to clear RAM locations 20h-2Fh using indirect addressing is shown in Example 4-2.

III. Special Function Register

Microchip Inc. Microchip is the Embedded Control Solutions Company . The company’s focus is on products that meet the needs of the embedded control market. They are a leading supplier of: • 8-bit General Purpose Microcontrollers (PICmicro™ MCUs) • Speciality and standard non-volatile memory devices • Security devices (KEELOQ ® ) Microchip’s PICmicro 8-bit MCUs offer a price/performance ratio that allows them to be considered for any traditional 8-bit MCU application as well as some traditional 4-bit applications (Base-Line family), dedicated logic replacement and low-end DSP applications (High-End family). These features and price-performance mix make PICmicro MCUs an attractive solution for most applications. PICmicro devices are grouped by the size of their Instruction Word. The three current PICmicro families are: 1. Base-Line: 12-bit Instruction Word length (PIC16C5X series) 2. Mid-Range: 14-bit Instruction Word length (PIC16C6X,7X,8X series) 3. High-End: 16-bit Instruction Word length (PIC17 series)

Microchip Inc. All Mid-Range PICmicro™ MCUs operate over the standard voltage range. Devices are also offered which operate over an extended voltage range (and reduced frequency range). Table 1-1 shows all possible memory types and voltage range designators for the PIC16CXXX MCU family. Table 1-1: Device Memory Type and Voltage Range Designators - As you can see in Table 1-2, Microchip specifications its extended range devices at a more conservative voltage range until device characterization has ensured they will be able to meet the goal of their final design specifications. Table 1-2: Typical Voltage Ranges for Each Device Type