CP316- Timers and Countersdenethor.wlu.ca/cp316/lectures/timerbeam.pdf · Timer2 16 bit register...
Transcript of CP316- Timers and Countersdenethor.wlu.ca/cp316/lectures/timerbeam.pdf · Timer2 16 bit register...
Timers and Counters
CP316Timers and Counters
Terry Sturtevant
Wilfrid Laurier University
December 10, 2019
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)output pinsprescalerstart/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. counters
A timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)output pinsprescalerstart/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external events
size (i.e. number of bits)output pinsprescalerstart/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)
output pinsprescalerstart/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)output pins
prescalerstart/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)output pinsprescaler
start/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)output pinsprescalerstart/stop
interrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timers and Counters
timers vs. countersA timer counts clock pulses; a counter counts external eventssize (i.e. number of bits)output pinsprescalerstart/stopinterrupt flag
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer startsMAXmaximum value the timer can reachTOPhighest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOM
value from which the timer startsMAXmaximum value the timer can reachTOPhighest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer starts
MAXmaximum value the timer can reachTOPhighest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer startsMAX
maximum value the timer can reachTOPhighest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer startsMAXmaximum value the timer can reach
TOPhighest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer startsMAXmaximum value the timer can reachTOP
highest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer startsMAXmaximum value the timer can reachTOPhighest value in the timer count sequence
depending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Definitions
BOTTOMvalue from which the timer startsMAXmaximum value the timer can reachTOPhighest value in the timer count sequencedepending on mode, can be less than or equal to MAX
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
TnTimer n inputOCnxOutput compare pin x for timer nICPnInput capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
Tn
Timer n inputOCnxOutput compare pin x for timer nICPnInput capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
TnTimer n input
OCnxOutput compare pin x for timer nICPnInput capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
TnTimer n inputOCnx
Output compare pin x for timer nICPnInput capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
TnTimer n inputOCnxOutput compare pin x for timer n
ICPnInput capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
TnTimer n inputOCnxOutput compare pin x for timer nICPn
Input capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Pins
TnTimer n inputOCnxOutput compare pin x for timer nICPnInput capture pin for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVnTimer overflow nOCFnxOutput compare match x for timer nICFnInput capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVn
Timer overflow nOCFnxOutput compare match x for timer nICFnInput capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVnTimer overflow n
OCFnxOutput compare match x for timer nICFnInput capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVnTimer overflow nOCFnx
Output compare match x for timer nICFnInput capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVnTimer overflow nOCFnxOutput compare match x for timer n
ICFnInput capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVnTimer overflow nOCFnxOutput compare match x for timer nICFn
Input capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Flags
TOVnTimer overflow nOCFnxOutput compare match x for timer nICFnInput capture for timer n
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normal
rolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOP
CTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)
returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reached
Fast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWM
rolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOP
output OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes
Normalrolls over at TOPCTC (Clear Timer on Compare Match)returns to zero when OCRnx (or ICRn) reachedFast PWMrolls over at TOPoutput OCnx set when compare matches TCNTx and OCRnx
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWM
counts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOM
output OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnx
Phase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWM
counts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOM
output set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer modes (continued)
Phase correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput OCnx cleared on upcount, set on downcount whencompare matches TCNTx and OCRnxPhase and frequency correct PWMcounts BOTTOM to TOP then TOP to BOTTOMoutput set when ????????? compare matches TCNTx andOCRnx ???
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0
counter?size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0
counter?
size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0
counter?size?
prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0
counter?size?prescaler?
Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0
counter?size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00MAX0xFFmaximum value the timer can reachTOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM
0x00MAX0xFFmaximum value the timer can reachTOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00
MAX0xFFmaximum value the timer can reachTOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00MAX
0xFFmaximum value the timer can reachTOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00MAX0xFF
maximum value the timer can reachTOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00MAX0xFFmaximum value the timer can reach
TOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00MAX0xFFmaximum value the timer can reachTOP
MAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer0 details
BOTTOM0x00MAX0xFFmaximum value the timer can reachTOPMAX or value in OCR0A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 0
Timer 0
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 0
Timer 0
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 0
Timer 0Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0A register
Bits in TCCR0A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0A register
Bits in TCCR0A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0A register
Bits in TCCR0A register
COM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0A register
Bits in TCCR0A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0B register
Bits in TCCR0B registerFOC Force output compare bits
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0B register
Bits in TCCR0B registerFOC Force output compare bits
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0B register
Bits in TCCR0B register
FOC Force output compare bitsWGM Waveform generation mode bits
CS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR0B register
Bits in TCCR0B registerFOC Force output compare bits
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR0 register
Bits in TIFR0 registerOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR0 register
Bits in TIFR0 registerOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR0 register
Bits in TIFR0 register
OCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR0 register
Bits in TIFR0 registerOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1
counter?size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1
counter?
size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1
counter?size?
prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1
counter?size?prescaler?
Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1
counter?size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000MAX0xFFFFmaximum value the timer can reachTOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM
0x0000MAX0xFFFFmaximum value the timer can reachTOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000
MAX0xFFFFmaximum value the timer can reachTOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000MAX
0xFFFFmaximum value the timer can reachTOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000MAX0xFFFF
maximum value the timer can reachTOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000MAX0xFFFFmaximum value the timer can reach
TOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000MAX0xFFFFmaximum value the timer can reachTOP
0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer1 details
BOTTOM0x0000MAX0xFFFFmaximum value the timer can reachTOP0x00FF, 0x01FF,or 0x03FF, or to the value stored in theOCR1A or ICR1, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 1
Timer 1
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 1
Timer 1
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 1
Timer 1Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1A register
Bits in TCCR1A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1A register
Bits in TCCR1A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1A register
Bits in TCCR1A register
COM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1A register
Bits in TCCR1A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1B register
Bits in TCCR1B registerICNC Input capture noise canceler bitICES Input capture edge select bit
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1B register
Bits in TCCR1B registerICNC Input capture noise canceler bitICES Input capture edge select bit
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1B register
Bits in TCCR1B register
ICNC Input capture noise canceler bitICES Input capture edge select bit
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1B register
Bits in TCCR1B registerICNC Input capture noise canceler bitICES Input capture edge select bit
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1C register
Bits in TCCR1C registerFOC Force output compare bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1C register
Bits in TCCR1C registerFOC Force output compare bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1C register
Bits in TCCR1C register
FOC Force output compare bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR1C register
Bits in TCCR1C registerFOC Force output compare bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR1 register
Bits in TIFR1 registerICF Input capture flag bit
OCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR1 register
Bits in TIFR1 registerICF Input capture flag bit
OCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR1 register
Bits in TIFR1 register
ICF Input capture flag bitOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR1 register
Bits in TIFR1 registerICF Input capture flag bit
OCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2
counter?size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2
counter?
size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2
counter?size?
prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2
counter?size?prescaler?
Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2
counter?size?prescaler?Arduino connections
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00MAX0xFFmaximum value the timer can reachTOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM
0x00MAX0xFFmaximum value the timer can reachTOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00
MAX0xFFmaximum value the timer can reachTOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00MAX
0xFFmaximum value the timer can reachTOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00MAX0xFF
maximum value the timer can reachTOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00MAX0xFFmaximum value the timer can reach
TOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00MAX0xFFmaximum value the timer can reachTOP
MAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer2 details
BOTTOM0x00MAX0xFFmaximum value the timer can reachTOPMAX or the value stored in the OCR2A, depending on mode
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 2
Timer 2
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 2
Timer 2
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 2
Timer 2Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2A register
Bits in TCCR2A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2A register
Bits in TCCR2A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2A register
Bits in TCCR2A register
COM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2A register
Bits in TCCR2A registerCOM Output compare bitsWGM Waveform generation mode bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2B register
Bits in TCCR2B registerFOC Force output compare bits
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2B register
Bits in TCCR2B registerFOC Force output compare bits
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2B register
Bits in TCCR2B register
FOC Force output compare bitsWGM Waveform generation mode bits
CS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TCCR2B register
Bits in TCCR2B registerFOC Force output compare bits
WGM Waveform generation mode bitsCS Clock select bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR2 register
Bits in TIFR2 registerOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR2 register
Bits in TIFR2 registerOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR2 register
Bits in TIFR2 register
OCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
TIFR2 register
Bits in TIFR2 registerOCF Output compare flag bitsTOV Timer overflow flag bits
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 0-1 prescaler
Timer 0-1 prescaler
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 0-1 prescaler
Timer 0-1 prescaler
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 0-1 prescaler
Timer 0-1 prescaler
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 2 prescaler
Timer 2 prescaler
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 2 prescaler
Timer 2 prescaler
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
Timer 2 prescaler
Timer 2 prescaler
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
16 bit register access
LOW HIGH
TMP
WRRD
DATA
16 bit register access
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
16 bit register access
LOW HIGH
TMP
WRRD
DATA
Reading LOW byte latches HIGH byte
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
16 bit register access
LOW HIGH
TMP
WRRD
DATA
Reading HIGH byte gets value from latch
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
16 bit register access
LOW HIGH
TMP
WRRD
DATA
Writing HIGH byte places value in latch
Terry Sturtevant CP316 Timers and Counters
Timers and Counters
DetailsTimer0Timer1Timer216 bit register access
16 bit register access
LOW HIGH
TMP
WRRD
DATA
Writing LOW byte transfers value from latch
Terry Sturtevant CP316 Timers and Counters