EEVblog® Electronics Community Forum
A Free & Open Forum For Electronics Enthusiasts & Professionals
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
This topic
This board
Entire forum
Google
Bing
Home
Help
Search
About us
Links
Login
Register
EEVblog® Electronics Community Forum
»
Electronics
»
Microcontrollers
»
PIC18 timer help
« previous
next »
Print
Search
Pages: [
1
]
Go Down
Author
Topic: PIC18 timer help (Read 1254 times)
0 Members and 1 Guest are viewing this topic.
Ground_Loop
Frequent Contributor
Posts: 712
Country:
PIC18 timer help
«
on:
January 11, 2021, 07:17:21 pm »
I'm trying to use a timer in a PIC18F27Q10. It looks like registers TMRxL and TMRxH store the period value for the timer according to the MCC setup page. However, the data sheet says these registers are used for the accumulated value. I need to set specific accumulated values (reset the count to zero) without altering the overall period value. I don't see how to accomplish that or understand how the timer operates if the registers are one in the same. Please help.
«
Last Edit: January 11, 2021, 07:53:02 pm by Ground_Loop
»
Logged
There's no point getting old if you don't have stories.
Ian.M
Super Contributor
Posts: 14135
Re: PIC18 timer help
«
Reply #1 on:
January 11, 2021, 08:17:38 pm »
Odd numbered timers don't even *HAVE* a period register. They roll over from 0xFFFF to 0x0000. However it is possible to configure a CCP module to clear its odd numbered timer on compare match, effectively using its CCPRx SFRs a the limit register for the timer.
In general you should always believe the datasheet (as corrected by any applicable errata) over MCC, unless you have specific evidence to the contrary.
Logged
Ground_Loop
Frequent Contributor
Posts: 712
Country:
Re: PIC18 timer help
«
Reply #2 on:
January 11, 2021, 09:29:35 pm »
Yea, I figured out the roll over part. I decided to set it up as a self interrupting timer with timer 3 as the clock source, that stops on roll over and is then externally restarted. It's not elegant, but it works for my purposes.
«
Last Edit: January 11, 2021, 09:55:54 pm by Ground_Loop
»
Logged
There's no point getting old if you don't have stories.
Print
Search
Pages: [
1
]
Go Up
« previous
next »
Share me
Smf
EEVblog® Electronics Community Forum
»
Electronics
»
Microcontrollers
»
PIC18 timer help
There was an error while thanking
Thanking...
-
-
-
-->
EEVblog® Main Site
EEVblog® on Youtube
EEVblog® on Twitter
EEVblog® on Facebook
EEVblog® on Odysee