SlideShare a Scribd company logo
Using Timer2/4/8 of Microchip PIC18F
Microcontrollers
Corrado Santoro
ARSLAB - Autonomous and Robotic Systems Laboratory
Dipartimento di Matematica e Informatica - Universit`a di Catania, Italy
santoro@dmi.unict.it
L.A.P. 1 Course
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
The other timers of of PIC18
In addition to TIMER0, PIC18 Family has other 6 timers, subdivided in
two families
First family includes TIMER1, TIMER3 and TIMER5
Second family includes TIMER2, TIMER4 and TIMER6
Timers of the same family have the same structure and working scheme
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
The timers 2/4/6 of of PIC18
Timers2/4/6 are 8-bit timers with period register;
Clock source can be only Fosc/4;
A prescaler is present and performs division by 1, 4 or 16;
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Working scheme of timers 2/4/6
TMRx increments according to clock source and prescaler;
When TMRx becomes equal to PRx, the internal EQ event is
generated
The EQ event causes an automatic reset to 0 of TIMERx;
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Working scheme of timers 2/4/6
The EQ event goes through the postscaler;
The postscaler counts for n EQ events, with 1 ≤ n ≤ 16 programmable,
and then activates TMRxIF.
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Special Functions Registers of timers 2/4/6
TxCON: Controls Prescaler and Postscaler
TMRx: The timer count variable
PRx: The timer period register
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Control Register of timers 2/4/6
TxOUTPS: Postscaler setup
0000 = 1:1 postscaler
0001 = 1:2 postscaler
...
1110 = 1:15 postscaler
1111 = 1:16 postscaler
TMRxON: Timer On/Off control
TxCKPS: Prescaler setup
00 = 1:1 prescaler
01 = 1:4 prescaler
1x = 1:16 prescaler
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Interrupt flags of timers 2/4/6
Interrupt (period-match) flags of timers 2/4/6 belong to various
special function registers:
TMR2IF ⇒ PIR1bits.TMR2IF
TMR4IF ⇒ PIR5bits.TMR4IF
TMR6IF ⇒ PIR5bits.TMR6IF
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Times and Prescalers
With Fosc/4 = 16MHz, 4 · Posc = 62.5ns:
TxCKPS = 1:1, bit period = 62.5ns, max period = 255 ∗ 62.5 = 15.9µs;
TxCKPS = 1:4, bit period = 250ns, max period =
255 ∗ 62.5 ∗ 4 = 63.75µs;
TxCKPS = 1:16, bit period = 1µs, max period = 256 ∗ 62.5 ∗ 4 = 255µs;
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
Using Timer2/4/8 of Microchip PIC18F
Microcontrollers
Corrado Santoro
ARSLAB - Autonomous and Robotic Systems Laboratory
Dipartimento di Matematica e Informatica - Universit`a di Catania, Italy
santoro@dmi.unict.it
L.A.P. 1 Course
Corrado Santoro Using Timer2/4/8 in PIC18F MCUs

More Related Content

What's hot

Ccp
CcpCcp
Lecture 2 timers, pwm, state machine IN PIC
Lecture 2   timers, pwm, state machine IN PIC Lecture 2   timers, pwm, state machine IN PIC
Lecture 2 timers, pwm, state machine IN PIC
أشرف أمجد الشريف
 
AVR_Course_Day7 timers counters and interrupt programming
AVR_Course_Day7 timers counters and  interrupt programmingAVR_Course_Day7 timers counters and  interrupt programming
AVR_Course_Day7 timers counters and interrupt programming
Mohamed Ali
 
8051 ch9-950217
8051 ch9-9502178051 ch9-950217
8051 ch9-950217
Gopal Krishna Murthy C R
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16
Ramadan Ramadan
 
8051 Timers / Counters
8051 Timers / Counters8051 Timers / Counters
8051 Timers / CountersPatricio Lima
 
9 timer programming
9 timer programming9 timer programming
9 timer programming
Channabasappa Kudarihal
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
Shreyans Pathak
 
Class9
Class9Class9
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
Aarav Soni
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counterankit3991
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
cjbas
 
Ec8791 lpc2148 timer unit
Ec8791 lpc2148 timer unitEc8791 lpc2148 timer unit
Ec8791 lpc2148 timer unit
RajalakshmiSermadurai
 
Programming 8051 Timers
Programming 8051 Timers Programming 8051 Timers
Programming 8051 Timers ViVek Patel
 
Timers
TimersTimers
Timers
Vima Mali
 

What's hot (20)

Ccp
CcpCcp
Ccp
 
UART MCU
UART MCUUART MCU
UART MCU
 
Lecture 2 timers, pwm, state machine IN PIC
Lecture 2   timers, pwm, state machine IN PIC Lecture 2   timers, pwm, state machine IN PIC
Lecture 2 timers, pwm, state machine IN PIC
 
Soc
SocSoc
Soc
 
AVR_Course_Day7 timers counters and interrupt programming
AVR_Course_Day7 timers counters and  interrupt programmingAVR_Course_Day7 timers counters and  interrupt programming
AVR_Course_Day7 timers counters and interrupt programming
 
Avr timers
Avr timersAvr timers
Avr timers
 
8051 ch9-950217
8051 ch9-9502178051 ch9-950217
8051 ch9-950217
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16
 
8051 Timers / Counters
8051 Timers / Counters8051 Timers / Counters
8051 Timers / Counters
 
9 timer programming
9 timer programming9 timer programming
9 timer programming
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
 
Class9
Class9Class9
Class9
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
 
Timers
TimersTimers
Timers
 
Ec8791 lpc2148 timer unit
Ec8791 lpc2148 timer unitEc8791 lpc2148 timer unit
Ec8791 lpc2148 timer unit
 
Programming 8051 Timers
Programming 8051 Timers Programming 8051 Timers
Programming 8051 Timers
 
8051 ch9
8051 ch98051 ch9
8051 ch9
 
Timers
TimersTimers
Timers
 

Similar to Using Timer2 in Microchip MCUs

moving message display of lcd
 moving message display of lcd moving message display of lcd
moving message display of lcd
abhishek upadhyay
 
Ee6008 mcbsd notes
Ee6008 mcbsd notesEe6008 mcbsd notes
Ee6008 mcbsd notes
vlkumashankardeekshi th
 
EE6008 MCBSD - Introduction to PIC Micro controller
EE6008 MCBSD - Introduction to PIC Micro controller EE6008 MCBSD - Introduction to PIC Micro controller
EE6008 MCBSD - Introduction to PIC Micro controller
pavihari
 
EE6008 MBSD
EE6008  MBSDEE6008  MBSD
EE6008 MBSD
rmkceteee
 
Advanced Embedded Automatic Car Parking System
	Advanced Embedded Automatic Car Parking System	Advanced Embedded Automatic Car Parking System
Advanced Embedded Automatic Car Parking System
theijes
 
Timers done by Priyanga KR
Timers done by Priyanga KRTimers done by Priyanga KR
Timers done by Priyanga KR
PriyangaKR1
 
Timer 2 concept
Timer 2 conceptTimer 2 concept
Timer 2 concept
v Kalairajan
 
timer counter (1).pptx
timer counter (1).pptxtimer counter (1).pptx
timer counter (1).pptx
SujalKumar73
 
Unit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptxUnit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptx
naveen088888
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
Shivashankar Sawalgi
 
Hoja de datos técnicos del PIC16FX
Hoja de datos técnicos del PIC16FXHoja de datos técnicos del PIC16FX
Hoja de datos técnicos del PIC16FXemmanuel9393
 
Datasheet
DatasheetDatasheet
Datasheet
conalep
 
Hoja de datos del PIC16FX
Hoja de datos del PIC16FXHoja de datos del PIC16FX
Hoja de datos del PIC16FX
conalep
 
lecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.pptlecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.ppt
HebaEng
 
Timer 0 concept
Timer 0 conceptTimer 0 concept
Timer 0 concept
v Kalairajan
 
Timer And Counter in 8051 Microcontroller
Timer And Counter in 8051 MicrocontrollerTimer And Counter in 8051 Microcontroller
Timer And Counter in 8051 Microcontroller
Jay Makwana
 
micro controllers 1.ppt
micro controllers 1.pptmicro controllers 1.ppt
micro controllers 1.ppt
siminkhan
 

Similar to Using Timer2 in Microchip MCUs (20)

moving message display of lcd
 moving message display of lcd moving message display of lcd
moving message display of lcd
 
Ee6008 mcbsd notes
Ee6008 mcbsd notesEe6008 mcbsd notes
Ee6008 mcbsd notes
 
EE6008 MCBSD - Introduction to PIC Micro controller
EE6008 MCBSD - Introduction to PIC Micro controller EE6008 MCBSD - Introduction to PIC Micro controller
EE6008 MCBSD - Introduction to PIC Micro controller
 
EE6008 MBSD
EE6008  MBSDEE6008  MBSD
EE6008 MBSD
 
Arduino 101
Arduino 101Arduino 101
Arduino 101
 
8051e
8051e8051e
8051e
 
Advanced Embedded Automatic Car Parking System
	Advanced Embedded Automatic Car Parking System	Advanced Embedded Automatic Car Parking System
Advanced Embedded Automatic Car Parking System
 
Timers done by Priyanga KR
Timers done by Priyanga KRTimers done by Priyanga KR
Timers done by Priyanga KR
 
Timer 2 concept
Timer 2 conceptTimer 2 concept
Timer 2 concept
 
timer counter (1).pptx
timer counter (1).pptxtimer counter (1).pptx
timer counter (1).pptx
 
Unit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptxUnit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptx
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Hoja de datos técnicos del PIC16FX
Hoja de datos técnicos del PIC16FXHoja de datos técnicos del PIC16FX
Hoja de datos técnicos del PIC16FX
 
Datasheet
DatasheetDatasheet
Datasheet
 
Hoja de datos del PIC16FX
Hoja de datos del PIC16FXHoja de datos del PIC16FX
Hoja de datos del PIC16FX
 
lecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.pptlecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.ppt
 
Timer 0 concept
Timer 0 conceptTimer 0 concept
Timer 0 concept
 
Timer And Counter in 8051 Microcontroller
Timer And Counter in 8051 MicrocontrollerTimer And Counter in 8051 Microcontroller
Timer And Counter in 8051 Microcontroller
 
micro controllers 1.ppt
micro controllers 1.pptmicro controllers 1.ppt
micro controllers 1.ppt
 
PIC 16F84
PIC 16F84PIC 16F84
PIC 16F84
 

More from Corrado Santoro

Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...
Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...
Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...
Corrado Santoro
 
The I2C Interface
The I2C InterfaceThe I2C Interface
The I2C Interface
Corrado Santoro
 
Pulse Width Modulation Signal Generation with MCUs
Pulse Width Modulation Signal Generation with MCUsPulse Width Modulation Signal Generation with MCUs
Pulse Width Modulation Signal Generation with MCUs
Corrado Santoro
 
Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015
Corrado Santoro
 
Presentation @ WOA 2015
Presentation @ WOA 2015 Presentation @ WOA 2015
Presentation @ WOA 2015 Corrado Santoro
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
Corrado Santoro
 
Introduction to shell scripting
Introduction to shell scriptingIntroduction to shell scripting
Introduction to shell scripting
Corrado Santoro
 
Analog to digital converter
Analog to digital converterAnalog to digital converter
Analog to digital converterCorrado Santoro
 
Programming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerProgramming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerCorrado Santoro
 
Introduction to microcontrollers
Introduction to microcontrollersIntroduction to microcontrollers
Introduction to microcontrollersCorrado Santoro
 
How does a Quadrotor fly? A journey from physics, mathematics, control system...
How does a Quadrotor fly? A journey from physics, mathematics, control system...How does a Quadrotor fly? A journey from physics, mathematics, control system...
How does a Quadrotor fly? A journey from physics, mathematics, control system...Corrado Santoro
 
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Integrating Cloud Services in Behaviour  Programming for Autonomous RobotsIntegrating Cloud Services in Behaviour  Programming for Autonomous Robots
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Corrado Santoro
 
Reactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA toolReactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA toolCorrado Santoro
 

More from Corrado Santoro (14)

Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...
Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...
Physical Flying Agents: Ummanned Aerial Vehicles Control, Coordination and Em...
 
The I2C Interface
The I2C InterfaceThe I2C Interface
The I2C Interface
 
Pulse Width Modulation Signal Generation with MCUs
Pulse Width Modulation Signal Generation with MCUsPulse Width Modulation Signal Generation with MCUs
Pulse Width Modulation Signal Generation with MCUs
 
Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015
 
Presentation @ WOA 2015
Presentation @ WOA 2015 Presentation @ WOA 2015
Presentation @ WOA 2015
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
Introduction to shell scripting
Introduction to shell scriptingIntroduction to shell scripting
Introduction to shell scripting
 
Pillole di C++
Pillole di C++Pillole di C++
Pillole di C++
 
Analog to digital converter
Analog to digital converterAnalog to digital converter
Analog to digital converter
 
Programming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerProgramming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontroller
 
Introduction to microcontrollers
Introduction to microcontrollersIntroduction to microcontrollers
Introduction to microcontrollers
 
How does a Quadrotor fly? A journey from physics, mathematics, control system...
How does a Quadrotor fly? A journey from physics, mathematics, control system...How does a Quadrotor fly? A journey from physics, mathematics, control system...
How does a Quadrotor fly? A journey from physics, mathematics, control system...
 
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Integrating Cloud Services in Behaviour  Programming for Autonomous RobotsIntegrating Cloud Services in Behaviour  Programming for Autonomous Robots
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
 
Reactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA toolReactive Autonomous System Programming using the PROFETA tool
Reactive Autonomous System Programming using the PROFETA tool
 

Recently uploaded

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

Using Timer2 in Microchip MCUs

  • 1. Using Timer2/4/8 of Microchip PIC18F Microcontrollers Corrado Santoro ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Universit`a di Catania, Italy santoro@dmi.unict.it L.A.P. 1 Course Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 2. The other timers of of PIC18 In addition to TIMER0, PIC18 Family has other 6 timers, subdivided in two families First family includes TIMER1, TIMER3 and TIMER5 Second family includes TIMER2, TIMER4 and TIMER6 Timers of the same family have the same structure and working scheme Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 3. The timers 2/4/6 of of PIC18 Timers2/4/6 are 8-bit timers with period register; Clock source can be only Fosc/4; A prescaler is present and performs division by 1, 4 or 16; Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 4. Working scheme of timers 2/4/6 TMRx increments according to clock source and prescaler; When TMRx becomes equal to PRx, the internal EQ event is generated The EQ event causes an automatic reset to 0 of TIMERx; Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 5. Working scheme of timers 2/4/6 The EQ event goes through the postscaler; The postscaler counts for n EQ events, with 1 ≤ n ≤ 16 programmable, and then activates TMRxIF. Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 6. Special Functions Registers of timers 2/4/6 TxCON: Controls Prescaler and Postscaler TMRx: The timer count variable PRx: The timer period register Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 7. Control Register of timers 2/4/6 TxOUTPS: Postscaler setup 0000 = 1:1 postscaler 0001 = 1:2 postscaler ... 1110 = 1:15 postscaler 1111 = 1:16 postscaler TMRxON: Timer On/Off control TxCKPS: Prescaler setup 00 = 1:1 prescaler 01 = 1:4 prescaler 1x = 1:16 prescaler Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 8. Interrupt flags of timers 2/4/6 Interrupt (period-match) flags of timers 2/4/6 belong to various special function registers: TMR2IF ⇒ PIR1bits.TMR2IF TMR4IF ⇒ PIR5bits.TMR4IF TMR6IF ⇒ PIR5bits.TMR6IF Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 9. Times and Prescalers With Fosc/4 = 16MHz, 4 · Posc = 62.5ns: TxCKPS = 1:1, bit period = 62.5ns, max period = 255 ∗ 62.5 = 15.9µs; TxCKPS = 1:4, bit period = 250ns, max period = 255 ∗ 62.5 ∗ 4 = 63.75µs; TxCKPS = 1:16, bit period = 1µs, max period = 256 ∗ 62.5 ∗ 4 = 255µs; Corrado Santoro Using Timer2/4/8 in PIC18F MCUs
  • 10. Using Timer2/4/8 of Microchip PIC18F Microcontrollers Corrado Santoro ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Universit`a di Catania, Italy santoro@dmi.unict.it L.A.P. 1 Course Corrado Santoro Using Timer2/4/8 in PIC18F MCUs