Chapter 2. Overview of Architecture and Microcontroller-Resources

Similar documents
Chapter 6 PROGRAMMING THE TIMERS

Chapter 6 PROGRAMMING THE TIMERS

Lesson-3: Counters and Timers

Chapter 09. Programming in Assembly

Programmed I/O (busy( wait) ) method for ports and devices, and the need for interrupt driven IOs

The 8051 microcontroller has two 16-bit timers/counters called T0 and T1.

Hello and welcome to this Renesas Interactive course that covers the Watchdog timer found on RX MCUs.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

16-BIT TIMER AND EVENT COUNTER

AVR Timers TIMER0. Based on:

Interrupt/Timer/DMA 1

Chapter x96 Family Microcontrollers

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

CENG-336 Introduction to Embedded Systems Development. Timers

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

HC12 Built-In Hardware

8051 Microcontroller

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

Microcontroller basics

INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab

leos little embedded Operating System User's guide Written by Leonardo Miliani

CPEG300 Embedded System Design. Lecture 8 Timer

Chapter 1. Microcontroller Overview

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.

Introduction to Embedded Systems

Chapter 09. Programming in Assembly

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT89S52

Chapter Family Microcontrollers Instruction Set

Timers and interrupts

MCU: Interrupts and Timers. Ganesh Pitchiah

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

Introduction to the MC9S12 Hardware Subsystems

Chapter 09. Programming in Assembly

COMP2121: Microprocessors and Interfacing

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Interrupts, timers and counters

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

CHAPTER TIMER PROGRAMMING

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

Chapter 15. ARM MCUs Architecture, Programming and Development Tools

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

Introduction to ARM LPC2148 Microcontroller

Timers and Counters. LISHA/UFSC Prof. Dr. Antônio Augusto Fröhlich Fauze Valério Polpeta Lucas Francisco Wanner.

INTERRUPTS in microprocessor systems

Section 10. Watchdog Timer and Power Saving Modes

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

MCS-51 Serial Port A T 8 9 C 5 2 1

A. This Errata sheet represents the known bugs, anomalies and work-arounds for the ADuC812 MicroConverter.

8. Power Management and Sleep Modes

General Purpose Programmable Peripheral Devices. Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

10 Timers. Timers are basically digitial counters. Logic is provided to give the counters lots of capabilities. The logic

PPG Function of F2MC-16LX MCU Series as PWM

Department of EIE / Pondicherry Engineering College. Timer/Counters. Department of EIE / Pondicherry Engineering College 1

DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM

DEVICE DRIVERS AND TERRUPTS SERVICE MECHANISM Lesson-15: Writing Device Driving ISRs in a System

ELEG3923 Microprocessor Ch.9 Timer Programming

timer 1 Fri Oct 13 13:00:

Timer programming

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

Product Update. Errata to Z8 Encore! 8K Series Silicon. Z8 Encore! 8K Series Silicon with Date Codes 0402 and Later

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

8051 Serial Communication

MN101E50 Series. 8-bit Single-chip Microcontroller

Hello, and welcome to this presentation of the STM32 Real- Time Clock. It covers the main features of this peripheral, which is used to provide a

PC/104 Multifunction I/O Board Hardware Manual Model 526 Rev.B February 2009

Department of Electronics and Instrumentation Engineering Question Bank

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

Course Introduction. 2009, Renesas Technology America, Inc., All Rights Reserved

Embedded Systems and Software

Product Technical Brief S3C2440X Series Rev 2.0, Oct. 2003

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

8051 Timers. Class 7 EE4380 Fall Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

8051 Microcontroller Interrupts

Hello and welcome to this Renesas Interactive module that covers the Independent watchdog timer found on RX MCUs.

Microprocessors & Interfacing

Microcomputer Technical Information

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

CN310 Microprocessor Systems Design

Design UART Loopback with Interrupts

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

Newbie s Guide to AVR Timers

11 General-Purpose Timers

PGT302 Embedded Software Technology. PGT302 Embedded Software Technology

STM32 Ecosystem workshop. T.O.M.A.S Team

Microprocessors B (17.384) Spring Lecture Outline

Microcontrollers. Principles and Applications. Ajit Pal +5 V 2K 8. 8 bit dip switch. P2 8 Reset switch Microcontroller AT89S52 100E +5 V. 2.

Microcontroller and Embedded Systems:

AN10210 Using the Philips 87LPC76x microcontroller as a remote control transmitter

Lecture 9. Timer Operations and Programming

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

Software Serial Port Implemented with the PCA

C Language Programming, Interrupts and Timer Hardware

Z8 Encore! XP F1680 Series 8-Bit Flash Solution with Extended Peripherals

EE4390 Microprocessors. Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System

Transcription:

Chapter 2 Overview of Architecture and Microcontroller-Resources

Lesson 4 Timers, Real Time Clock Interrupts and Watchdog Timer 2

Microcontroller-resources Port P1 Port P0 Port P2 PWM Timers Internal Program Memory ADC Port P3 RTC Timer- Counter Functions Synchronous SI WDT Internal Data Memory UART mode SI 3

Timer-Counter, overflow, interrupt and ISR 4

Timer-counter as counter A counter gets inputs from external events Inputs can be -ve edge transitions at a pin of an MCU Counts x increment on each count Reaches upper limit of all bits = 1s and then on next counts all bits = 0s. The counter is said to overflow 5

Timer-counter as Timer A timer is a counter getting constant interval periodic inputs from a clock source Counts x increment on each clockinput Timer timeouts (overflows) when on all bits becoming = 0s and x = 0. 6

n-bit timer-counter example Counter inputs clock inputs n-bit timercounter Clock Inputs period = 1 µs for 12 MHz XTAL (8051) External pin for events Timer overflow interrupt if not masked, an ISR executes Overflows after 2 n clock inputs if initial count bits all 0s. 7

ISR (interrupt service routine) ISR (interrupt service routine) is a program that runs on an interrupt, for example, on an timer-overflow interrupt Return to the interrupted program after finishing running of all the codes. 8

ISR on Timer overflow An interrupt can be masked(disabled) to unable the ISR from running. Usually by a bit in interrupt enable register control register or a control register. Timer-counter interrupt can also be masked. If not masked,a timer will overflow and interrupt after (2 n x) clock-inputs. 9

8-bit Timer-counter Let initial value in an 8-bit counter = 0.The 8- bit counter overflows (interrupts) after 2 8 = 256 counts or 256 edge transitions. Let initial value loaded in an 8-bit timer = x 0 The 8-bit timer overflows after (2 8 x) clock input or (256 x) edge transitions. If clock inputs are after every 1 µs, then timeout (interrupt) period = (256 -x 0 ) µs 10

Timer-Counter Registers Timer 16-bit register Timer control/ status Register Timer Mode Register Byte Byte Write/Read upper bits Write/Read lower bits Write/ Read bits 11

8051/8052 Timing/Counting Devices - T1 and T0 and T2 12

Pre-scaling Freerunning counter load reset Stop Autoreload reload Timer-Function options 13

A Reload of Counter on an input Count Inputs 16-bit counter Timer overflow interrupt if not masked, then an ISR executes An edge forcing coping of the into counter starting value from Load Register if capture enabled 16-bit Load Register Timer reload interrupt if not masked, then an ISR executes 14

Free Running Counter (FRC) No reset feasible, No stop feasible No initial value load feasible and thus no write to timer-counter register of FRC Auto reloads 0s on each successive overflows Used for real time control, as its reference is real, unchanged 15

Pre-scaling The clock inputs can be divided by certain factor so that the timer timeouts periods are slowed by that factor. The action is pre-scaling of the counts and factor is called pre-scaling factor. 16

Timer Input Capture feature 17

An Input Capture of Timer or FRC Clock Inputs (FRC) 16-bit counter 16-bit Capture Register Timer capture interrupt if not masked, then an ISR executes An edge forcing copying of the counter reading x into Capture Register if capture enabled 18

Advantage Lets an event-time be captured in a register. Enables finding pulse width pulse (event) frequency event-interval between the events 19

Timer out-compare feature 20

An Out-Compare in a Timer or FRC Clock Inputs (FRC) 16-bit counter 16-bit compare Register Timer outcompare interrupt if not masked, then an ISR executes Compare both registers, on equality force an output level 0 or 1 or toggle output if comparison enabled 21

Advantage Lets an output or sequences of outputs fire at a preset time (s) Lets at a preset time (s), an interrupt(s) occur to initiate an action(s) or initiate sequences of actions, using the ISR. 22

Real time clock interrupts and software timer interrupts 23

Real time clock interrupts using a Timer or FRC Clock Inputs 16-bit counter Pre-scaling to control real time clock time tick interval 4 ms or 8 ms (FRC) Real time clock interrupts if not masked at the beginning, the ISRs execute at periodic intervals 24

Advantage Lets the system periodically supervise and schedule the different processes Used for repeated calls to a task or program or calls to sequences of tasks or programs 25

Software Timer interrupts in a Timer or FRC Clock Inputs Pre-scaling 16-bit counter 16-bit compare Register (FRC) Equality check out-compare interrupts if not masked at the beginning, the ISRs execute a software at periodic intervals 26

Advantage Lets the system periodically supervise and schedule the different processes at pre-select times Used for repeated calls to a task or program or calls to sequences of tasks or programs at pre-select times 27

Watchdog timer 28

Watchdog Watchdog timer forces system reset to save from system stuck up state (hanging state) during running Timeout period can be set at the beginning Rewriting can be done to initiate next WDT cycle before a timeout to enable extension of the period by another cycle 29

Advantage Lets the system come out of hang or stuck up situation Lets the system recover to initial state after a watched period 30

Summary 31

We learnt Timing Devices Timer-counter, overflow and interrupt ISR Timer function - as counter Timer, reset, load, reload, autoreload, stop and start 32

We learnt Timing Devices Free running counter overflow and on interrupt an ISR run Input capture function Out compare function Real time clock interrupts and software timer interrupts 33

We learnt Timing devices System reset after a watched period using a watchdog timer 34