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

Confusion about RTCC timing in the manual

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hillcraft
Guest







Confusion about RTCC timing in the manual
PostPosted: Mon Aug 04, 2003 12:38 am     Reply with quote

<font face="Courier New" size=-1>On page 188 of the CCS manual in demo EX_STWT.C the following appears.

#use delay (clock=20000000)
#define INTS_PER_SECOND 76 // (20000000/(4*256*256))

===in code
setup_counters (RTCC_INTERNAL,RTCC_DIV_256);

Is this correct:
20000000/4 = 5000000 -> internal clock
5000000/256 = 19531.25 -> RTCC roll over
19531.25/256 = 76.294 -> RTCC_DIV_256
===========================================
This is wher I get confused
On page 136 of PICmicro MCU C by Nigel Gardner the following appears;

#use delay(clock=1024000)

===in code
setup_counters(rtcc_internal,rtcc_div_256);
// increments 1024000/4*256 times per second
//or every millisecond

Is this correct:
1024000/4 = 256000 -> internal clock
256000/256 = 1000 -> RTCC roll over

-- this part of the calculation is not performed
1000/256 = 3.9 -> RTCC_DIV_256
===========================================

My question is: is the example in Nigel Gardner's book incorrect because the RTCC_DIV_256 is never taken in to account?</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516638
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

Re: Confusion about RTCC timing in the manual
PostPosted: Mon Aug 04, 2003 3:37 am     Reply with quote

Hello

:=#use delay (clock=20000000)
:=#define INTS_PER_SECOND 76 // (20000000/(4*256*256))
:=
:====in code
:=setup_counters (RTCC_INTERNAL,RTCC_DIV_256);
:=
:=Is this correct:
:=20000000/4 = 5000000 -> internal clock
:=5000000/256 = 19531.25 -> RTCC roll over
:=19531.25/256 = 76.294 -> RTCC_DIV_256
:============================================

Yes, I think your calculation is correct

:=This is wher I get confused
:=On page 136 of PICmicro MCU C by Nigel Gardner the following appears;
:=
:=#use delay(clock=1024000)
:=
:====in code
:=setup_counters(rtcc_internal,rtcc_div_256);
:=// increments 1024000/4*256 times per second
:=//or every millisecond
:=
:=Is this correct:
:=1024000/4 = 256000 -> internal clock
:=256000/256 = 1000 -> RTCC roll over

The comment of the code sais something about incrementing every 1ms, so I think this 1000 is the incrementing frequency of tmr0 and not the roll over frequ.


:=-- this part of the calculation is not performed
:=1000/256 = 3.9 -> RTCC_DIV_256
:============================================
:=
:=My question is: is the example in Nigel Gardner's book incorrect because the RTCC_DIV_256 is never taken in to account?

I don't know this appliaction of M. Gardner but perhaps there is no tmr0-isr? And so he don't use the roll-over.

may this helps

mfg
Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516641
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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