I want to use 18F452 with Timer0 , Timer0 interrupt , and external transition on RA4/TOCKI without prescaler .
But in GCBasic , with "initTimer0" it's not possible because minimal prescale selection is "initTimer0 ext,PS_2" !!
Can I write: "TOCON.3=1 " to correct that ?
In GCBasic Help ,it's written that Timer0 overflow after 256 impulses . But with 18F452 I'll want to use 16 bits mode . Can I also write "T0CON.6=0" and read the timer0 value in TMR0H and TMROL ? Will Timer0 overflow after 65535 ?
Thanks
GC
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
At first glance it looks like timer.h library doesn't handle 16 bit mode for TMR0 either, so setting up TMR0 manually looks like the way to go.
Should be able to write and read to TMR0H and TMR0L registers, although reading TMR0L first is a good idea. Now do you reverse that order when writing? I am not clear.
I like using the whole register on initialization T0CON = b'00101000', then toggling the bit names when appropriate like
TMR0ON = 1.
Yes, the TMR0IF flag should interrupt on the 16 bit overflow value in TMR00L and TMR0H.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Kent . Your answer is very clear and I discover that I had sometimes erratic results because I didn't always read first TMR0L or TMR1L !
Thanks again
GC
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want to use 18F452 with Timer0 , Timer0 interrupt , and external transition on RA4/TOCKI without prescaler .
But in GCBasic , with "initTimer0" it's not possible because minimal prescale selection is "initTimer0 ext,PS_2" !!
Can I write: "TOCON.3=1 " to correct that ?
In GCBasic Help ,it's written that Timer0 overflow after 256 impulses . But with 18F452 I'll want to use 16 bits mode . Can I also write "T0CON.6=0" and read the timer0 value in TMR0H and TMROL ? Will Timer0 overflow after 65535 ?
Thanks
GC
At first glance it looks like timer.h library doesn't handle 16 bit mode for TMR0 either, so setting up TMR0 manually looks like the way to go.
Should be able to write and read to TMR0H and TMR0L registers, although reading TMR0L first is a good idea. Now do you reverse that order when writing? I am not clear.
I like using the whole register on initialization T0CON = b'00101000', then toggling the bit names when appropriate like
TMR0ON = 1.
Yes, the TMR0IF flag should interrupt on the 16 bit overflow value in TMR00L and TMR0H.
Thanks Kent . Your answer is very clear and I discover that I had sometimes erratic results because I didn't always read first TMR0L or TMR1L !
Thanks again
GC