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

Timer problem in CCS 4.065

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







Timer problem in CCS 4.065
PostPosted: Wed Jan 16, 2008 4:12 am     Reply with quote

Hello there

It seems that the interruption are not working correctly in CCS version 4.065. Here's the test I was using with pic 18F242, Setup_Timer_1(T1_Internal|T1_div_By_8) command is not working, I changing T1_div_By_X number, and instead of having different time interruption, I'm getting the same time. Does anyone got this problem?

Thanks in advance



Code:
#include <18F242.h>


short bt;

#INT_Timer1
void T1()
{
 bt = !bt;
 OutPut_bit(Pin_b0, Bt);
}


void main()
{
 enable_interrupts(INT_TIMER1);
 enable_interrupts(Global);
 Setup_Timer_1(T1_Internal|T1_div_By_8);
 
while(1);
}
karlo



Joined: 07 Jan 2008
Posts: 10

View user's profile Send private message Send e-mail

PostPosted: Wed Jan 16, 2008 5:52 am     Reply with quote

I wound prefer to change your code in the interrupt routine
Code:

#byte PORT_B = 0x06

#INT_Timer1
void T1()
{
Output_toggle(PORT_B,0) ;
}
Ttelmah
Guest







PostPosted: Wed Jan 16, 2008 6:10 am     Reply with quote

Actually, what he is doing, is 'better', if there is significant loading on the pin, so it might not actually be 'seen' as having the right logic level. Do a search on the 'RMW' problem on the PIC, and the suggested cures (of which this is one).
I have tried the posted code, on 4.059, and 4.066, and on both it works correctly, giving the expected timings as you change the divider.
Double check that you are pulling the 18F242.h from the compiler directory, not some 'local' copy, that has perhaps got the wrong defines for the timer setup.

Best Wishes
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