CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Help with Frequency Counter
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19588

View user's profile Send private message

PostPosted: Sat Jan 07, 2012 10:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Jan 07, 2012 4:48 pm     Reply with quote

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) Very Happy . 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

View user's profile Send private message

PostPosted: Sun Jan 08, 2012 2:48 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group