TMR1L = 0x00; // Used for 2 seond clock for RTC
TMR1H = 0x00; // External 32.768KHz crystal
T1CON = 0x4F;
while(!(TMR1H & 0x10)); // Wait a while for Timer 1 to start
// This is necessary due to bug in processor
// That can cause LCD not to start correctly
// if the timer isnt fully up and running
When pc goes in while condition TMR1L increments since I am using a clock stimulus. When TMR1L overflows there is no increment in TMR1H seen in Watch window. Am I missing something here?
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Sun Nov 30, 2008 3:10 pm
Go to the Timer1 section of the data sheet and read this section:
Quote:
Timer1 16-Bit Read/Write Mode
Ttelmah Guest
Posted: Sun Nov 30, 2008 3:11 pm
Haven't checked the data sheet for this chip, but it sounds like the 8/16 bit access behaviour. Basically if 16bit access is enabled, TMR1H, will _only_ update, when TMR1L is read. This is done to ensure that both accesses take place in one clock cycle. The debugger probably does not actually trigger the chip to perform a read.
Best Wishes
BlueTower
Joined: 23 Oct 2008 Posts: 29
Posted: Mon Dec 01, 2008 6:08 am
Thanks my friend. The best way to do it in order debugging to work as well for Timer1 & Timer3 is enable 8 bit read/write and use the get_timer1(), get_timer3() function. This way all 16 bits will be updated!!!
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