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

dspic timer 1 problem

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



Joined: 22 Aug 2010
Posts: 43

View user's profile Send private message

dspic timer 1 problem
PostPosted: Thu May 05, 2011 3:34 am     Reply with quote

Hello..
Its the first i use timers, and i was testing a program which makes interrupt after timer overflow and send character to serial port.

When i used External clock source for timer configuration the timer is not working while using internal clock source in timer configuration the timer works.

This is the code(am using dspic30f4012):

Code:
#include <30f4012.h>
#device *=16 //16 bits pointer
#fuses XT_PLL8,NOWDT,NOPUT,PR
#device ADC=10
#use delay(clock=80MHZ)
#use rs232(baud=9600,parity=N,xmit=PIN_C13,rcv=PIN_C14,bits=8)


void main()
{
   setup_uart(9600);
   delay_ms(100);
putc('k');
   ENABLE_INTERRUPTS(INTR_GLOBAL );
SETUP_TIMER1(T1_EXTERNAL_SYNC| TMR_DIV_BY_8);
SET_TIMER1(0);
ENABLE_INTERRUPTS(INT_TIMER1);
while(1);

}

#INT_TIMER1
void inter_timer1()
{
   putc('h');
SET_TIMER1(0);
}




What can be done in order for the timer to work with the external clock?
The second question if i used the internal clock for the timer, the whole program will still work on the external oscillator clock right?
Thanks
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