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

16 bit timers

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



Joined: 15 Sep 2003
Posts: 34

View user's profile Send private message

16 bit timers
PostPosted: Wed Sep 22, 2004 4:00 pm     Reply with quote

has anyone had trouble with PIC18 16 bit timers?

my colleague has a problem which looks like a roll over from low byte to high byte of a timer. The PIC data sheet says that the timer can be treated as 16bit, the high byte being buffered. From the list file, CCS is doing everything correctly, but it seems as if there is a hardware problem.

Anyone had similar problems?
bdavis



Joined: 31 May 2004
Posts: 86
Location: Colorado Springs, CO

View user's profile Send private message

PostPosted: Wed Sep 22, 2004 6:39 pm     Reply with quote

I use it without any issues...
When writing the timer, write the high value, then the low value.
When reading the timer, you need to do it in a certian order also, or use CCS's built in functions.

You could ask your friend to test it outside of any interrupt routine to simplify things (ie: polling). After that is working then try interrupts...
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Sep 22, 2004 10:06 pm     Reply with quote

Quote:
When reading the timer, you need to do it in a certian order also

If memory serves me correctly, the high byte is buffered when the low byte is read.

Quote:
When writing the timer, write the high value, then the low value


I would clear the low byte first, then write the high byte and then the low byte. This would prevent the possibility of the low byte rolling over and incrementing the high byte.
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