Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Size: px
Start display at page:

Download "Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR"

Transcription

1 Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

2 Introduction Timer s objective Timer features Timer Registers - Understand function of each bit Initialization

3 Introduction o In micro-p, we use counter registers in order to count an event or generate time delays. o To count an event: connect the external event source to the clock pin of the register. When an event occurs externally, the content of the counter is incremented. o To generate time delays: connect the oscillator to the clock pin of counter. When oscillator ticks, the content of the counter is incremented. o The contents of counter register represents how may ticks have occurred from the time we have cleared the counter.

4 Introduction o Thus, to generate time delay (1 st method): need to clear the counter at the start time and wait until the counter reaches a certain number. o Example: A micro-p speed is 1MHz, and the content of the counter register increments one per microsecond. Thus, if we want a time delay of 100μs, we should clear the counter and wait until it become 100. o In micro-p, there is a flag for each of the counters. o The flag is set when counter overflows. o to generate time delay (2 nd method): load the counter register and wait until the counter overflow and the flag is set. o Example: A micro-p speed is 1MHz, with an 8-bit counter register, if we want a time delay of 3μs, load the counter register with $FD and wait until the flag is set after 3 ticks. First tick content increment to $FE. Second tick - content increment to $FF. Third tick it overflows (contents become $00) and the flag is set.

5 Introduction o Every timer needs a clock pulse to tick. The clock source can be internal or external: o Internal clock source the frequency of oscillator is fed into the timer as time delay generation. o External clock source fee pulses through one of the AVRs pins as a counter. o In ATmega32, there are three timer: o Timer0: 8-bit o Timer1: 16-bit o Timer2: 8-bit o These timers can be used as: o Timers to generate time delay. o Counters to count events happening outside the micro-p.

6 Programming Timers 0,1 and 2

7 Introduction o Every timer needs a clock pulse to tick. The clock source can be internal or external: o Internal clock source the frequency of oscillator is fed into the timer as time delay generation. o External clock source fee pulses through one of the AVRs pins as a counter. o In ATmega32, there are three timer: o Timer0: 8-bit (short count/time limit) o Timer1: 16-bit (long count/time limit) o Timer2: 8-bit (short count/time limit) o These timers can be used as: o Timers to generate time delay. o Counters to count events happening outside the micro-p.

8 Basic Registers of Timers o In ATmega32, a total of five basic registers that are associated with timers. o TCNTn (timer/counter) register. o TOVn (Timer overflow) flag. o TCCRn (timer/counter control) register. o OCRn (Output compare) register. o OCFn (output compare) flag o The TCNTn register is actually a counter. o Upon reset, TCNTn contains zero. o Its counts up with each pulse. o The contents of timers/counters can be accessed by loading a value to TCNTn or read its value.

9 Basic Registers of Timers o The TOVn flag will be set (1), whenever the timer overflows. o The TCCRn register is used for setting modes operation. o E.g. we can specify Timer0 to work as a timer or a counter by loading proper value into TCRR0. o The OCRn register is used to compare the content of OCRn with the content of TCNTn. o When OCRn=TCNTn, the OCFn will be set (1). o These timer registers are located in the I/O memory. Thus, we can read or write using IN / OUT instructions.

10 Timer0 Programming Important key to timer0 usage: - Understand timer0 register bit function

11 TCNT0 Register o Timer0 is 8-bit in ATmega32, thus TCNT0 is 8-bit wide also. o TCNT0 is used as a counter for Timer0 to hold timer start value in producing the required timer delay time for AVR application.

12 TCCR0 Register o TCCR0 is an 8-bit register used for control of Timer0.

13 TCCR0 Registers o CS02:CS00 (Timer0 clock source). o These bits are used to choose the clock source. o If CS02:CS00 = 000, the counter is stopped. o If CS02:CS00 have value between 001 and 101, the oscillator is used as a clock source and the Timer0 could acts as a timer used as time delay generation. o If CS02:CS00 are 110 or 111, the external source clock is used and acts as a counter. o WGM01:WGM00 o These bits are use to determine the Timer0 modes: normal, phase correct PWM, CTC and fast PWM.

14 TCCR0 Registers: Examples

15 TIFR Registers o The TIFR (Timer/counter Interrupt Flag register) register contains the flag of different timer. o TOV0 (Timer0 Overflow). o The flag is set when counter overflows. i.e. going from $FF to $00. o When time rolls over from $FF to $00, TOV0 flag is set to 1 and it remains set until the software clears it.

16 Normal Mode o In Normal Mode the content of the timer/counter increments with each clock. o It will counts up until it reaches its max of $FF. o When it rolls over from $FF to $00, it sets high TOV0.

17 Steps to Program Timer0 in Normal Mode 1. Load TCNT0 register with the initial count value. 2. Load the value into TCCR0 register, determine which mode to be used and the prescale option. 3. Monitor TOV0 to see if it raised. Get out from loop when TOV0 is high. 4. Stop timer by disconnecting the clock source, using following instructions: TCCR0 = 0x00 ;// timer stopped, normal mode 5. Clear TOV0 for the next round. 6. Go back to step 1 to load TCNT0 again.

18 Algorithm to program Timer Operation in normal mode Set Starting count in TCNTx Start Timer which by setting prescaler Wait for TOVx bit (overflow bit) is set (while TCNTx counts up in background). Stop Timer When TOVx bit is set, Clear TOVxbit by writing 1 to TOVx bit.

19 The code in C/C++ Language The function name is Delay250msUsingTimer0 void Delay250msUsingTimer0(void) { // Refer Section A.3(k) TCNT0 = ; //start TCNT0 with ( ) i.e. 12 TCCR0 = (1<<CS02) (1<<CS00); //Set Prescaler =1024 volatile uint8_t TIFRdata; do //Wait { TIFRdata=TIFR&(1<<TOV0); //Read status of TOV0 bit in TIFR } } while (TIFRdata==0); //until TOV0==1 TCCR0= 0x00; // Stop Timer0 TIFR=TIFR TIFRdata; //Clear TOV0 bit;

20 The code in C/C++ Language Calculation of TCNT0? CPU Frequency= Hz Prescaler = 1024 Required delay time= 250ms Timer0 count = (Delay time/ Timer Period = Delay time/ (1 / (CPU_frequency/1024)) = (250 x10-3 / (1/ ( /1024)) = 12 (round-up) TCNT0 = = 12

21 Steps to Program Timer0 in Normal Mode #define F_CPU #include <avr/io.h> void delay_t0(ungsigned char delayms)) void delay_timer0 (unsigned char delayms) { unsigned char TIFRdata; unsigned char delaycount ; delay count=round ((delayms/((1000/f_cpu)*1024))-1) TCNT0 = 255-delaycount ; // // TIMER0, Normal mode, int clk, prescale 1024,start TCCR0 = 0x01 ; do TiFRdata =TIFR ; while (TiFRdata==0) { TCCR0 = 0x00;// Stop Timer; TIFR = TIFR TIFRdata ; // clear TOVO } } Int main() { // PORTB.5 as output DDRB=DDRB 1 << PB5 ; // clear PORTB.5 PORTB= 0b ; while (1) { delay_timer0(250) ;//delay // toggle PORTB.5 PORTB= PORTB ^ (1<<PC5) ; } return 1 ; }

22 Steps to Program Timer0 in Normal Mode

23 Steps to Program Timer0 in Normal Mode

24 Calculate Timer0 StartValue

25 Finding Values to be Loaded in The Timer o Assuming the amount of timer delay needed is known. Find the values needed for the TCNT0 register. o The following steps can be used to calculate the values to be loaded into TCNT0:

26 Finding Values to be Loaded in The Timer void delaymsusingtimer0(void) { TCNT0 = ; //start TCNT0 with (256-50) i.e. 200 TCCR0 = (1<<CS00); //No prescaler volatile uint8_t TIFRdata; do //Wait { TIFRdata=TIFR&(1<<TOV0); //Read status of TOV0 bit in TIFR } while (TIFRdata==0); //until TOV0==1 TCCR0= 0x00; // Stop Timer0 TIFR=TIFR TIFRdata; //Clear TOV0 bit; }

27 Prescaler and Generating a Large Time Delay o Previously, the size of time delays depends on two factors: a) The crystal frequency b) The timer s 8-bit register o In which, the largest time delay only achieved by making TCNT0 zero. What if that is not enough? o Answer: use the prescaler option in TCCR0 to increase the delay by reducing the period. o The prescaler option allows us to divide the instruction clock by factor of 8 to (see Figure 9-5)

28 Prescaler and Generating a Large Time Delay o Previously, with no prescaler enabled, the crystal oscillator freqequency is directly fed into Timer0. o If prescaler bit is enable, we can divide the clock before it is fed into Timer0. o The lower 3 bits of TCCR0 give the options of the number we can divide by. i.e. 8, 64, 256 and 1024.

29 Prescaler and Generating a Large Time Delay

30 Prescaler and Generating a Large Time Delay

31 Prescaler and Generating a Large Time Delay

32 Prescaler and Generating a Large Time Delay #include <avr/io.h> void delay_timer0 () { unsigned char TIFRdata; TCNT0 = 0x83 ; // // TIMER0, Normal mode, int clk // prescale 256,start TCCR0 = 0x04 ; do TIFRdata=TIFR; while (TIFRdata == 1<<TOV0); TCCR0 = 0x0 ; // Stop TIMER0 // clear TOVO TIFR = TIFR TiFRdata ; } int main() { DDRB=DDRB 1 << PB3 ;// PB3 as output PORTB= 0b ;// clear PORTB while (1) { PORTB= PORTB ^ (1<<PC5) ;// toggle delay_timer0; } return 1 ; }

33 Clear Timer0 on Compare Match (CTC) Mode o The OCR0 register is used with CTC mode. o As in the Normal mode, in the CTC mode, the timer is incremented with a clock. o But it counts up until the content of TNCT0 = OCR0 (compare match occurs); then the timer will be cleared and OCF0 flag will be set. o This OCF0 flag is located in the TIFR register.

34 Clear Timer0 on Compare Match (CTC) Mode #include <avr/io.h> void delay_t0 () { unsigned char TIFRdata; TCNT0 = 0x00 ; // OCR0 =0x09; // load OCR0 // TIMER0, CTC mode, int clk //prescale 256,start TCCR0 = 0x09 ; do ( TIFRdata=TIFR; } while (TIFRdata!= 1<<OCF0) ; TCCR0 = 0x0 ;// Stop TIMER0 // clear TOVO TIFR = TIFR TIFRdata; } Int main() { DDRB=DDRB 1 << PB3 ;// PB3 as output PORTB= 0b ;// clear PORTB while (1) { PORTB= PORTB ^ (1<<PC5) ;// toggle delay_t0; } return 1 ; }

35 Clear Timer0 on Compare Match (CTC) Mode

36 Clear Timer0 on Compare Match (CTC) Mode

37 Timer2 Programming

38 Timer2 Programming o Timer2 is an 8-bit in ATmega32, therefore it works same way as Timer0. o But there are two differences between Timer0 and Timer2: o Timer2 can be used as a real time counter. o In Timer2 more prescale option can be found.

39 Timer1 Programming

40 Timer1 Programming o Timer1 is an 16-bit timer and has lots of capabilities. o Since Timer1 is a 16-bit timer its could split into two bytes: o TCNT1L Timer1 Lower Byte. o TCNT1H Timer1 High byte o Timer1 has two control registers, TCCR1A and TCCR1B. o TOV1 flag goes HIGH when overflow occurs. o Timer1 has prescaler option of 1:1, 1:8, 1:64, 1:256 and 1:1024

41 Timer1 Programming o There are two OCR register in Timer1: OCR1A and OCR1B o Whenever TNCT1 = OCR1A, OCF1A will goes HIGH. o Whenever TNCT1 = OCR1B, OCF1B will goes HIGH.

42 TIFR Register o The TIFR register that associated with TImer1 are: TOV1, OCF1A and OCF1B flags.

43 COM1A1 COM1B1 COM1B0 FOC1A FOC1B WGM11 TCCR1A & TCCR1B Register COM1A0 WGM10 TCCR1A ICNC1 ICES1 - WGM13 WGM12 CS12 CS11 CS10 TCCR1B Clock Selector (CS) Comment No clock source (Timer/Counter stopped) PSR clk (No Prescaling) clk / 8 Clear clk IO clk / clk / clk / External clock source on T0 pin. Clock on falling edge External clock source on T0 pin. Clock on rising edge CS12 CS11 CS10 clk/8 10-bit T/C Prescaler clk/64 clk/256 clk/1024 T1 CS10 CS11 CS Timer/Counter1 clock source

44 Timer1: Normal Mode o Normal Mode (WGM13:10= 0000). o In Normal mode, the timer counts up until it reaches $FFFF (max) and then it rolls over from $FFFF to $0000. o When rollover, TOV1 flag will be set.

45 o CTC Mode (WGM13:10= 0100). Timer1: CTC Mode o In CTC mode, the timer counts up until the content of the TCNT1 = OCR1A (compare match occurs), then timer will be cleared when the next clock occurs. o OCF1A flag will be set.

46 Timer1: Example1

47 Timer1: Example1

48 Timer1: Example2

49 Timer1: Example2

50 Timer1: Generating Large Time Delay Using Presacaler o Again, The size of time delays depends on two factors: a) The crystal frequency b) The timer s 16-bit register o Use the prescaler option in TCCR1B to increase the delay by reducing the period. o The prescaler option allows us to divide the instruction clock by factor of 8, 64, 256 and 1024.

51 Counter

52 Introduction o The AVR timer can also be used to count, detect and measure the time events happening outside the AVR. o When the timer is used as a timer, the AVR s crystal is used as the source of the frequency. o When the timer is used as a counter, the pulse outside the AVR that increment the TCNTn. o In Counter mode, registers such TCCR, OCR and TCNT are the same as for timer discussed previously.

53 CS02:00 bits in TCCR0 o Recall back the CS02:00 in the TCCRn register decide the source of the clock and prescale used. o When CS02:00 is between 001 and 101, timer get pulse from the crystal oscillator. o When CS02:00 is between 110 and 111, timer is used as counter and get pulses from source outside AVR chip. o When CS02:00 is 110 or 111: TCNT0 counter counts up as pulses fed from pin T0 (Timer/counter 0 External Clock Input).

54 CS02:00 bits in TCCR0 o In ATmega32, T0 is alternative function of PORTB.0 o When CS02:00 is 110 or 111: pin T0 provides the clock pulse and counter counts up after each clock pulse coming from T0 pin. o Similarly, for Timer1, when CS12:10 is 110 or 111: the clock pulse coming in from pin T1 (PORTB.1) makes TCNT1 counter count up. o when CS12:10 is 110: the counter count up on negative (falling) edge. o when CS12:10 is 111: the counter count up on positive (rising) edge.

55 Counter: Example

EE 308: Microcontrollers

EE 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 information

Unit 14 Timers and Counters 14.1

Unit 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 information

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */

TIMSK=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 information

Physics 120B: Lecture 11. Timers and Scheduled Interrupts

Physics 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 information

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts

Physics 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 information

AVR Timers TIMER0. Based on:

AVR 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 information

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia

School 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 information

Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control

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 information

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control Distributed Real- Time Control Systems Lecture 7 Real- Time Control 1 Real- Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronizeda/d-

More information

Embedded Systems and Software

Embedded 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 information

Embedded Systems Design with the Atmel AVR Microcontroller Part II

Embedded 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 information

Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA

Supplementary 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 information

Marten van Dijk, Syed Kamran Haider

Marten 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 information

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

INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄.

More information

Newbie s Guide to AVR Timers

Newbie 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 information

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?

Interrupts 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 information

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Objectives To become familiar with interrupts on the AVR Maskable and non-maskable Initialization Triggers To develop interrupt service routines

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313

8-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 information

Microprocessors & Interfacing

Microprocessors & 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 information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz IV

UNIVERSITY 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 information

UNIVERSITY OF MANITOBA Midterm

UNIVERSITY 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 information

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

8-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 information

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo

Interrupts (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 information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz V

UNIVERSITY 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 information

8-bit Microcontroller with 1K Byte Flash. ATtiny15L

8-bit Microcontroller with 1K Byte Flash. ATtiny15L Features High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

Laboratory 4 Usage of timers

Laboratory 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 information

Newbie's Guide to AVR Timers (C) Dean Camera, 2007

Newbie'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 information

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) (Revision-10) FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) PART-A (Maximum marks : 10) I. Answer all

More information

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

ADC: Analog to Digital Conversion

ADC: 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 information

Programming Timer1 as a Stopwatch

Programming 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 information

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

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up

More information

Use a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time.

Use 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 information

Software debouncing of buttons

Software 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 information

COMP2121: Microprocessors and Interfacing

COMP2121: 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 information

// filename pwm.c // ATtiny84 (14 pin DIP)

// filename pwm.c // ATtiny84 (14 pin DIP) // stepper motor driver for spectrometer // with manual speed and direction input // and adjustable scan speed and direction // stepper motor driver set to 32usteps/step (32Hz clk = 1 step/sec) // filename

More information

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up

More information

Unit 13 Timers and Counters

Unit 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 information

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2

CSCE 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 information

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

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers 8051 Peripherals On-Chip Memory Timers Serial Port Interrupts Computer Engineering 2 2-1 8051 Timers 8051 Timers The 8051 has 2 internal 16-bit timers named Timer 0 and Timer 1 Each timer is a 16-bit counter

More information

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & 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 information

onetesla Interrupter Firmware Guide General Overview

onetesla 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 information

Interrupts and timers

Interrupts 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 information

The Atmel ATmega328P Microcontroller

The 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 information

The Atmel ATmega168A Microcontroller

The 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 information

timer 1 Fri Oct 13 13:00:

timer 1 Fri Oct 13 13:00: timer 1 Fri Oct 1 1:00: 1.1 Introduction SECTION CAPTURE/COMPARE TIMER This section describes the operation of the 1-bit capture/compare timer. Figure -1 shows the structure of the timer module. Figure

More information

INTERRUPTS in microprocessor systems

INTERRUPTS 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 information

Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut

Marten 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 information

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

8-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 information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features. Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

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

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly. More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems

More information

MCU: Interrupts and Timers. Ganesh Pitchiah

MCU: Interrupts and Timers. Ganesh Pitchiah MCU: Interrupts and Timers Ganesh Pitchiah What s an MCU? Frequency = 8 MHz Time Period = 1/f = 0.125 us Code for Switching LED int a; voltage while(1) { a = PINA.0; input) If (a==1) PORTA.1=1; else PORTA.1=0;

More information

Introduction to Embedded Systems

Introduction 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 information

EE 308 Spring A software delay

EE 308 Spring A software delay A software delay To enter a software delay, put in a nested loop, just like in assembly. Write a function delay(num) which will delay for num milliseconds void delay(unsigned int num) volatile unsigned

More information

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8. Features High-performance and Low-power AVR 8-bit RISC Architecture 118 Powerful Instructions Most Single Cycle Execution 32 x 8 General Purpose Working Registers Up to 8 MIPS Throughput at 8 MHz Data

More information

The University of Texas at Arlington Lecture 21_Review

The University of Texas at Arlington Lecture 21_Review The University of Texas at Arlington Lecture 21_Review CSE 5442/3442 Agenda Tuesday December 1st Hand back Homework 7,8 and 9. Go over questions and answers Exam 3 Review Note: There will be a take home

More information

CENG-336 Introduction to Embedded Systems Development. Timers

CENG-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 information

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX. Yousef Ebrahimi Professor Ryan Robucci

AN 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 information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz III

UNIVERSITY 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 information

Fundamental concept in computation Interrupt execution of a program to handle an event

Fundamental 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 information

X X X. VGA - Standard:

X 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 information

Capstone Design Course. Lecture-2: The Timer

Capstone Design Course. Lecture-2: The Timer Capstone Design Course Lecture-2: The Timer By Syed Masud Mahmud, Ph.D. Copyright 2002 by Syed Masud Mahmud 1 The Timer The 68HC11 has a 16-Bit Free Running Timer. The count value of the timer is available

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Lesson-3: Counters and Timers

Lesson-3: Counters and Timers 8051 AND ADVANCED PROCESSOR ARCHITECTURES Lesson-3: Counters and Timers 1 Timing and counting devices Two T0 and T1 in classic 8051 family and three T0, T1 and T2 in 8052 family (an extension of 8051).

More information

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

AVR134: 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 information

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 89 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to

More information

Interrupts, timers and counters

Interrupts, 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 information

Lecture-55 System Interface:

Lecture-55 System Interface: Lecture-55 System Interface: To interface 8253 with 8085A processor, CS signal is to be generated. Whenever CS =0, chip is selected and depending upon A 1 and A 0 one of the internal registers is selected

More information

The 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 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 information

Capturing the Time of an External Event Input Capture Subsystem

Capturing 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 information

EE 3170 Microcontroller Applications

EE 3170 Microcontroller Applications Block Diagram of 68HC11A8 EE 3170 Microcontroller Applications Lecture 14: Advanced 68HC11 Hardware- PartI A: Measuring Real-Time in the 68HC11 - Miller 7.7-7.8 Based on slides for ECE3170 by Profs. Davis,

More information

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L Features High-performance, Low-power AVR 8-bit Microcontroller RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation

More information

Timers and Interrupts. Mark Neil - Microprocessor Course

Timers 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 information

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L. Preliminary. Features

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L. Preliminary. Features Features High-performance, Low-power AVR 8-bit Microcontroller RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation

More information

Microprocessor Fundamentals. Topic 7 Timing: the Timer/Counter

Microprocessor Fundamentals. Topic 7 Timing: the Timer/Counter Microprocessor Fundamentals Topic 7 Timing: the Timer/Counter Objectives Examine the Timer/Counter Register: TCNT0 Examine the Timer/Counter Control Register: TCCR0 Write a time delay for the previous

More information

CN310 Microprocessor Systems Design

CN310 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 information

Introduction to Embedded Systems

Introduction 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 information

Introduction. Unit 4. Numbers in Other Bases in C/C++ BIT FIDDLING. Microcontrollers (Arduino) Overview Digital I/O

Introduction. 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 information

MEDIS 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. 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 information

7KLVSDJHDQGDOOOLQNHGGR XPHQWVKDYHEHHQZULWWHQE\/HLWQHU+DUDOG

7KLVSDJHDQGDOOOLQNHGGR XPHQWVKDYHEHHQZULWWHQE\/HLWQHU+DUDOG $SSOL DWLRQ1RWHV 7KLVSDJHDQGDOOOLQNHGGR XPHQWVKDYHEHHQZULWWHQE\/HLWQHU+DUDOG 7KH UHDWLRQRIPDNHILOHV 0DNHILOHVSURYLGHWKHSRVVLELOLW\RIWUDQVODWLQJRZQSURJUDPVHIIL LHQWO\ +HUH,GHV ULEHKRZ\RXKDYHWRDOWHUWKHPDNHILOHVIRU\RXURZQSURJUDPV

More information

Timer programming

Timer programming 5.8051 Timer programming In this tutorial, we are going to discuss the Timer module of 8051. First, we will see what are timers, their working and later we will configure the 8051 timers to generate the

More information

EE 308 Spring Exam 1 Feb. 27

EE 308 Spring Exam 1 Feb. 27 Exam 1 Feb. 27 You will be able to use all of the Motorola data manuals on the exam. No calculators will be allowed for the exam. Numbers Decimal to Hex (signed and unsigned) Hex to Decimal (signed and

More information

HC12 Built-In Hardware

HC12 Built-In Hardware HC12 Built-In Hardware The HC12 has a number of useful pieces of hardware built into the chip. Different versions of the HC12 have slightly different pieces of hardware. We are using the MC68HC912B32 chip

More information

Atmel AVR Timers and Interrupts

Atmel AVR Timers and Interrupts 1 P a g e Atmel AVR Timers and 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

More information

Using Input Capture on the 9S12

Using Input Capture on the 9S12 The 9S12 Input Capture Function Huang Sections 8.1-8.5 ECT_16B8C Block User Guide o Interrupts on the 9S12 o Capturing the time of an external event o The 9S12 Input Capture Function o Registers used to

More information

Menu. XMEGA 16-bit Timer/Counter Type 0 and Type 1 EEL 3744 EEL 3744

Menu. XMEGA 16-bit Timer/Counter Type 0 and Type 1 EEL 3744 EEL 3744 Menu Main Timer System for > XMEGA Timer System > 68HC11/12 Real-Time Interrupt/Counter (RTI/RTC) >68HC11/12 RTI Hardware and Registers RTI Programming Examples Use RTI interrupt; use RTIF & polling Free-running

More information

Processor and compiler dependent

Processor 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 information

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to

More information

Introduction to the MC9S12 Hardware Subsystems

Introduction to the MC9S12 Hardware Subsystems Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators

More information

1. Attempt any three of the following: 15

1. Attempt any three of the following: 15 (2½ hours) Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written together.

More information

ECE3120: Computer Systems Chapter 8: Timer Module

ECE3120: Computer Systems Chapter 8: Timer Module ECE32: Computer Systems Chapter 8: Timer Module Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun2 Email: msjeedigun2@tntech.edu Tel: 93-372-68, Prescott Hall 2 Why are Timer Functions Important?

More information

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.

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 microprocessors Feisal Mohammed 3rd January 2001 Additional features 1 Input/Output Ports One of the features that differentiates a microcontroller from a microprocessor is the presence

More information

Chapter 2. Overview of Architecture and Microcontroller-Resources

Chapter 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 information

Digital and Analogue Project Report

Digital 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 information

CHAPTER TIMER PROGRAMMING

CHAPTER TIMER PROGRAMMING CHAPTER 9 8051 TIMER PROGRAMMING 8051 Timers The 8051 has two timers/counters, they can be used as Timers to generate a time delay Event counters to count events happening outside the microcontroller Both

More information

What happens when an HC12 gets in unmasked interrupt:

What happens when an HC12 gets in unmasked interrupt: What happens when an HC12 gets in unmasked interrupt: 1. Completes current instruction 2. Clears instruction queue 3. Calculates return address 4. Stacks return address and contents of CPU registers 5.

More information

C Language Programming, Interrupts and Timer Hardware

C Language Programming, Interrupts and Timer Hardware C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and

More information

CPEG300 Embedded System Design. Lecture 8 Timer

CPEG300 Embedded System Design. Lecture 8 Timer CPEG300 Embedded System Design Lecture 8 Timer Hamad Bin Khalifa University, Spring 2018 Review 8051 port and port schematic Internal read/write data path Serial communication vs. parallel communication

More information

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration Features Utilizes the AVR RISC Architecture High-performance and Low-power 8-bit RISC Architecture 90 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L. Advance Information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L. Advance Information Features High-performance, Low-power AVR 8-bit Microcontroller 3 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 8 MIPS Throughput

More information