HI team!
I have to add some function in my old program to my Grasmower buld in FC8 which work. If I add an Interrupt IOT or timer interrupt all the PWM and delay´s are not correct any more.
In the att. program I try to add the timer and the IOT (pin) interrupt only to show what I do. Of course I know I can´t use both.
Help please.
Br Jorgen
Interrup Delay and PWM Arduino Mega!
Moderator: Benj
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Interrup Delay and PWM Arduino Mega!
- Attachments
-
- GrasmoverSelectra Interrupt.fcfx
- (79.95 KiB) Downloaded 114 times
-
- 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: Interrup Delay and PWM Arduino Mega!
Hi Jorgen,
If you select the properties of the PWM component's you will see that they use Timer0 only(Channel0) or timer1 if using channel2.
Note you have not got a timer selected for the PWM on the far right.
Why don't you use one of the other timers available for your interrupt?
E.g 1,2,3 Etc?
If you select the properties of the PWM component's you will see that they use Timer0 only(Channel0) or timer1 if using channel2.
Note you have not got a timer selected for the PWM on the far right.
Why don't you use one of the other timers available for your interrupt?
E.g 1,2,3 Etc?
Martin
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Interrup Delay and PWM Arduino Mega!
Hi Martin!
Ok Martin, why had I not thought of that. I did not think at all about the PWM use timers and I will of course try some of the other timers.
Thanks again
And concerning the MCP9600 I still wait for the component, look forward to test it.
Nice weekend.
Br jorgen.
Ok Martin, why had I not thought of that. I did not think at all about the PWM use timers and I will of course try some of the other timers.
Thanks again
And concerning the MCP9600 I still wait for the component, look forward to test it.
Nice weekend.
Br jorgen.
-
- 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: Interrup Delay and PWM Arduino Mega!
Hi, Jorgen.
Hopefully, my suggestion works for you.
A for MCP9600, it will only be available for FC9 and onwards.
I will be interested to know if it works ok for you.
Thanks, you have a good weekend too.
Hopefully, my suggestion works for you.
A for MCP9600, it will only be available for FC9 and onwards.
I will be interested to know if it works ok for you.
Thanks, you have a good weekend too.
Martin
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Interrup Delay and PWM Arduino Mega!
Hi Martin!
As you see in my program I have 3 PWM, is it ok use same timer ect timer 0 for these and if I use timer interrupt then use other timers for this or do you recomend 3 different for the PWM?
Thank´s in advance.
Br Jorgen
As you see in my program I have 3 PWM, is it ok use same timer ect timer 0 for these and if I use timer interrupt then use other timers for this or do you recomend 3 different for the PWM?
Thank´s in advance.
Br Jorgen
-
- 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: Interrup Delay and PWM Arduino Mega!
Hi Jorgen.
You can use the same timer for both the interrupt and two PWM channels.
However, where you are going wrong is when using the same timer for PWM and interrupt, the Prescaler must match timer interrupt and PWM's
E.g Timer0 prescaler = 256, then channel1 & Channel2 PWM prescaler must be 256.
If the timer interrupt has to be a different frequency to PWM, then choose a different timer interrupt.
You can use the same timer for both the interrupt and two PWM channels.
However, where you are going wrong is when using the same timer for PWM and interrupt, the Prescaler must match timer interrupt and PWM's
E.g Timer0 prescaler = 256, then channel1 & Channel2 PWM prescaler must be 256.
If the timer interrupt has to be a different frequency to PWM, then choose a different timer interrupt.
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Interrup Delay and PWM Arduino Mega!
Hi Martin!
Thank you very much for your explanation, I will follow this
By the way, your MCP 6900 component working very well in FC9
Thank´s Jorgen
Thank you very much for your explanation, I will follow this
By the way, your MCP 6900 component working very well in FC9
Thank´s Jorgen
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact: