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

counter1 question

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



Joined: 02 Aug 2005
Posts: 14

View user's profile Send private message

counter1 question
PostPosted: Sat Jul 22, 2006 8:16 pm     Reply with quote

Hi,

I want to use two external counters through timer0 and timer1.
I have a PIC18F452 with RA4 and RC0 pull-down through 10k resistors to GND. I want to count every rising edge of the external clock input.

Timer0 works ok but timer1 lose the first pulse and begin the count after it.

Anyone knows the reason?

here my setup counters

Code:

   setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);   // setup counter 1
   set_timer0(0);                                                       // Clear counter 1
   setup_timer_1(T1_EXTERNAL_SYNC);                     // setup counter 2
   set_timer1(0);                                                      // clear counter 2
epideath



Joined: 07 Jun 2006
Posts: 47

View user's profile Send private message

PostPosted: Sat Jul 22, 2006 10:51 pm     Reply with quote

Take a look at the errata PDF file here is a link to it

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en010296

It talks about just this problem.

It basically says that The Timer is expecting a falling edge before the first rising edge. It gives some example work arounds for the problem

Regards
Guest








PostPosted: Sun Jul 23, 2006 9:01 am     Reply with quote

Yes, the hardware has a bug.
I could solve it with a little code.

Thank you.


Code:

   output_high(pin_c0);
   output_low(pin_c0);
   if (input(pin_c0)) {};
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