Error in PWM
Moderator: Benj
- tiny
- Posts: 200
- Joined: Wed Jul 08, 2009 8:29 am
- Has thanked: 51 times
- Been thanked: 93 times
- Contact:
Error in PWM
Hi Benj,
I have the version is 6.06 and today the updated version 6.07 for PIC, but the error is the same with PWM remained as in previous versions. Here is a screen shot of the error message and the test program.
I have the version is 6.06 and today the updated version 6.07 for PIC, but the error is the same with PWM remained as in previous versions. Here is a screen shot of the error message and the test program.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Error in PWM
Dear Tiny
Put never an interrupt in an endless while statement. That means place the eneable Timer1 interrupt BEFORE the while statement.
Succes
Jan Lichtenbelt
Put never an interrupt in an endless while statement. That means place the eneable Timer1 interrupt BEFORE the while statement.
Succes
Jan Lichtenbelt
- tiny
- Posts: 200
- Joined: Wed Jul 08, 2009 8:29 am
- Has thanked: 51 times
- Been thanked: 93 times
- Contact:
Re: Error in PWM
Dear Jan,
thank you for the hint, but this is not the problem. Enclosed a test routine with PWM and without timers. The fault appears also here. Either is the error in the PWM component or it is a simulation fault.
I hope somebody can help me, I need the PWM component.
thank you for the hint, but this is not the problem. Enclosed a test routine with PWM and without timers. The fault appears also here. Either is the error in the PWM component or it is a simulation fault.
I hope somebody can help me, I need the PWM component.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Error in PWM
PWM uses Timer2. It is not allowed to disable Timer2 in the TMR1 macro.
-Probably you mean disable Timer1. But that is also not allowed in the interrupt macro.
- Or you wll stop PWM. Use disable PWM.
Kind regards
Jan Lichtenbelt
-Probably you mean disable Timer1. But that is also not allowed in the interrupt macro.
- Or you wll stop PWM. Use disable PWM.
Kind regards
Jan Lichtenbelt
- tiny
- Posts: 200
- Joined: Wed Jul 08, 2009 8:29 am
- Has thanked: 51 times
- Been thanked: 93 times
- Contact:
Re: Error in PWM
Dear Jan,
I had accidentally reversed in the test file Timer1 Timer2, my mistake, I have now attached a file uses the PWM only with bit increment and without active timer control. The error occurs on completely independent of counter or timer control, and this error was not present in the Flowcode versions 4 and 5.
In my first post on this problem I had inserted the complete control that daily up to 8 hours running without problems for about 2 years. Programmed with Flowcode 4 and then 5.5.
View Topic
http://www.matrixmultimedia.com/mmforum ... 37#p57381
The error only occurs since Flowcode 6, whether or version 6.01 now 6.07.
Please for help.
I had accidentally reversed in the test file Timer1 Timer2, my mistake, I have now attached a file uses the PWM only with bit increment and without active timer control. The error occurs on completely independent of counter or timer control, and this error was not present in the Flowcode versions 4 and 5.
In my first post on this problem I had inserted the complete control that daily up to 8 hours running without problems for about 2 years. Programmed with Flowcode 4 and then 5.5.
View Topic
http://www.matrixmultimedia.com/mmforum ... 37#p57381
The error only occurs since Flowcode 6, whether or version 6.01 now 6.07.
Please for help.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: Error in PWM
I do not receive any error messages when I run your code in simulation on Win7.
Grant
Grant
- tiny
- Posts: 200
- Joined: Wed Jul 08, 2009 8:29 am
- Has thanked: 51 times
- Been thanked: 93 times
- Contact:
Re: Error in PWM
Thanks for the answers and the test. How long was the simulation going on? The fault appears and this regular with me at Counter no. 30 to 40. I have installed Flowcode 6 for me also on a Windows 7 32 bits version and this fault appears regularly also there.
Tiny
Tiny
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: Error in PWM
I am running on Win 7/64. I reduced the value of TMR_Max so that I would not be waiting all day and let the count run up to 145 before I stopped the simulation.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Error in PWM
Hi Tiny
Completely silly. At 34 simulation runs the program crashes. Ask Ben for help.
Kind regards
Jan Lichtenbelt
Completely silly. At 34 simulation runs the program crashes. Ask Ben for help.
Kind regards
Jan Lichtenbelt
- 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: Error in PWM
Hi Tiny,
Managed to replicate the issue. Will pass across to Jonny and see if anything jumps out.
Managed to replicate the issue. Will pass across to Jonny and see if anything jumps out.
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
- 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: Error in PWM
Hello,
Seems to be down to a bug in the PWM component itself when redrawing as part of a continuous loop with no delays.
Here is an updated component which limits the PWM redrawing to a max of 50Hz. Pop the file into your "Flowcode 6/Components" directory and restart Flowcode and hopefully the problem should disappear.
You should notice a significant speed increase when simulating your program thanks to the decreased amount of redraws.
Let me know how you get on.
Seems to be down to a bug in the PWM component itself when redrawing as part of a continuous loop with no delays.
Here is an updated component which limits the PWM redrawing to a max of 50Hz. Pop the file into your "Flowcode 6/Components" directory and restart Flowcode and hopefully the problem should disappear.
You should notice a significant speed increase when simulating your program thanks to the decreased amount of redraws.
Let me know how you get on.
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
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Error in PWM
Hi Ben,
I have a question. A PWM repetition frequency of 50 Hz sound nice, especially in the sample as given by Tiny.
But a PWM maco call (or in general any maco call) should be as short as possible. Let me explain what I mean.
If I have 2 PWM calls separated by program steps for about 30msec, the PWM call must not add additional delay time if not necessary. Is that fulfilled in the new PWM.fcpx file?
Kind regards
Jan Lichtenbelt
I have a question. A PWM repetition frequency of 50 Hz sound nice, especially in the sample as given by Tiny.
But a PWM maco call (or in general any maco call) should be as short as possible. Let me explain what I mean.
If I have 2 PWM calls separated by program steps for about 30msec, the PWM call must not add additional delay time if not necessary. Is that fulfilled in the new PWM.fcpx file?
Kind regards
Jan Lichtenbelt
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Error in PWM
Hi Jan,
I think Ben means the component will behave as before except for the simulation redraws. The PWM component was redrawing too often during simulation runs causing issues. So the underlying component has not changed, but the update on your screen during simulation will be at most 50 times a second. Ben, feel free to correct me if I'm wrong.
Jac
I think Ben means the component will behave as before except for the simulation redraws. The PWM component was redrawing too often during simulation runs causing issues. So the underlying component has not changed, but the update on your screen during simulation will be at most 50 times a second. Ben, feel free to correct me if I'm wrong.
Jac
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- 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: Error in PWM
Hello,
Kersing is correct, no additional delay just a max refresh on the simulation graphics to avoid a bottleneck.
Kersing is correct, no additional delay just a max refresh on the simulation graphics to avoid a bottleneck.
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