Distributed Real- Time Control Systems. Lecture 7 Real- Time Control
|
|
- Rose Anderson
- 5 years ago
- Views:
Transcription
1 Distributed Real- Time Control Systems Lecture 7 Real- Time Control 1
2 Real- Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronizeda/d- D/A operations. Depending on the computational (hardware/software architectures), there may be: Latencies (delays) that degrade the performance Variations in the sampling period, also called Jitter Clock A/D Control Algorithm D/A Process 2
3 Periodic Tasks Starting Times Latency Service Time Period 3
4 Computational Delay Loop wait for next sampling time y = read A/D e = ref y p = K1*ref Kp*y i = i_ant + K2*(e + e_ant) d = K3*d_ant K4*(y - y_ant) u = p+i+d y_ant = y i_ant = i d_ant = d e_ant = e write u to D/A u y time 4
5 Approximate Analysis of Delays A delay ΔT can be interpreted as an additional phase Δφ(ω) = ω ΔT. Controller Delay System C(s) e - st G(s) This reduces the controller phase margin PM by Δφ(ω c ), where ω c is the crossover frequency. Since the damping factor ξ is approximately given by ξ = PM/100, a delay reduces damping and increases overshoot in the step response. 5
6 Step Example : No Delay PID Zero-Order Zero-Order Hold1 Discrete Hold PID Controller Scope4 Transport Delay1 1 s 2+s Transfer Fcn Scope Kp = 3 Kd = 3 Td = 0.05 Ts = 0.2 output control 6
7 Step Example : Delay ½ T PID Zero-Order Zero-Order Hold1 Discrete Hold PID Controller Scope4 Transport Delay1 1 s 2+s Transfer Fcn Scope Kp = 3 Kd = 3 Td = 0.05 Ts = 0.2 output control 7
8 Influence of Delay: Output Increasing Delay Time [sec] Step response. 8
9 Step Example : Delay ½ T + PID Retune PID Zero-Order Zero-Order Hold1 Discrete Hold PID Controller Scope4 Transport Delay1 1 s 2+s Transfer Fcn Scope Kp = 2 Kd = 2 Td = 0.05 Ts = output control 9
10 Jitter Jitter = spurious variations of the pre- defined sampling time. 10
11 Causes of Jitter Non adequate use of temporal primitives. Variation in the length of the running code due to different branching The control algorithm may change as a function of its state and external events. Preemption of the controller by higher priority processes or threads. In multi- threaded applications, the scheduler may delay the control thread due to higher priority tasks. Preemption of the OS real- time clock (tick) due to higher priority interrupts. Execution of higher priority tasks and/or interrupts. Networking delays: In distributed systems, where the control computation, sensor sampling, and actuator drive are processed in different physical nodes. In this case, implementation delays also include communication delays that may change due to bus traffic or message loss. 11
12 Influence of Jitter 2.5 Effect of Jitter in Trajectory Generation output t 12
13 Minimize Computational delays Arrange code so that delay in feedback is minimized Loop wait for next sampling time y = read A/D e = ref y p = K1*ref Kp*y i = i_ant + K2*(e + e_ant) d = K3*d_ant K4*(y - y_ant) u = p+i+d y_ant = y i_ant = i d_ant = d e_ant = e write u to D/A Loop wait for next sampling time y = read A/D e = ref y p = K1*ref Kp*y i = i_ant + K2*(e + e_ant) d = K3*d_ant K4*(y - y_ant) u = p+i+d write u to D/A y_ant = y i_ant = i d_ant = d e_ant = e 13
14 Minimize Jitter Use real- time clocks. Avoid branching during control computation Minimize pre- emptions by higher priority interrupts (e.g external interrupts) 14
15 Arduino Timing Primitives delay(ms) - Pauses the program for the amount of time (in miliseconds) specified. Uses TIMER 0. Homework: what is the max delay? unsigned long millis() - Returns the number of milliseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days. Uses TIMER 0. micros() - Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes. Has a resolution of about 4 microseconds. Uses TIMER 0. delaymicroseconds(us) - Pauses the program for the amount of time (in microseconds) specified. The largest value that will produce an accurate delay is Performs accurately down to 3 microseconds. Does not use timers. 15
16 Control loop with timer polling unsigned long prevtime = 0; // milliseconds unsigned long sampinterval = 10; // milliseconds void setup() { / *whatever needed */} void loop() { unsigned long currenttime = millis(); if(currenttime - previoustime > sampinterval) { //... // perform the control operations here //... // save the previous time for next cycle previoustime = currenttime; } } WHAT ARE THE DISADVANTAGES OF THIS APPROACH? 16
17 Control loop with delay unsigned long prevtime = 0; // milliseconds unsigned long sampinterval = 10; // milliseconds void setup() { / *whatever needed */} void loop() { unsigned long starttime = millis(); //... // perform the control operations here //... } unsigned long endtime = millis(); delay(sampinterval (endtime starttime)); WHAT ARE THE DISADVANTAGES OF THIS APPROACH? 17
18 Real- Time Timers The ATMega has Three Hardware Timers/Counters Timer 0 (8 bit) Used for delay(), millis() and analogwrite() on pins 5 and 6. Timer 1 (16 bit) Used for analogwrite() on pins 9 and 10, and for the Servo library. Timer 2 (8 bit) Used for tone() and analogwrite() on pins 3 and
19 AVR Timer Hardware Diagram 19
20 Timer Overview Timers are counters that count pulses from a timebase. Using the timebase of the Arduino (16MHz) the resolution is 62.5 ns, but this can be configured by a pre- scaler. Timers can generate interrupts when they overflow or reach certain values. Timers can generate PWM signals with configurable frequency and duty cycle. Timer s operation is controlled via a set of registers. 20
21 Timer Registers (TCCRnA) Timer Counter Control Register A - Determines the operating mode (TCCRnB) Timer Counter Control Register B - Determines the prescale value (TCNTn) Timer Counter Register - Contains the timer count (OCRnA) Output Compare Register A - Interrupt can be triggered on this count (OCRnB) Output Compare Register B - Interrupt can be triggered on this count (TIMSKn) Timer/Counter Interrupt Mask Register - Sets the conditions for triggering an interrupt (TIFRn) Timer/Counter 0 Interrupt Flag Register - Indicates if the trigger condition has occurred n timer number 21
22 Timer Control Registers Timer Counter Control Register A Timer Counter Control Register B 22
23 Timer Resolution All timers are initialized for a pre- scale of 64 Setting CSx0:2 to 000 will stop counting 23
24 Modes of Operation 24
25 Changing Timer 1 frequency const byte mask= B ; // mask bits that are not prescale int prescale = 1; //fastest possible void setup() { TCCR1B = (TCCR1B & mask) prescale; } void loop() { analogwrite(9,128); //check waveform analogwrite(10,128); //with osciloscope } Warning: Changing frequency of Timer 0 will change the behaviour of delay() and millis()! 25
26 Timer Interrupt Registers Timer/Counter Interrupt Mask Register Timer/Counter 0 Interrupt Flag Register 26
27 Using Timer Interrupts TIMSKn Bits 0,1 and 2 enable Timer/Counter interrupts: BIT 0: Overflow BIT 1: Output Compare Match A BIT 2: Output Compare Match B. Interrupts will be generated when: BIT 0: a timer overflow occurs BIT 1: a Compare Match occurs between the Timer/Counter and the data in OCRnA Output Compare Register A. BIT 2: a Compare Match occurs between the Timer/Counter and the data in OCRnB Output Compare Register B. 27
28 ATMega 328 Interrupts 28
29 Control loop with interrupts Setting interrupt on Timer 1 at 1Hz. #include <avr/io.h> #include <avr/interrupt.h> void setup() { cli(); //stop interrupts TCCR1A = 0;// clear register TCCR1B = 0;// clear register TCNT1 = 0;//reset counter OCR1A = 15624; //must be <65536 // = (16*10^6) / (1*1024) 1 TCCR1B = (1 << WGM12); //CTC On // Set prescaler for 1024 TCCR1B = (1<<CS12) (1<<CS10); // enable timer compare interrupt TIMSK1 = (1 << OCIE1A); sei(); //allow interrupts } volatile bool flag; ISR(TIMER1_COMPA_vect){ //... //put here control operations // flag = 1; //notify main loop } void loop() { if(flag) { //post-interrupt operations flag = 0; } //other operations } 29
30 Guidelines for ISR s Enable global interrupts ISR s should be as fast as possible: Do not use delay() Do not call functions. Use direct register access if possible. Use flags to communicate with the main loop. Shared variables should be declared volatile. Shared data that cannot be accessed atomically needs to be protected by disabling interrupts during the access. Only byte- sized data can be accessed atomically. Anything larger than a byte needs to be protected. 30
Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control
Distributed Real-Time Control Systems Chapter 10 Real-Time Digital Control 1 Real-Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronized
More informationInterrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?
Interrupts Arduino, AVR, and deep dark programming secrets What is an Interrupt? A transfer of program control that is not directed by the programmer Like a phone call in the middle of a conversation Stop
More informationPhysics 120B: Lecture 11. Timers and Scheduled Interrupts
Physics 120B: Lecture 11 Timers and Scheduled Interrupts Timer Basics The ATMega 328 has three @mers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, on Arduino TIMER0 is an 8- bit
More informationTIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */
The codes below which help in better understanding of timers and counters. I have tested this code for atmega32. I have taken reference from www.avrfreaks.net. Hope you all will find this useful. Darsh
More informationLaboratory 4 Usage of timers
Laboratory 4 Usage of timers 1. Timer based interrupts Beside external interrupt, the MCU responds to internal ones which are triggered by external events (on the external pins). The source of the internal
More informationPhysics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts
Physics 124: Lecture 12 Timers and Scheduled Interrupts Timer Basics The Arduino Uno/Nano (ATMega 328) has three Hmers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, (as assembled)
More informationTopic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR
Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Introduction Timer s objective Timer features Timer Registers - Understand function of each bit Initialization Introduction o In micro-p, we use counter
More informationInterrupts and timers
Applied mechatronics, Lab project Interrupts and timers Sven Gestegård Robertz Department of Computer Science, Lund University 2018 Outline 1 Interrupts Interrupt types Execution of an interrupt Maskable
More informationUnit 14 Timers and Counters 14.1
Unit 14 Timers and Counters 14.1 14.2 Counter/Timers Overview ATmega328P has two and one counters. Can configure to count at some frequency up to some value (a.k.a. ), generate an and counkng again, if
More informationUnit 13 Timers and Counters
Unit 13 Timers and Counters 1 2 Review of some key concepts from the first half of the semester A BRIEF SUMMARY 3 A Few Big Ideas 1 Setting and clearing bits in a register tells the hardware what do and
More informationMarten van Dijk, Syed Kamran Haider
ECE3411 Fall 2015 Lecture 3b. Timers 0, 1 & 2 Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk, syed.haider@engr.uconn.edu Based
More informationADC: Analog to Digital Conversion
ECE3411 Fall 2015 Lecture 5b. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers
More informationSupplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA
S1 of S10 Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA Maria Bauer and Lawrence Kulinsky * 1. Program Code
More informationAVR Timers TIMER0. Based on:
AVR Timers TIMER0 Based on: http://maxembedded.wordpress.com/2011/06/24/avr-timers-timer0-2/ The basic concepts of AVR Timers. Let me summarize it: We have seen how timers are made up of registers, whose
More informationCSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2
CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2 Thursday, April 12, 2012 Instructions: You will have the full class period to complete this test. Make sure to show your work to ensure you receive partial
More informationX X X. VGA - Standard:
VG Pin 01 Pin 02 Pin 03 - Pin Pin 05 Pin 06 Pin 07 Pin 08 - Pin Pin 10 Pin 11 - Pin Pin 13 Pin 14 - Pin (female to V Monitor) P1 RED V P2 GRN V P3 BLU V P5 GND HSy P6 RED_RTN P7 GRN_RTN P8 BLU_RTN P10
More informationNewbie s Guide to AVR Timers
Newbie s Guide to AVR Timers Dean Camera November 5, 204 ********** Text Dean Camera, 203. All rights reserved. This document may be freely distributed without payment to the author, provided that it is
More informationSchool of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia
ECTE333 s schedule ECTE333 Lecture 9 -Timers School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia Week Lecture (2h) Tutorial (h) Lab (2h) L7: C programming
More informationNewbie's Guide to AVR Timers (C) Dean Camera, 2007
Newbie's Guide to AVR Timers (C) Dean Camera, 2007 At last! Yet another tutorial, this one covering a topic which is the main source of frustration to those new with AVRs; timers. What are they, and what
More informationUNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz IV
Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz IV There is 1 questions in this quiz. There are 15 pages in this quiz
More informationUNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz III
Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz III There are 5 questions in this quiz. There are 11 pages in this quiz
More informationRTC rtc(dst_on); U8GLIB_SH1106_128X64 u8g(u8g_i2c_opt_none U8G_I2C_OPT_DEV_0);
#include #include #include #include RTC rtc(dst_on); U8GLIB_SH1106_128X64 u8g(u8g_i2c_opt_none U8G_I2C_OPT_DEV_0); const int WIDTH=128; const int HEIGHT=35; const
More informationUNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz V
Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz V There are 3 questions in this quiz. There are 10 pages in this quiz
More informationonetesla Interrupter Firmware Guide General Overview
onetesla Interrupter Firmware Guide Contents: General overview (page 1) Code Walkthrough (page 2) How to program the interrupter (page 15) Compiling the code (page 16) The onetesla MIDI controller is based
More informationINTERRUPTS in microprocessor systems
INTERRUPTS in microprocessor systems Microcontroller Power Supply clock fx (Central Proccesor Unit) CPU Reset Hardware Interrupts system IRQ Internal address bus Internal data bus Internal control bus
More informationFundamental concept in computation Interrupt execution of a program to handle an event
Interrupts Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues
More informationAN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX. Yousef Ebrahimi Professor Ryan Robucci
AvrX https://github.com/kororos/avrx Yousef Ebrahimi Professor Ryan Robucci Introduction AvrX is a Real Time Multitasking Kernel written for the Atmel AVR series of micro controllers. The Kernel is written
More informationInterrupts & Interrupt Service Routines (ISRs)
ECE3411 Fall 2017 Lecture 2a. Interrupts & Interrupt Service Routines (ISRs) Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut Email: marten.van_dijk@uconn.edu Copied
More informationIntroduction to Embedded Systems
Introduction to Embedded Systems Edward A. Lee UC Berkeley EECS 149/249A Fall 2016 2008-2016: E. A. Lee, A. L. Sangiovanni-Vincentelli, S. A. Seshia. All rights reserved. Chapter 10: Input and Output,
More informationInterrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo
Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0
More informationMEDIS Module 2. Microcontroller based systems for controlling industrial processes. Chapter 4: Timer and interrupts. M. Seyfarth, Version 0.
MEDIS Module 2 Microcontroller based systems for controlling industrial processes Chapter 4: Timer and interrupts M. Seyfarth, Version 0.1 Steuerungstechnik 1: Speicherprogrammierbare Steuerungstechnik
More informationInterrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control
Interrupts and Time Real-Time Systems, Lecture 5 Martina Maggio 28 January 2016 Lund University, Department of Automatic Control Content [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts
More informationInterrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts
Content Interrupts and Time Real-Time Systems, Lecture 5 [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts Martina Maggio 25 January 2017 Lund University, Department of Automatic
More informationSoftware debouncing of buttons
Software debouncing of buttons snigelen February 5, 2015 1 Introduction Connecting a button as an input to a micro-controller is a relatively easy task, but there are some problems. The main problem is
More informationEmbedded Systems Design with the Atmel AVR Microcontroller Part II
Embedded Systems Design with the Atmel AVR Microcontroller Part II Synthesis Lectures on Digital Circuits and Systems Editor Mitchell A.Thornton, Southern Methodist University Embedded Systems Design
More information12.1. Unit 12. Exceptions & Interrupts
12.1 Unit 12 Exceptions & Interrupts 12.2 Disclaimer 1 This is just an introduction to the topic of interrupts. You are not meant to master these right now but just start to use them We will cover more
More information8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.
AVR134: Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time,
More informationIntroduction to Embedded Systems
Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems
More informationUNIVERSITY OF MANITOBA Midterm
UNIVERSITY OF MANITOBA Midterm Winter 2007 COMPUTER SCIENCE Real-time Systems Date: Thursday, 1st March 2007 Time: 16:00-17:15 Room: EITC E2-304, University of Manitoba (Time allowed: 65 Minutes) NOTE:
More informationMarten van Dijk Department of Electrical & Computer Engineering University of Connecticut
ECE3411 Fall 2016 Lecture 4b. Review Session Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut Email: marten.van_dijk@uconn.edu Copied from Lecture 4b, ECE3411 Fall
More informationMicroprocessors & Interfacing
Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032
More informationUse a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time.
Goal: In this project you will create an OS-driven multitasking device than can capture data at precise intervals, buffer the data to EEPROM, and send data over a serial interface to a computer, while
More informationMore Arduino Programming
Introductory Medical Device Prototyping Arduino Part 2, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota More Arduino Programming Digital I/O (Read/Write) Analog
More informationArduino Part 2. Introductory Medical Device Prototyping
Introductory Medical Device Prototyping Arduino Part 2, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota More Arduino Programming Digital I/O (Read/Write) Analog
More informationProgramming Timer1 as a Stopwatch
Basic Express Application Note Programming Timer1 as a Stopwatch What is Timer1? BasicX systems have a built-in timer called Timer1. This timer can be used for several functions, one of which is measuring
More informationCOMP2121: Microprocessors and Interfacing
Lecture 19: Interrupts II http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Overview AVR Interrupts Interrupt Vector Table System Reset Watchdog Timer Timer/Counter0 Interrupt Service
More informationEmbedded Systems and Software
Embedded Systems and Software Timers and Counters F-35 Lightning II Electro-optical Targeting System (EOTS Lecture 1, Slide-1 Timers and Counters Very important peripherals on microcontrollers ATtiny45
More informationIn Class Assignment 2
In Class Assignment 2 Name: UMBC ID: Academic Integrity Statement: "Integrity of scholarship is essential for an academic community. The University expects that students will honor this. By signing this,
More informationEmbedded Systems and Software
Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,
More informationAVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE
AVR 8-bit Microcontrollers AVR134: Real Time Clock (RTC) Using the Asynchronous Timer APPLICATION NOTE Features Real Time Clock with Very Low Power Consumption (10µA @ 3.3V) Very Low Cost Solution Adjustable
More informationProcessor and compiler dependent
Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues What can
More informationCN310 Microprocessor Systems Design
CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor
More informationAGH University of Science and Technology Cracow Department of Electronics
AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 01/07/14 1/12 1. Introduction
More informationCSCE374 Robotics Fall 2013 Notes on the irobot Create
CSCE374 Robotics Fall 2013 Notes on the irobot Create This document contains some details on how to use irobot Create robots. 1 Important Documents These notes are intended to help you get started, but
More informationMicroprocessors & Interfacing
Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts
More informationThe 8051 microcontroller has two 16-bit timers/counters called T0 and T1.
Counters and Timers: The 8051 microcontroller has two 16-bit timers/counters called T0 and T1. As their names suggest, timer counts internal clock pulse i.e. machine cycle to provide delay. Counter counts
More informationInterrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1
Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR
More informationArduino. (Digital-to-Analog Converter D/A D2A) (Digital to Analog Conversion) 3. (Analog to Digital conversion)
Arduino 1. 2. (Digital to Analog Conversion) 3. (Analog to Digital conversion) 1 2 Analog to Digital Converter (ADC) (Digital-to-Analog Converter D/A D2A) Digital to Analog Converter (DAC) 3 4 DAC Binary
More informationThe Atmel ATmega328P Microcontroller
Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory 1 Introduction The Atmel ATmega328P Microcontroller by Allan G. Weber This document is a short introduction
More informationINTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab
INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄.
More informationATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi
1 P a g e ATmega Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming in Assembly
More informationTurbidostat Hardware and Software Design
Turbidostat Hardware and Software Design MS 4 By: Peter Harker Maxwell Holloway Evan Dreveskracht Table of Contents 1. Introduction... 3 2. Hardware 2.1 Scanner Assembly Design... 3 2.2 Circuit Boards...
More informationCENG-336 Introduction to Embedded Systems Development. Timers
CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency
More informationChapter 6 PROGRAMMING THE TIMERS
Chapter 6 PROGRAMMING THE TIMERS Lesson 3 Real Time Clocked Interrupts and Software Timers 2 Real Time Clock Interrupt 3 Real Time interrupts Prescaling Pre-scaling by RT1-RT0 bits for 4 or 8 or 16 2 13
More informationleos little embedded Operating System User's guide Written by Leonardo Miliani
leos little embedded Operating System User's guide Written by Leonardo Miliani www.leonardomiliani.com (Ɔ) Copyleft 2012-2013 Index: 1. What's leos? 2. How to use leos methods 3. 32-/64-bit math 4. How
More informationIntroduction. Unit 4. Numbers in Other Bases in C/C++ BIT FIDDLING. Microcontrollers (Arduino) Overview Digital I/O
4.1 4.2 Introduction Unit 4 Microcontrollers () Overview Digital I/O The primary way that software controls hardware is by manipulating individual bits We need to learn how to: Set a bit to a 1 Clear a
More informationThe Atmel ATmega168A Microcontroller
Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory The Atmel ATmega168A Microcontroller by Allan G. Weber 1 Introduction The Atmel ATmega168A is one member of
More informationFINAL EXAM. last name first name
55:036 Embedded Systems and Systems Software Spring, 2011 FINAL EXAM last name first name Notes: This is an open-book, open-notes exam Be sure to write legibly and clearly mark your answers Show your work
More informationEmbedded Real-Time Systems
Embedded Real-Time Systems Reinhard von Hanxleden Christian-Albrechts-Universität zu Kiel Copyright 2008-11, Slides kindly provided by Edward A. Lee & Sanjit Seshia, UC Berkeley, All rights reserved Lecture
More informationThe MC9S12 Timer Input Capture Function
The MC9S12 Timer Input Capture Function o Capturing the time of an external event o The MC9S12 Input Capture Function o Registers used to enable the Input Capture Function o Using the MC9S12 Input Capture
More informationEE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts
EE4800-03 Embedded Systems Design Lessons 7-10 - Exceptions - Resets and Interrupts 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions Resets
More informationEmbedded Systems. October 2, 2017
15-348 Embedded Systems October 2, 2017 Announcements Read pages 267 275 The Plan! Timers and Counter Interrupts A little review of timers How do we keep track of seconds using a timer? We have several
More informationCprE 288 Introduction to Embedded Systems (Timers/Input Capture) Instructors: Dr. Phillip Jones
CprE 288 Introduction to Embedded Systems (Timers/Input Capture) Instructors: Dr. Phillip Jones 1 Announcements HW 4, Due Wed 6/13 Quiz 5 (15 min): Wed 6/13, Textbook reading: Section 9.1, 9.2 (your one-side
More informationAGH University of Science and Technology Cracow Department of Electronics
AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 25/05/16 1/11 1. Introduction
More informationThe short program to blink the red LED used the delay() function. This is very handy function for introducing a short time delays into programs.
Timing The short program to blink the red LED used the delay() function. This is very handy function for introducing a short time delays into programs. It helps buffer the differing time scales of humans
More informationChapter 2. Overview of Architecture and Microcontroller-Resources
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
More informationUNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Lab Test III
Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Lab Test III There are 2 longer programming problems in this test. There
More informationDepartment of EIE / Pondicherry Engineering College. Timer/Counters. Department of EIE / Pondicherry Engineering College 1
Timer/Counters Department of EIE / Pondicherry Engineering College 1 The 8051 has two internal sixteen bit hardware Timer/Counters. Each Timer/Counter can be configured in various modes, typically based
More informationMICROPROCESSOR TECHNOLOGY
MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 14 Ch.6 The 80186, 80188, and 80286 Microprocessors 21-Apr-15 1 Timers The 80186/80188 contain three fully programmable 16-bit timers
More informationNewbie s Guide to AVR Interrupts
Newbie s Guide to AVR Interrupts Dean Camera March 15, 2015 ********** Text Dean Camera, 2013. All rights reserved. This document may be freely distributed without payment to the author, provided that
More informationThe MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function
The MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function o Registers used to enable the output compare function o Using the MC9S12
More informationCapturing the Time of an External Event Input Capture Subsystem
Capturing the Time of an External Event Input Capture Subsystem One way to determine the time of an external event is to wait for the event to occur, the read the TCNT register: For example, to determine
More informationInput and Output. Arijit Mondal. Dept. of Computer Science & Engineering Indian Institute of Technology Patna
IIT Patna 1 Input and Output Arijit Mondal Dept. of Computer Science & Engineering Indian Institute of Technology Patna arijit@iitp.ac.in Things to consider IIT Patna 2 Mechanical and electrical properties
More informationI/O Systems (3): Clocks and Timers. CSE 2431: Introduction to Operating Systems
I/O Systems (3): Clocks and Timers CSE 2431: Introduction to Operating Systems 1 Outline Clock Hardware Clock Software Soft Timers 2 Two Types of Clocks Simple clock: tied to the 110- or 220-volt power
More informationTimers and Interrupts. Mark Neil - Microprocessor Course
Timers and Interrupts 1 Example Product: Signal Generator A Signal Generator should be programmable. A user can use the the LCD display and the keyboard to change the: Frequency scale Amplitude scale Offset
More informationPC Interrupt Structure and 8259 DMA Controllers
ELEC 379 : DESIGN OF DIGITAL AND MICROCOMPUTER SYSTEMS 1998/99 WINTER SESSION, TERM 2 PC Interrupt Structure and 8259 DMA Controllers This lecture covers the use of interrupts and the vectored interrupt
More informatione-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text
e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text 1. Interrupt An interrupt is the occurrence of a condition--an event --
More informationL A M P I R A N UNIVERSITAS KRISTEN MARANTHA
L A M P I R A N LAMPIRAN B LISTING PROGRAM MIKROKONTROLER //Simplest universal VGA(20x20)/PAL(38x20) terminal //For sync used Timer0 Timer1 //To avoid flickering while receive UART data,recommend
More information8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32x8GeneralPurposeWorkingRegisters Up to 10
More informationInterrupts, timers and counters
Interrupts, timers and counters Posted on May 10, 2008, by Ibrahim KAMAL, in Micro-controllers, tagged Most microcontrollers come with a set of ADD-ONs called peripherals, to enhance the functioning of
More informationSquareWear Programming Reference 1.0 Oct 10, 2012
Content: 1. Overview 2. Basic Data Types 3. Pin Functions 4. main() and initsquarewear() 5. Digital Input/Output 6. Analog Input/PWM Output 7. Timing, Delay, Reset, and Sleep 8. USB Serial Functions 9.
More informationInterrupts. How can we synchronize with a peripheral? Polling
Interrupts How can we synchronize with a peripheral? Polling run a program loop continually checking status of the peripheral wait for it to be ready for us to communicate with it Then handle I/O with
More information8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.
: Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time, Date,
More informationDigital and Analogue Project Report
EITF 040 Digital and Analogue Project Report Group 6 Fida Saidani Qinghua Liu March, 2013 1 Abstract The aim of this project is to build an electronic device that makes use of the law of light reflection,
More informationSignature: 1. (10 points) Basic Microcontroller Concepts
EE 109 Practice Final Exam Last name: First name: Signature: The practice final is one hour, ten minutes long, closed book, closed notes, calculators allowed. To receive full credit on a question show
More informationEE4390 Microprocessors
EE4390 Microprocessors Lessons 23, 24 - Exceptions - Resets and Interrupts Revised: Aug 1, 2003 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions
More informationCarl Peto. 10th August 2017 SWIFT FOR ARDUINO
Carl Peto 10th August 2017 SWIFT FOR ARDUINO ARDUINO Microcontrollers are a small, cheap, multi purpose IoT computer in a box, with built in interfaces in the package, all in one chip. They can be bought
More informationUBC104 Embedded Systems. Review: Introduction to Microcontrollers
UBC104 Embedded Systems Review: Introduction to Microcontrollers Processors General purpose processors: 80386 Pentium Core Duo Large number of pins External memory External peripherals * Figure from Intel
More informationInterrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.
Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM
More information