View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19588
|
|
Posted: Sat Jan 07, 2012 10:13 am |
|
|
What does factor correspond to?. It is set to '1' when there have been _256_ counts, not 255. The interrupt occurs when the timer advances from 255, to 256, and goes back to 0....
Best Wishes |
|
|
marcus.couceiro
Joined: 04 Jan 2012 Posts: 12 Location: Brazil
|
|
Posted: Sat Jan 07, 2012 4:48 pm |
|
|
Hi ASMboy,
Thank you for your comments. I will implement them and see how it works.
I can imagine that people who has a lot of experience programming might think that the code is not correct for the application and I agree with them.
But he main purpose when I wrote the code was to learn (even if I am learning it wrong) how to use C.
With the valuable information you and the others provided I already think that the "mission" was accomplished and I know much more than I knew before (I did not know anything at all) . I will keep learning and relying on your judgement regarding future codes.
TTelmah,
The factor counts how many times we had overflow of TIMER0.
Kind regards to all _________________ Marcus Couceiro |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19588
|
|
Posted: Sun Jan 08, 2012 2:48 am |
|
|
Yes, but your maths is wrong. It counts '1' every time 256 is reached. You are multiplying it by 255. So your total will be this amount too small, which is almost exactly your error.
Best Wishes |
|
|
|