setup_timer_0 and RTCC_8_BIT really required to work right?
Posted: Fri Mar 27, 2009 5:34 pm
I'm really sorry if this has been covered in other topics - I did search around briefly.
I'm on a 18F2620 w/ compiler version 4.030.
Is it really necessary to have RTCC_8_BIT in setup_timer_0()? I thought since the RTCC was only 8-bit on the 18F2620 (at least RTCC_16_BIT isn't in the chips .h file), that it would just default to that.
I was getting unexpected timings, and figured out it was off by a factor of about 250-ish. I tried inserting RTCC_8_BIT in setup_counter_0, and it works fine.
Any comments on this to understand it better would be appreciated.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Fri Mar 27, 2009 5:44 pm
Quote:
I thought since the RTCC was only 8-bit on the 18F2620
The 18F2620 data sheet says this:
Quote:
11.0 TIMER0 MODULE
• Software selectable operation as a timer or
counter in both 8-bit or 16-bit modes
REGISTER 11-1: T0CON: TIMER0 CONTROL REGISTER
bit 6 -- T08BIT: Timer0 8-Bit/16-Bit Control bit
1 = Timer0 is configured as an 8-bit timer/counter
0 = Timer0 is configured as a 16-bit timer/counter
[quote="PCM programmer"]
The 18F2620 data sheet says this:
Quote:
11.0 TIMER0 MODULE
• Software selectable operation as a timer or
counter in both 8-bit or 16-bit modes
Okay, lesson to be learned here: always check the datasheet. 18F2620.h (in 4.030 at least) doesn't have an option to set it up as 16 bit. It would be nice if one could assume that meant it didn't have that option.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Fri Mar 27, 2009 10:03 pm
Here are the constants for vs. 4.089. It's setup as a 16-bit timer if
you don't specify RTCC_8_BIT.
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