Timer0 interrupt
Moderator: Benj
-
- Posts: 48
- Joined: Mon Apr 07, 2008 9:18 pm
- Has thanked: 23 times
- Been thanked: 8 times
- Contact:
Timer0 interrupt
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
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
Better safe then sorry
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Timer0 interrupt
Hi No need to search the internet just read the Flowcode wiki manual 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 itncc1502 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?
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer0 interrupt
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.
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;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer0 interrupt
I have to fully agree with Ben on this.Benj wrote:Timer 2 is often a lot more configurable and has a programmable count register which can be conifgured in Flowcode.
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
-
- Posts: 48
- Joined: Mon Apr 07, 2008 9:18 pm
- Has thanked: 23 times
- Been thanked: 8 times
- Contact:
Re: Timer0 interrupt
Medelec,
thank you for your tip about the timer 2 program, it is verry usefull.
thank you for your tip about the timer 2 program, it is verry usefull.
Better safe then sorry
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer0 interrupt
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.
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
-
- Posts: 48
- Joined: Mon Apr 07, 2008 9:18 pm
- Has thanked: 23 times
- Been thanked: 8 times
- Contact:
Re: Timer0 interrupt
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?
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?
Better safe then sorry
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer0 interrupt
I'm not the best on this so maybe you will receive a better answer.ncc1502 wrote:Is it possible to synchonise timer2 with an event like interupt on port B pin 0 change?
What you can to within the port B change interrupt is clear timer2 High and low registers.
Timer 2 keeps running forever at the Prescaler, postscaler and rollover settings entered.ncc1502 wrote:Does timer2 keep running after the interupt of do I have to relaod the settings after each interupt?
Martin
-
- Posts: 17
- Joined: Thu Apr 30, 2020 7:43 pm
- Has thanked: 15 times
- Been thanked: 3 times
- Contact:
Re: Timer0 interrupt
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)
PS : I use flowcode v8.2.2.15 (2020-02-28)
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)
Flowcode v8.2.2.15 (2020-02-28)
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Timer0 interrupt
It's nothing to do with Flowcode, its to do with the pic architecture.DeeJayOne wrote:m asking why TMR2 has an available rollover value and NOT TMR0 in Flowcode.
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
-
- Posts: 17
- Joined: Thu Apr 30, 2020 7:43 pm
- Has thanked: 15 times
- Been thanked: 3 times
- Contact:
Re: Timer0 interrupt
Thanks for your advicemedelec35 wrote:It's nothing to do with Flowcode, its to do with the pic architecture.DeeJayOne wrote:m asking why TMR2 has an available rollover value and NOT TMR0 in Flowcode.
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.
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)
Flowcode v8.2.2.15 (2020-02-28)