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 support@ccsinfo.com

how to generate 100ms timer interrupt on 16f877

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



Joined: 18 Dec 2006
Posts: 20
Location: europe (Turkey)

View user's profile Send private message

how to generate 100ms timer interrupt on 16f877
PostPosted: Mon Dec 18, 2006 6:48 pm     Reply with quote

hi everybody

i need to generate a timer interrupt for 100ms in 16f877
although i search all datasheets and ccs help files and example codes, i cant find for a sensetive timer

i need this for a mobile robot's remote control unit.
i must to use a timer interrupt and in this interrupt i start a adc convertion that causes a secont interrupt (int_RA) to send converted data. sending operation takes approximately 65ms because of hardware. and for security i musnt use interrupt shorter than 65ms so i need 100ms timer int.

rnome
thanks everybody
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Mon Dec 18, 2006 8:27 pm     Reply with quote

This post will teach you how to do it: http://www.ccsinfo.com/forum/viewtopic.php?t=22467
rnome



Joined: 18 Dec 2006
Posts: 20
Location: europe (Turkey)

View user's profile Send private message

PostPosted: Mon Dec 18, 2006 8:30 pm     Reply with quote

i read that topic but it cant help me to solve my problem cuz with timer0 i can generate max 65ms timer
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 18, 2006 8:31 pm     Reply with quote

Post your crystal frequency. That will help us to find a solution.
rnome



Joined: 18 Dec 2006
Posts: 20
Location: europe (Turkey)

View user's profile Send private message

PostPosted: Mon Dec 18, 2006 8:33 pm     Reply with quote

sorry i forget to tell about my cristall

i ll use 4mhz cristal.

thanks for reply
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Mon Dec 18, 2006 10:02 pm     Reply with quote

Use timer 1 - it's a 16 bit timer. With the div by 2 prescaler, it will naturally overflow (interrupt) every 2 us x 65,536 = 131.072 ms.

I'm leaving it up to you to figure out what to set timer 1 to in order to get an exact 100 ms interval.
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