16F1937 8bit timer 2/4 & 6
Moderator: Benj
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
16F1937 8bit timer 2/4 & 6
As timer 2/4 & 6 are 8 bits, they should not default to(or allow) 256 rollover value:
When OK is clicked on the values are excepted.Martin
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 16F1937 8bit timer 2/4 & 6
Hi Martin,
The rollover of 256 as the default is correct.
The interrupt occurs when the count register goes from 255 to 0 e.g. the 256th count.
0 to 1 = count 1
1 to 2 = count 2
...
254 to 255 = count 255
255 to 0 = count 256
We use the rollover value - 1 behind the scenes in the rollover register so 256 would become 255 for say the PR2 register.
The rollover of 256 as the default is correct.
The interrupt occurs when the count register goes from 255 to 0 e.g. the 256th count.
0 to 1 = count 1
1 to 2 = count 2
...
254 to 255 = count 255
255 to 0 = count 256
We use the rollover value - 1 behind the scenes in the rollover register so 256 would become 255 for say the PR2 register.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: 16F1937 8bit timer 2/4 & 6
Hi Ben,
Thank you, that would explain it
Ah I did not know that.Benj wrote:We use the rollover value - 1 behind the scenes in the rollover register so 256 would become 255 for say the PR2 register.
Thank you, that would explain it
Martin