SilverWingz
New Member
Using the microchip's CDC basic demo.(18F4550)
Here,when i try to feed any value to the TMR0L and TMR0H registers,
not changes occurs in the o/p frequency whatsoever...just gives one fixed freq. for 8 bit mode and another for 16 bit mode irrespective to the values set in TMR0L and TMR0H...
Here's my code...can any1 take a looksie and point it out if i am making any obvious mistakes,please?
CODE WITHIN "ProcessIO"
Code within "YourLowPriorityISRCode"
Thanks
Here,when i try to feed any value to the TMR0L and TMR0H registers,
not changes occurs in the o/p frequency whatsoever...just gives one fixed freq. for 8 bit mode and another for 16 bit mode irrespective to the values set in TMR0L and TMR0H...
Here's my code...can any1 take a looksie and point it out if i am making any obvious mistakes,please?
CODE WITHIN "ProcessIO"
Code:
TRISC = 0 ;
PORTC = 0b00000001;
TMR0H=0x00;TMR0L=0x09;//changing these values does nothing whatsoever
T0CONbits.T0CS = 0;
T0CONbits.PSA = 0;
T0CONbits.T0PS0 = 0;
T0CONbits.T0PS1 = 0;
T0CONbits.T0PS2 = 0;
T0CONbits.T08BIT=1;
INTCONbits.TMR0IF = 0;
T0CONbits.TMR0ON = 1;
TRISCbits.TRISC0=0;
PORTCbits.RC0=0;
INTCONbits.GIE = 1;
INTCONbits.TMR0IE=1;
INTCONbits.PEIE =1;
RCONbits.IPEN = 1; //Enable priority levels on interrupts
RCONbits.SBOREN = 0;
INTCON2bits.TMR0IP =0; //Set interrupt priority as low
Code within "YourLowPriorityISRCode"
Code:
if(INTCONbits.TMR0IF==1)
{
count++;
if(count==2)
{
count=0;
PORTCbits.RC0=~PORTCbits.RC0;
}
INTCONbits.TMR0IF = 0;
}
Thanks
Last edited: