Chapter 7 Larger Systems and the PIC 16F873A The aims of this chapter are to introduce: The architecture of the 16F873A microcontroller; The 16F873A memory.

Slides:



Advertisements
Similar presentations
INPUT-OUTPUT ORGANIZATION
Advertisements

PROGRAMMABLE PERIPHERAL INTERFACE -8255
8051 Core Specification.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Microprocessor and Microcontroller
I/O Unit.
Microcontroller – PIC – 4 PIC types PIC architecture
Starting with serial Chapter Ten 10.1, 10.2,
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
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.
Microprocessor and Microcontroller Based Systems
Microcontroller Architecture PIC18F Family
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Programming 8-bit PIC Microcontrollers in C Martin Bates Elsevier 2008.
INPUT-OUTPUT ORGANIZATION
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
ECE/CS-352: Embedded Microcontroller Systems Embedded Microcontroller Systems.
1 EKT 225 MICROCONTROLLER I CHAPTER 3 I/O PORT PROGRAMMING.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
I/O PORTS (Simplest Peripherals) PORT A: 6 bits wide (7th and 8th bit always read as 0) PORT B: 8 bits wide PORT C: 8 bits wide PORT D: 8 bits wide.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
Digital to Analogue Converter
Prepared by Eng. Musa Alyaman1 Chapter Seven Chapter Seven PIC16F87x.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
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.
8051 Micro controller. Architecture of 8051 Features of 8051.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
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.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
PPI-8255.
S4525A Peripherals & Enhanced FLASH 1 © 1999 Microchip Technology Incorporated. All Rights Reserved. S4525A Peripherals & Enhanced FLASH 1 Peripherals.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Presented by Sadhish Prabhu
Chapter 11 Data Acquisition and Manipulation The aims of this chapter are to introduce: the main features of a data acquisition system; the characteristics.
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.
Chapter 12 Some PIC Microcontroller Advances The aims of this chapter are to introduce: To introduce in overview two microcontrollers which show some enhanced.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
Working with Time: Interrupts, Counters and Timers
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Chapter 3 Parallel Ports, Power Supply and the Clock Oscillator The aims of this chapter are to introduce: Why we need parallel input/output; How simple.
Chapter Microcontroller
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Components of a typical full-featured microcontroller.
Lecture – 8 Interrupt 1. Outline Introduction Handling interrupt Interrupt sources Switching interrupt Peripheral interrupts Using two interrupts Conclusions.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
An Introduction to Embedded Systems, and the PIC Microcontroller Lecture 8: Interrupts The aims of this session are to explore the structure and application.
Embedded Microcontroller Systems
Embedded Microcontroller Systems
For further information
Microprocessor Systems Design I
UNIT – Microcontroller.
Microprocessor Systems Design I
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
Microprocessor Systems Design I
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Tiny Computers, Hidden Control
EE Embedded Systems Fall 2015
Parallel communication interface 8255
Introducing the PIC Mid-Range Family and the 16F84A
EECE.3170 Microprocessor Systems Design I
PIC18 Interrupt Programming
Presentation transcript:

Chapter 7 Larger Systems and the PIC 16F873A The aims of this chapter are to introduce: The architecture of the 16F873A microcontroller; The 16F873A memory map; The 16F873A interrupt structure; The use of the Microchip in-circuit debugger. Designing Embedded Systems with PIC Microcontrollers: Principles and Applications 2 nd Edition. Tim Wilmshurst Instructors using Designing Embedded Systems with PIC Microcontrollers are welcome to use or change these slides as they see fit. Feedback, to is The copyright to all diagrams is held by Microchip Technology, or T. Wilmshurst, unless otherwise stated

The 16F87XA Microcontroller - Some Overview Information The 16F873A is one of a group of 4 very similar 16 Series PIC microcontrollers. It comes in the smaller of two package sizes, and has the smallest memory.

The PIC 16F873A Block Diagram As a direct “big brother” of the 16F84A, it should be possible to recognise all the features of the smaller device in the larger 16F873A.

The 16F873A Core The CPU The Instruction word flows along here. The Instruction word may contain instruction, address and data information Address info flows along here Instruction info flows along here Data info flows along here Address for Data memory generated here

The Status Register

Program Memory The Memory Data Memory

Peripherals The Peripherals Counter/Timers Parallel Ports Serial Ports It is easy to see the peripherals, tho’ each one will take some work to understand. Connection to the peripherals goes through the parallel port bits. Most of these bits therefore have more than one use, which begins to explain why the names against them are not simple.

Program Memory Program always starts here Interrupt Routine always starts here Instructions which access the Stack Memory Address

The Data Memory Map, including the Special Function Registers Areas of immediate interest

Understanding the Banked Addressing

Parallel Input/Output Ports 4 SFRs for the 16F873A Parallel Ports The SFR named PORTX holds the input/output data for the port, ie it holds all the “Data Latch” bits for that port. The SFR named TRISX holds all the “TRIS Latch” bits for that port. The bits can be set independently, so one can be input while another output. They cannot be both at the same time. Port A, B and C pin connections can easily be found on the pin diagram. Note that many pins have several functions, as indicated on the diagram.

The 16F873A Configuration Word

Bus Collision Comparator Capture/ Compare 2 Timer 1 Timer 2 Capture/Compare 1 (Master) Synchronous Serial Port USART Transmit USART Receive A to D Converter Parallel Slave Port EEPROM Write Timer 0 External Port B Change Peripheral Enable 16F873A Interrupt Structure The 16F84A Interrupt Structure Here the minimalist structure of the 16F84A is seen extended to make something much larger. All interrupts are routed ultimately through to the single interrupt vector, seen in the program memory map. Global Interrupt Enable

16F873A INTCON Register With 15 interrupt sources, the INTCON register can only hold a small proportion of all flags and enable bits. PEIE is the Peripheral Interrupt Enable Bit, acting as a subsidiary Global Enable, to all those interrupt sources upstream of the AND gate it drives. It must be set to 1 if any of the “upstream” interrupts are to be used.

16F873A PIE1/PIR1 (Peripheral Interrupt Enable/ Peripheral Interrupt Request) Registers To augment the INTCON register, four SFRs are added - PIE1 and PIE2 for enable bits and located in memory bank 1; and PIR1 and PIR2 in memory bank 0, holding the flag bits. PIE1 and PIR1 each follow the same pattern, as do PIE2 and PIR2. All active bits are reset to 0 on any form of power up.

16F873A PIE2/PIR2 Registers

bsfpie1,sspie;enable I2C interrupt... bcfintcon,rbif;clear pending interrupts bcfpir1,sspif bsfintcon,rbie bsfintcon,peie bsfintcon,gie... loopgotoloop;await keypad and I2C interrupts... ;*************************************************************** ;This is ISR, caused by keypad or I2C address match. ;Does not context save, as all action is in ISRs. ;*************************************************************** Interrupt_SR btfsc intcon, rbif;is it keypad interrupt? gotokpad_ISR ;Here if interrupt is I2C, either address match (Ack sent automatically) ;OR further received byte has been detected. ;check whether this byte was address or data bsfstatus,rp0 btfscsspstat,d_a gotoISR1;go if word was data... bcfpir1,sspif;clear interrupt bit, and end ISR retfie ;Here if data byte has been detected, word is hence already in buffer. ISR1call dig_pntr_set ;sort display pointer... bcfpir1,sspif;clear interrupt bit retfie ;here if sending I2C word. Send byte held in kpad_char Send_I2C bcfstatus,rp0... bcfpir1,sspif;clear interrupt bit retfie An Interrupt Example Program Example 10.3 uses 2 interrupts. Work out from this program fragment how they are applied.

multiplexer selects data source, when in output Peripheral can disable port input Pins RA0, 1, 2, and 3 PIC 16F873A Port A Pin Driver Circuits Pin RA5 The port is shared between general-purpose bidirectional digital data, the Analog to Digital Converter (ADC) module, and comparators. On power-up the port bits are set as analog inputs. To use the port for digital purposes the ADCON0 register, must be set appropriately. Timer 0 input is on bit 4.

Port B Pin Driver Circuits RB3 to RB0RB7 to RB4 A straightforward port, except that bits 3, 6 and 7 are used for In Circuit Serial Programming (ICSP). If ICSP is used, the designer must either not use these pins for any other purpose, or use them in such a way that they are still available ICSP.

multiplexer selects port bit input characteristic peripheral can override TRIS setting RC4, 3 Pins Port C Pin Driver Circuits RC7 to RC5, RC2 to RC0 Pins The most complex of the 16F873A ports, all inputs have Schmitt trigger inputs. Aside from general-purpose i/o, Port C pins are shared with some of the more complex microcontroller peripherals, including serial communication.

Test and Commission: Layers of Dependence in an Embedded System

The ICD2 In-Circuit Debugger Features of the Microchip ICD2 system are shown. The host computer is linked to the target system via a special adaptor unit or pod. The ICD is controlled from the host computer, which must be running MPLAB. The ICD2 pod links to the host computer via a USB cable, and connects to the target system via another cable, having five interconnections. These are shown in the diagram, and are the same as those for ICSP, except that the low voltage programming pin, bit 3 of Port B is not used. The internal microcontroller resources needed by the ICD are also shown, and include elements of program memory, data memory, and the stack. The ICD2 can be used in two distinct modes – debugger and programmer.

End of Lecture Note Example design – the Derbot AGV Study all details of Program Example 7.1