Atmel ARM Timer Programming

Slides:



Advertisements
Similar presentations
ECE/CS-352: Embedded Microcontroller Systems The Silicon Laboratories C8051F020 Enhanced 8051 Part 5 Other Subsystems.
Advertisements

More fun with Timer/Counters
Sistemi Elettronici Programmabili13-1 MULTI OSC + CLOCK FILTER LVD POWER SUPPLY CONTROL 8 BIT CORE ALU PROGRAM MEMORY RAM I2CI2C PORT A SPI PORT B 16-BIT.
EET 2261 Unit 10 Enhanced Capture Timer  Read Almy, Chapter 20.  Homework #10 and Lab #10 due next week.  Quiz next week.
Analog to Digital Conversion
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
Introduction of Holtek HT-46 series MCU
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
ATtiny2313 Timers/Counters CS-423 Dick Steflik. What Do You Use Timers For? Timing of events (internal or external)‏ Scheduling Events Measuring the width.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
NS Training Hardware. System Controller Module.
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Timer/counter Chapter 12
ARM Timers.
System Clocks.
Multiplexed External Bus Interface-MEBIV3 By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
MS_uC / fue1 / V TIMx - Timer Programming Microcontroller TIMx - Timer Autumn term 2012.
AT91 Embedded Peripherals
ELE22MIC Lecture 18 The AVR Sleep Modes The ATMEGA128’s Timer System
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
CS-280 Dr. Mark L. Hornick 1 Atmel Timer/Counter System Most microcontrollers include some type of timer system Facilitates real-time monitoring and control.
The Cortex-M3 Embedded Systems: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM) Refer to Chapter 21 in the reference book “Stellaris® LM3S9B96 Microcontroller.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
TIMERS.
Timer modules in PIC 16F877.  The PIC 16F877 basically has three independent timer modules,  denoted by the symbols, TIMER-0, TIMER1,andTIMER2. . These.
EET 2261 Unit 13 Enhanced Capture Timer
16F877A.
Why are Timer Functions Important?
Lecture 10: TI MSP430 Timers and Capture Modes
V.V.P. ENGINEERING COLLEGE,RAJKOT
ECE 3430 – Intro to Microcomputer Systems
TI ARM I/O Programming Chapter 2
PWM and DC Motor Control
Timer and Interrupts.
BITS EDU. CAMPUS , VARNAMA
Atmel ARM I/O Programming
AVR Addressing Modes Subject: Microcontoller & Interfacing
MSP432 ARM Timer Programming
ADC, DAC, and Sensor Interfacing
8085 Microprocessor Architecture
RX Compare Match Timer (CMT)
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Freescale ARM Timer Programming
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Timer/Counter Modified from Dr. Lam Phung’s Slides.
8-bit Timer/Counter0 with PWM
Interrupt and Exception Programming
SPI Protocol and DAC Interfacing
Pugazhendhi.M 11/12/2018 TIMERS 11/12/2018 CCET CCET.
SPI Protocol and DAC Interfacing
ADC, DAC, and Sensor Interfacing
MSP432 ARM Timer Programming
Programmable Interval timer 8253 / 8254
8-bit Timer/Counter2 with PWM and Asynchronous Operation
8085 Microprocessor Architecture
STM Arm Timer Programming
Programmable Interval timer 8253 / 8254
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
8085 Microprocessor Architecture
MCO556 Timer System Exercise.
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
Presentation transcript:

Atmel ARM Timer Programming Chapter 5 Atmel ARM Timer Programming

A 3-bit Counter

An 8-bit up-counter stages

An 8-bit down-counter stages

Counting Events Using a Counter

Using Counter as a Timer

Capturing

System Tick Timer Internal Structure

STCTRL (System Tick Control)

System Tick Counting

STRVR vs. STCVR

Bits 15-8 of APBCMASK Register is used to enable timer clock

Atmel SAMD2x Timer/Counter Prescale Options

ID numbers of Timer Counter Clocks

Some of the Atmel SAMD2x Timer/Counter Registers Offset Register Name 0x00 CTRLA 0x01 0x04 CTRLBCLR 0x05 CTRLBSET 0x06 CTRLC 0x0A EVCTRL 0x0B 0x0E INTFLAG 0x0F STATUS 0x10   COUNT 0x11 0x12 0x13 0x18 CC0 0x19 0x1A 0x1B 0x1C CC1 0x1D 0x1E 0x1F

CTRLA (Control A) Register

CTRLA register bit Name Description SWRST Software Reset SWRST Software Reset 0: There is no reset operation ongoing. 1: The reset operation is ongoing. 1 ENABLE Enable 0: The peripheral is disabled. 1: The peripheral is enabled. 3-2 MODE[1:0] Timer/Counter n-bit Mode 0x0: 16-bit 0x1: 8-bit 0x2: 32-bit 6-5 WAVEGEN[1:0] Waveform Generation Operation 10-8 PRESCALER[2:0] Prescaler 0x0: divide by 1 0x1: divide by 2 0x2: divide by 4 0x3: divide by 8 0x4: divide by 16 0x5: divide by 64 0x6: divide by 256 0x7: divide by 1024 11 RUNSTDBY Run in Standby 0: The TCC is halted in standby. 1: The TCC continues to run in standby. 13-12 PRESCSYNC[1:0] Prescaler and Counter Synchronization Selection

n-bit options

Prescaler Options

Wave Generation Options

CTRLBCLR Register

CTRLBSET Register

INTFLAG Register

INTFLAG Register Bits bit Name Description 5-4 MCx Match or Capture Channel x This flag is set on the next CLK_TC_CNT cycle after a match with the compare condition or once CCx register contains a valid capture value. OVF Overflow This flag is set on the next CLK_TC_CNT cycle after an overflow condition occurs.

Timer Options for Prescaler

TC counter counting in 32-bit Mode

Counter operations with direction and counter value changes on the fly

COUNT and Compare registers with Waveform Output

Match Frequency Operation with Waveform Output 0 (WO[0])

Port pin assignement of Timer/Counters TC/WO I/O Pin TC3/WO[0] PA14 PA18 TC3/WO[1] PA15 PA19 TC4/WO[0] PA22 PB08 PB12 TC4/WO[1] PA23 PB09 PB13 TC5/WO[0] PA24 PB10 PB14 TC5/WO[1] PA25 PB11 PB15 TC6/WO[0] PB02 PB16 TC6/WO[1] PB03 PB17 TC7/WO[0] PA20 PB00 PB22 TC7/WO[1] PA21 PB01 PB23

PMUX Register is used to select multiplexing pin functions

PMUX register options

Atmel SAM D21 Alternative Pin Functions   A (0) B (1) C (2) D (3) E (4) F (5) G (6) H (7) I/O Pin Supply EIC REF ADC AC PTC DAC SERCOM SERCOM-ALT TC/TCC TCC COM AC/GCLK PA00 VDDANA EXTINT[0] SERCOM1/PAD[0] TCC2/WO[0] PA01 EXTINT[1] SERCOM1/PAD[1] TCC2/WO[1] PA02 EXTINT[2] AIN[0] Y[0] VOUT PA03 EXTINT[3] ADC/VREFA DAC/VREFA AIN[1] Y[1] PA04 EXTINT[4] ADC/VREFB AIN[4] Y[2] SERCOM0/PAD[0] TCC0/WO[0] PA05 EXTINT[5] AIN[5] Y[3] SERCOM0/PAD[1] TCC0/WO[1] PA06 EXTINT[6] AIN[6] AIN[2] Y[4] SERCOM0/PAD[2] TCC1/WO[0] PA07 EXTINT[7] AIN[7] AIN[3] Y[5] SERCOM0/PAD[3] TCC1/WO[1] I2S/SD[0] PA08 VDDIO NMI AIN[16] X[0] SERCOM2/PAD[0] TCC1/WO[2] I2S/SD[1] PA09 EXTINT[9] AIN[17] X[1] SERCOM2/PAD[1] TCC1/WO[3] I2S/MCK[0] PA10 EXTINT[10] AIN[18] X[2] SERCOM2/PAD[2] TCC0/WO[2] I2S/SCK[0] GCLK_IO[4] PA11 EXTINT[11] AIN[19] X[3] SERCOM2/PAD[3] TCC0/WO[3] I2S/FS[0] GCLK_IO[5] PA12 EXTINT[12] SERCOM4/PAD[0] TCC0/WO[6] AC/CMP[0] PA13 EXTINT[13] SERCOM4/PAD[1] TCC0/WO[7] AC/CMP[1] PA14 EXTINT[14] SERCOM4/PAD[2] TC3/WO[0] TCC0/WO[4] GCLK_IO[0] PA15 EXTINT[15] SERCOM4/PAD[3] TC3/WO[1] TCC0/WO[5] GCLK_IO[1] PA16 X[4] SERCOM3/PAD[0] GCLK_IO[2] PA17 X[5] SERCOM3/PAD[1] GCLK_IO[3] PA18 X[6] SERCOM1/PAD[2] SERCOM3/PAD[2] PA19 X[7] SERCOM1/PAD[3] SERCOM3/PAD[3] PA20 X[8] SERCOM5/PAD[2] TC7/WO[0] PA21 X[9] SERCOM5/PAD[3] TC7/WO[1] PA22 X[10] SERCOM5/PAD[0] TC4/WO[0] GCLK_IO[6] PA23 X[11] SERCOM5/PAD[1] TC4/WO[1] USB/SOF 1kHz GCLK_IO[7]

Atmel SAM D21 Alternative Pin Functions PA24 VDDIO EXTINT[12]   SERCOM3/PAD[2] SERCOM5/PAD[2] TC5/WO[0] TCC1/WO[2] USB/DM PA25 EXTINT[13] SERCOM3/PAD[3] SERCOM5/PAD[3] TC5/WO[1] TCC1/WO[3] USB/DP PA27 EXTINT[15] GCLK_IO[0] PA28 EXTINT[8] PA30 EXTINT[10] SERCOM1/PAD[2] TCC1/WO[0] SWCLK PA31 EXTINT[11] SERCOM1/PAD[3] TCC1/WO[1] SWDIO(4) PB00 VDDANA EXTINT[0] AIN[8] Y[6] TC7/WO[0] PB01 EXTINT[1] AIN[9] Y[7] TC7/WO[1] PB02 EXTINT[2] AIN[10] Y[8] SERCOM5/PAD[0] TC6/WO[0] PB03 EXTINT[3] AIN[11] Y[9] SERCOM5/PAD[1] TC6/WO[1] PB04 EXTINT[4] AIN[12] Y[10] PB05 EXTINT[5] AIN[13] Y[11] PB06 EXTINT[6] AIN[14] Y[12] PB07 EXTINT[7] AIN[15] Y[13] PB08 AIN[2] Y[14] SERCOM4/PAD[0] TC4/WO[0] PB09 EXTINT[9] AIN[3] Y[15] SERCOM4/PAD[1] TC4/WO[1] PB10 SERCOM4/PAD[2] TCC0/WO[4] I2S/MCK[1] GCLK_IO[4] PB11 SERCOM4/PAD[3] TCC0/WO[5] I2S/SCK[1] GCLK_IO[5] PB12 X[12] TCC0/WO[6] I2S/FS[1] GCLK_IO[6] PB13 X[13] TCC0/WO[7] GCLK_IO[7] PB14 EXTINT[14] X[14] PB15 X[15] GCLK_IO[1] PB16 I2S/SD[1] GCLK_IO[2] PB17 I2S/MCK[0] GCLK_IO[3] PB22 PB23 PB30 TCC0/WO[0] PB31 TCC0/WO[1]

block diagram of External Interreupt Controller

EIC Configuration Register (only the lower 8 bits are shown)

Choices of SENSE bits in Configuration register of EIC

Channel Register bit assignments

Edge selection bits of Channel register

Partial Listing of Path selection for Event Generator of Channel register

User Multiplexer register bit assignments

Event user identification numbers for Timer/Counter 0x12 TC3 0x13 TC4 0x14 TC5 0x15 TC6 0x16 TC7

Control C register

Event Control (EVCTRL) Register

Measuring Period and Pulse Width

Event Control (EVCTRL) Register (Event Action Options)