saramah
Member level 3
hi.
It is a tutorilas where timer2 of pic16f887 with 20MHZ x-tal is being used with following settings and remarks by author,
With the above by author,
For the case of //T2CONbits.T2CKPS = 1; >>
FOSC/4(20/4=5MHZ ==0.2US), PS=1, ie., 1:4(datasheet), So, 0.2*4=0.8usec, as PR2 is FF on every reset
and then TMR2 and PR2 match>> at 0.8*256=204.8 usec. Till here this is OK.
But for //T2CONbits.TOUTPS =4; >>
Author stating thet delay 2.048 msec (=204.8*10)
My question is >>
Why 'TOUTPS =4' ???
Its coming at '9' instead of '4' (as datasheet say 1:10 for the value of '9') to get 2.048 msesc delay
Then only FLAG OF TMR2 AT (10*204.8)=2.048 msec.
May be I am missing some other things, could you help me out...
tnx..
It is a tutorilas where timer2 of pic16f887 with 20MHZ x-tal is being used with following settings and remarks by author,
Code:
T2CONbits.TOUTPS =4; //postsacler is /10 so 204.8us * 10 to 2.048 ms
T2CONbits.T2CKPS = 1;
TMR2=0x0;
With the above by author,
For the case of //T2CONbits.T2CKPS = 1; >>
FOSC/4(20/4=5MHZ ==0.2US), PS=1, ie., 1:4(datasheet), So, 0.2*4=0.8usec, as PR2 is FF on every reset
and then TMR2 and PR2 match>> at 0.8*256=204.8 usec. Till here this is OK.
But for //T2CONbits.TOUTPS =4; >>
Author stating thet delay 2.048 msec (=204.8*10)
My question is >>
Why 'TOUTPS =4' ???
Its coming at '9' instead of '4' (as datasheet say 1:10 for the value of '9') to get 2.048 msesc delay
Then only FLAG OF TMR2 AT (10*204.8)=2.048 msec.
May be I am missing some other things, could you help me out...
tnx..