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

timer1 using for count

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







timer1 using for count
PostPosted: Thu Jun 23, 2005 3:51 pm     Reply with quote

when the ext1=1 , timer 1 must run and when timer1 is full ,rb7 is on. but as soon as the ext1=1 rb7 is on why ? i dont understand. because timer must wait 12.5 ms but it dont wait.
what is wrong?




#int_timer1
void tmr1_isr()

{
output_bit( PIN_B7, 1);
disable_interrupts(INT_TIMER1);
}

#int_ext1
void rb1_isr()
{
set_timer1(45000);
enable_interrupts(INT_TIMER1);
}


these are main's code samples about timer1

setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_1|T1_DISABLED );
enable_interrupts(INT_TIMER1);
enable_interrupts(global);
enable_interrupts(int_ext);
enable_interrupts(int_ext1);

set_tris_d(0x00);
set_tris_b(0b00000011);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 23, 2005 5:03 pm     Reply with quote

I don't see that Timer1 is enabled. Here, you have disabled it:

setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_1 | T1_DISABLED );
Guest








PostPosted: Fri Jun 24, 2005 2:26 am     Reply with quote

sorry i write wrong
i am correcting
#int_timer1
void tmr1_isr()

{
output_bit( PIN_B7, 1);
disable_interrupts(INT_TIMER1);
}

#int_ext1
void rb1_isr()
{
set_timer1(45000);
enable_interrupts(INT_TIMER1);
}


these are main's code samples about timer1

setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_1 );
disable_interrupts(INT_TIMER1);
enable_interrupts(global);
enable_interrupts(int_ext);
enable_interrupts(int_ext1);

set_tris_d(0x00);
set_tris_b(0b00000011);
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