PIC18452, why TMR0L is not counting up

Beta Testing discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
AustinCann
Posts: 10
Joined: 09 Jan 2011 09:13

PIC18452, why TMR0L is not counting up

#1 Post by AustinCann » 10 Feb 2011 21:55

Hello there. I am new with timers and I want to see timer0 overflowing and the value of TMR0L counting up. I got the code ready but not sure what I am missing. My code is below. Please help !


void main() {


TRISA = 0x00; // set direction to be output
TRISB = 0x00; // set direction to be output
TRISC = 0x00; // set direction to be output
TRISD = 0x00; // set direction to be output
T0CON.B7=1;
TMR0L=250;
T0CON.B6=1;
T0CON.B5=0;
T0CON.B3=1;
INTCON.B5=0;
while(INTCON.B2==0);
{
PORTA = 0x00; // Turn OFF LEDs on PORTA
PORTB = 0x00; // Turn OFF LEDs on PORTB
PORTC = 0x00; // Turn OFF LEDs on PORTC
PORTD = 0x00; // Turn OFF LEDs on PORTD
delay_ms(1000);
PORTA = 0xFF; // Turn ON LEDs on PORTA
PORTB = 0xFF; // Turn ON LEDs on PORTB
PORTC = 0xFF; // Turn ON LEDs on PORTC
PORTD = 0xFF; // Turn ON LEDs on PORTD
}
TMR0L=250;
INTCON.B2==0;
}

p.erasmus
Posts: 3391
Joined: 05 Mar 2009 10:28

Re: PIC18452, why TMR0L is not counting up

#2 Post by p.erasmus » 10 Feb 2011 21:57

What has this topic to do with PIC32 Compiler Beta Testing??
P.Erasmus
Saratov,Russia
--------------------------------------------------------------

AustinCann
Posts: 10
Joined: 09 Jan 2011 09:13

Re: PIC18452, why TMR0L is not counting up

#3 Post by AustinCann » 11 Feb 2011 06:20

Dude this was a mistake. Sorry for inconvenience
But I am feeling down for not being successful in making the TMR0 working. Please help

My code should be working as under.
The main should start with initial value of 250 for TMR0L as long as INTCON.B2 TMR0IF is not set as 1. The TMR0L value should increase upto 255 and then overflow and start again from zero. After main() it should be again set to 255 and the last instruction clears the overflow flag.

Frustratingly I cant see TMR0L value increasing in this case

Post Reply

Return to “mikroC PRO for PIC32 Beta Testing”