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

Lowest freq. with timer2

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



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

Lowest freq. with timer2
PostPosted: Mon Aug 20, 2007 12:12 pm     Reply with quote

Give this code the lowest freq for times 2?

Code:

#include <18F4620.h>
#use delay(clock=20000000)
#fuses HS,NOWDT,NOBROWNOUT,NOPUT,NOLVP,DEBUG,NOSTVREN,NOPROTECT

#int_TIMER2
void TIMER2_isr() {
   output_toggle(PIN_C1);
}

void main() {
   setup_timer_2(T2_DIV_BY_16,249,16);
   enable_interrupts(INT_TIMER2);
   enable_interrupts(GLOBAL);
      
   while(TRUE);   
}
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Aug 20, 2007 1:03 pm     Reply with quote

setup_timer_2(T2_DIV_BY_16,255,16);

Should give an interrupt every 13.1ms (@20Mhz xtal clock)



Humberto
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