Page 1 of 1

Timer0 interrupt

Posted: Mon Feb 04, 2019 12:55 am
by ncc1502
I have searched the forum but could not find an answer.

I wat to use timer0 interupt.

On the internet there are some programs where you can calculate the values (prescaler and offset) to get the desired frequency/time

In properties of timer0 interrupt you can set the prescaler rate, how do you program the offset into TMR0 (in Flowcode6)
Is this a one time setting or do I have to set this value each time the interrupt activates?


Is it possible to enable/disable the timer0 interupt from code and how is this done?

Thanks for your help

Re: Timer0 interrupt

Posted: Mon Feb 04, 2019 8:18 am
by QMESAR
ncc1502 wrote:I have searched the forum but could not find an answer.

I wat to use timer0 interupt.

On the internet there are some programs where you can calculate the values (prescaler and offset) to get the desired frequency/time

In properties of timer0 interrupt you can set the prescaler rate, how do you program the offset into TMR0 (in Flowcode6)
Is this a one time setting or do I have to set this value each time the interrupt activates?


Is it possible to enable/disable the timer0 interupt from code and how is this done?
Hi No need to search the internet just read the Flowcode wiki manual :D :D section Interrupts and you will see by using custom interrupt option in the Interrupt configuration popup you can write your C code to configure the Timer as you need it

Re: Timer0 interrupt

Posted: Mon Feb 04, 2019 11:19 am
by Benj
Hello,

Timer 2 is often a lot more configurable and has a programmable count register which can be conifgured in Flowcode.

Programming offsets with other timers can be done by loading the timer count register with a value inside the interrupt macro using a C code icon.

e.g.

Code: Select all

TMR0 = 128;

Re: Timer0 interrupt

Posted: Tue Feb 05, 2019 6:12 pm
by medelec35
Benj wrote:Timer 2 is often a lot more configurable and has a programmable count register which can be conifgured in Flowcode.
I have to fully agree with Ben on this.
Take a look here for a grat app that allows you to set timer 2 with correct settings for precise timing periods.
So much better than 8bit timer 0!

Re: Timer0 interrupt

Posted: Thu Feb 07, 2019 10:53 pm
by ncc1502
Medelec,
thank you for your tip about the timer 2 program, it is verry usefull.

Re: Timer0 interrupt

Posted: Thu Feb 07, 2019 10:59 pm
by medelec35
Hi,
Your welcome.
I always have more selected.
Has not let me down.
I find preloading timer 0 with a calculated value, rarely works on hardware as expected.

Re: Timer0 interrupt

Posted: Thu Feb 07, 2019 11:10 pm
by ncc1502
Is it possible to synchonise timer2 with an event like interupt on port B pin 0 change? or can I start the interupt timer at that moment?

I have to do some actions which have to happen within certain time window and waiting for the next timer interupt and start then could be too late.

Does timer2 keep running after the interupt of do I have to relaod the settings after each interupt?

Re: Timer0 interrupt

Posted: Thu Feb 07, 2019 11:24 pm
by medelec35
ncc1502 wrote:Is it possible to synchonise timer2 with an event like interupt on port B pin 0 change?
I'm not the best on this so maybe you will receive a better answer.
What you can to within the port B change interrupt is clear timer2 High and low registers.
ncc1502 wrote:Does timer2 keep running after the interupt of do I have to relaod the settings after each interupt?
Timer 2 keeps running forever at the Prescaler, postscaler and rollover settings entered.

Re: Timer0 interrupt

Posted: Fri Feb 08, 2019 12:37 pm
by QMESAR
sorry wrong place posted

Re: Timer0 interrupt

Posted: Fri May 01, 2020 2:33 pm
by DeeJayOne
I'm using a PIC10F322 and I'm asking why TMR2 has an available rollover value and NOT TMR0 in Flowcode.

PS : I use flowcode v8.2.2.15 (2020-02-28)

Re: Timer0 interrupt

Posted: Fri May 01, 2020 2:51 pm
by medelec35
DeeJayOne wrote:m asking why TMR2 has an available rollover value and NOT TMR0 in Flowcode.
It's nothing to do with Flowcode, its to do with the pic architecture.
On your target device, Timer 2 has a period register (PR2) and timer 0 does not.
I would not recommend using PIC10F322, it has such a small amount of memory, you will struggle to get it to do much.
In my opinion, the lower capacity devices e.g.10F series are more for production items that has used assembly language to program them.
If I wanted to use an 8 pin device, then I use PIC12F1840.

Re: Timer0 interrupt

Posted: Fri May 01, 2020 3:02 pm
by DeeJayOne
medelec35 wrote:
DeeJayOne wrote:m asking why TMR2 has an available rollover value and NOT TMR0 in Flowcode.
It's nothing to do with Flowcode, its to do with the pic architecture.
On your target device, Timer 2 has a period register (PR2) and timer 0 does not.
I would not recommend using PIC10F322, it has such a small amount of memory, you will struggle to get it to do much.
In my opinion, the lower capacity devices e.g.10F series are more for production items that has used assembly language to program them.
If I wanted to use an 8 pin device, then I use PIC12F1840.
Thanks for your advice :)
In some simple specific applications the PIC10F322 can make the job !
PIC12F1840 has a lot of features, this is probably actually one of the best 8-bit PIC device.