Timer0 interrupt

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

Moderator: Benj

ncc1502
Posts: 42
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 18 times
Been thanked: 7 times
Contact:

Timer0 interrupt

Postby ncc1502 » Mon Feb 04, 2019 12:55 am

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: 1172
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 372 times
Been thanked: 593 times
Contact:

Re: Timer0 interrupt

Postby QMESAR » Mon Feb 04, 2019 8:18 am

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
These users thanked the author QMESAR for the post:
ncc1502 (Wed Feb 06, 2019 11:40 pm)
Rating: 5.26%
 

User avatar
Benj
Matrix Staff
Posts: 14468
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: Timer0 interrupt

Postby Benj » Mon Feb 04, 2019 11:19 am

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;
These users thanked the author Benj for the post (total 2):
electron67 (Mon Feb 04, 2019 5:31 pm) • ncc1502 (Wed Feb 06, 2019 11:40 pm)
Rating: 10.53%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8485
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2441 times
Been thanked: 3500 times
Contact:

Re: Timer0 interrupt

Postby medelec35 » Tue Feb 05, 2019 6:12 pm

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!
These users thanked the author medelec35 for the post (total 2):
ncc1502 (Wed Feb 06, 2019 11:40 pm) • electron67 (Fri Feb 08, 2019 5:57 pm)
Rating: 10.53%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

ncc1502
Posts: 42
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 18 times
Been thanked: 7 times
Contact:

Re: Timer0 interrupt

Postby ncc1502 » Thu Feb 07, 2019 10:53 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8485
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2441 times
Been thanked: 3500 times
Contact:

Re: Timer0 interrupt

Postby medelec35 » Thu Feb 07, 2019 10:59 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

ncc1502
Posts: 42
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 18 times
Been thanked: 7 times
Contact:

Re: Timer0 interrupt

Postby ncc1502 » Thu Feb 07, 2019 11:10 pm

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: 8485
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2441 times
Been thanked: 3500 times
Contact:

Re: Timer0 interrupt

Postby medelec35 » Thu Feb 07, 2019 11:24 pm

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.
These users thanked the author medelec35 for the post:
ncc1502 (Fri Feb 08, 2019 12:05 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1172
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 372 times
Been thanked: 593 times
Contact:

Re: Timer0 interrupt

Postby QMESAR » Fri Feb 08, 2019 12:37 pm

sorry wrong place posted