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

PIC16f88 external clock for timer1

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



Joined: 05 Jan 2012
Posts: 7

View user's profile Send private message

PIC16f88 external clock for timer1
PostPosted: Thu Jan 12, 2012 5:46 am     Reply with quote

Hi to all,
i'm using PIC16f88 with external 20M oscillator.
So i've set up:
Code:
#FUSES HS


Now i need to use timer1 to get an interrupt every 25ms:
Code:
setup_timer_1(T1_EXTERNAL | T1_DIV_BY_8);
set_timer1(3036);
enable_interrupts(INT_TIMER1);
enable_interrupts(global);
....
#INT_TIMER1
void TIMER1_ISR()
{
 ...
}


But interrupt handler is NEVER executed, why?
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 12, 2012 6:31 am     Reply with quote

...
setup_timer_1(T1_EXTERNAL | T1_DIV_BY_8);


You've got the timer setup with an EXTERNAL clock source but I'll bet you do not have a crystal and caps on the ext osc pins.

The 20MHz xtal you show is the primary( or main) clock for the PIC.

If you look read the datasheet you'll hvae some options. One, would be to add the xtal/caps to the ext osc pins another would be to use the T1_INTERNAL option to use the main clock( 20 MHz).

this is my guess.
ancient_one



Joined: 05 Jan 2012
Posts: 7

View user's profile Send private message

PostPosted: Thu Jan 12, 2012 8:20 am     Reply with quote

Sure i've got a 20M oscillator with two 22pF capacitor in OSC1-OSC2 pins
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Jan 12, 2012 5:03 pm     Reply with quote

Did you probe the drive side of TMR1 osc
to see waveform on SCOPE and counter ???
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