|
|
View previous topic :: View next topic |
Author |
Message |
tblimeira Guest
|
Timer problem in CCS 4.065 |
Posted: Wed Jan 16, 2008 4:12 am |
|
|
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
|
|
Posted: Wed Jan 16, 2008 5:52 am |
|
|
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
|
|
Posted: Wed Jan 16, 2008 6:10 am |
|
|
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 |
|
|
|
|
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
|