Timer0 interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
ncc1502
Posts: 43
Joined: Mon Apr 07, 2008 9:18 pm
Contact:

Timer0 interrupt

Post 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

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1200
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: Timer0 interrupt

Post 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

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Timer0 interrupt

Post 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;

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9014
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Timer0 interrupt

Post 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!
Martin

ncc1502
Posts: 43
Joined: Mon Apr 07, 2008 9:18 pm
Contact:

Re: Timer0 interrupt

Post by ncc1502 »

Medelec,
thank you for your tip about the timer 2 program, it is verry usefull.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9014
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Timer0 interrupt

Post 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.
Martin

ncc1502
Posts: 43
Joined: Mon Apr 07, 2008 9:18 pm
Contact:

Re: Timer0 interrupt

Post 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?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9014
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Timer0 interrupt

Post 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.
Martin

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1200
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: Timer0 interrupt

Post by QMESAR »

sorry wrong place posted

DeeJayOne
Posts: 17
Joined: Thu Apr 30, 2020 7:43 pm
Contact:

Re: Timer0 interrupt

Post 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)
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9014
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Timer0 interrupt

Post 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.
Martin

DeeJayOne
Posts: 17
Joined: Thu Apr 30, 2020 7:43 pm
Contact:

Re: Timer0 interrupt

Post 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.
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)

Post Reply