V5 for AVR: PWM does not work
Moderator: Benj
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
V5 for AVR: PWM does not work
Hi,
As I have (yet) no access to the V5 forum, I place this contribution here and hope somebody will move it to V5 and give me access. Thank you.
I have already mailed my issue some time ago. I just experience the PWM-function. Simulation shows correct function but download to chip leads to following
failure message:
File name: E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme\FanPWM.c
Title:
Description:
Generated by: Flowcode v5.3.0.0
Date: Thursday, July 19, 2012 23:08:47
Licence: Professional
Registered to: Gerhard Steuerwald
Licence key: Q9XMDC
http://www.matrixmultimedia.com
Start des Compilers...
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avra.bat atmega32 "E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\Fan PWM.c" "E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.lst"
E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme>"C:\PROGRA~1\FLOWCO~1\v5\Tools\MX_bats\..\bin\avr-gcc.exe"-mmcu=atmega32 -Os -funsigned-char -o "E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\Fan PWM.c" -lm
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:227,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.c:481:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:101:5: warning:#warning "PWM Channel Uses Resource Timer 0"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:227,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.c:481:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Enable_Channel_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: 'COM0A0'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: (Eachundeclared identifier is reported only once
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: foreach function it appears in.)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:676: error: 'COM0A1'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Disable_Channel_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:702: error: 'COM0A1'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_8Bit_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:845: error: 'OCR0A'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_10Bit_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c error: 'OCR0A'undeclared (first use in this function)
Error returned from [avr-gcc.exe]
Rückgabewert = 1
Flowcode konnte den C-Code des Flussdiagramms nicht kompilieren, da folgendeFehler auftraten:
Wenn Ihr Flussdiagramm C-Code enthält,überprüfen Sie diesen sorgfältig.Falls das Flussdiagramm keinen C-Code enthält oder Sie sich sicher seinkönnen, dass dieser Code fehlerfrei ist, dann wenden Sie sich an den technischenSupport.
BEENDET
Now I got already help by mail from Steve Tandy who proposed a workaround with the following code into the top box of the "supplementary code"feature (via the "project options" window):
#define COM0A0 COM00
#define COM0A1 COM01
#define OCR0A OCR0
This was successful regarding download to chip. Download to chip is now possible without errors but I cannot achieve the(hardware) PWM-output signal on PD5 (with PWM(0)). I also tried PD4 withPWM(1), no success.
Do you have a further idea to make the PWM function work on the controller?
Best regards and thanks in advance.
Gerhard
As I have (yet) no access to the V5 forum, I place this contribution here and hope somebody will move it to V5 and give me access. Thank you.
I have already mailed my issue some time ago. I just experience the PWM-function. Simulation shows correct function but download to chip leads to following
failure message:
File name: E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme\FanPWM.c
Title:
Description:
Generated by: Flowcode v5.3.0.0
Date: Thursday, July 19, 2012 23:08:47
Licence: Professional
Registered to: Gerhard Steuerwald
Licence key: Q9XMDC
http://www.matrixmultimedia.com
Start des Compilers...
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avra.bat atmega32 "E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\Fan PWM.c" "E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.lst"
E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme>"C:\PROGRA~1\FLOWCO~1\v5\Tools\MX_bats\..\bin\avr-gcc.exe"-mmcu=atmega32 -Os -funsigned-char -o "E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\Fan PWM.c" -lm
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:227,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.c:481:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:101:5: warning:#warning "PWM Channel Uses Resource Timer 0"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:227,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\FanPWM.c:481:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Enable_Channel_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: 'COM0A0'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: (Eachundeclared identifier is reported only once
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: foreach function it appears in.)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:676: error: 'COM0A1'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Disable_Channel_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:702: error: 'COM0A1'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_8Bit_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:845: error: 'OCR0A'undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_10Bit_1':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c error: 'OCR0A'undeclared (first use in this function)
Error returned from [avr-gcc.exe]
Rückgabewert = 1
Flowcode konnte den C-Code des Flussdiagramms nicht kompilieren, da folgendeFehler auftraten:
Wenn Ihr Flussdiagramm C-Code enthält,überprüfen Sie diesen sorgfältig.Falls das Flussdiagramm keinen C-Code enthält oder Sie sich sicher seinkönnen, dass dieser Code fehlerfrei ist, dann wenden Sie sich an den technischenSupport.
BEENDET
Now I got already help by mail from Steve Tandy who proposed a workaround with the following code into the top box of the "supplementary code"feature (via the "project options" window):
#define COM0A0 COM00
#define COM0A1 COM01
#define OCR0A OCR0
This was successful regarding download to chip. Download to chip is now possible without errors but I cannot achieve the(hardware) PWM-output signal on PD5 (with PWM(0)). I also tried PD4 withPWM(1), no success.
Do you have a further idea to make the PWM function work on the controller?
Best regards and thanks in advance.
Gerhard
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi
Can you please post the program so that we can see what is going wrong?
Edit:
I have moved the topic to FCV5...
Can you please post the program so that we can see what is going wrong?
Edit:
I have moved the topic to FCV5...
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
I thought I did it. Try it again.
I thought I did it. Try it again.
- Attachments
-
- Fan PWM2.fcf_avr
- (16 KiB) Downloaded 450 times
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: V5 for AVR: PWM does not work
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Sorry,
the latest one was the now attached file.
the latest one was the now attached file.
- Attachments
-
- Fan PWM.fcf_avr
- (12.58 KiB) Downloaded 440 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
I have tried both with and without supplementary code. Without supplementary code the code shows error but with supplementary code it compiles fine in my case. So is there any issue still left after Dazz's suggestion? Please let us know.
I have tried both with and without supplementary code. Without supplementary code the code shows error but with supplementary code it compiles fine in my case. So is there any issue still left after Dazz's suggestion? Please let us know.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
Can you please upgrade you to V5 forum in the following link..
http://www.matrixmultimedia.com/forum_upgrades.php
Can you please upgrade you to V5 forum in the following link..
http://www.matrixmultimedia.com/forum_upgrades.php
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi again,
First of all many thanks to Enamul who made it possible that I have now access to the V5-forum so that I can answer to this issue.
Back to my problem:
With supplementary code the code shows no error and also download to chip went ok without errors.
But: My hardware doesn´t produce a PWM-output signal. I have measured on PD5 (with PWM(0) and I tried also PD4 with PWM(1), no success.
Any idea what can be the reason for this behaviour?
Note: My hardware (ATMega 32, 16 MHz) works fine with all other test programs I have written. I have tested all ports (dig. and anal. IO). Thus the hardware should not be the reason for the missing PWM signal.
First of all many thanks to Enamul who made it possible that I have now access to the V5-forum so that I can answer to this issue.
Back to my problem:
With supplementary code the code shows no error and also download to chip went ok without errors.
But: My hardware doesn´t produce a PWM-output signal. I have measured on PD5 (with PWM(0) and I tried also PD4 with PWM(1), no success.
Any idea what can be the reason for this behaviour?
Note: My hardware (ATMega 32, 16 MHz) works fine with all other test programs I have written. I have tested all ports (dig. and anal. IO). Thus the hardware should not be the reason for the missing PWM signal.
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Problem is solved!
I used the PWM channel 1 but this channel does not produce an output signal in my hardware system ATMega 32.
So I tried PWM channel 2 and 3 and both are working.
PWM channel 2 -> PD5 (OC1A)
PWM channel 3 -> PD4 (OC1B)
Maybe somebody knows why PWM channel 1 doesn´t work in this system. Further PWM pins normally should be PD7 and PC3.
Thanks to all, who gave me support.
GSteuerwald
I used the PWM channel 1 but this channel does not produce an output signal in my hardware system ATMega 32.
So I tried PWM channel 2 and 3 and both are working.
PWM channel 2 -> PD5 (OC1A)
PWM channel 3 -> PD4 (OC1B)
Maybe somebody knows why PWM channel 1 doesn´t work in this system. Further PWM pins normally should be PD7 and PC3.
Thanks to all, who gave me support.
GSteuerwald
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi
Pwm pins are as follows on that chip
pwm(1) B3 0C0A Pin 4
pwm(2) D5 0C1A Pin 19
pwm(3) D4 0C1B Pin 18
Regards
Dazz
Pwm pins are as follows on that chip
pwm(1) B3 0C0A Pin 4
pwm(2) D5 0C1A Pin 19
pwm(3) D4 0C1B Pin 18
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
Thanks for this hint. From point of definition B3 is correct, but I do not get a PWM signal. I measure a pulse with constant width of approx. 10 ms (I have defined a period of approx. 8 ms).
I have checked with another ATMega, same result with another pulse width.
Regards
GSteuerwald
Thanks for this hint. From point of definition B3 is correct, but I do not get a PWM signal. I measure a pulse with constant width of approx. 10 ms (I have defined a period of approx. 8 ms).
I have checked with another ATMega, same result with another pulse width.
Regards
GSteuerwald
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
Although this chip has 4 PWM which are OC0 (PORTB3) PIN4, OC1A (PORTD5) PIN19, OC1B (PORTD4) PIN18 and OC2 (PORTD7) PIN 21, in FCV5 3 channels are implemented. Those are..
Channel 1>> OC0 (PORTB3) PIN4
Channel 2>> OC1A (PORTD5) PIN19
Channel 3>> OC1B (PORTD4) PIN18
Channel 2 and 3 are PWM output or general purpose I/O..that's why they are working fine. But Channel 1 is multiplexed with analog comparator which I guess enable after AVR reset. So I believe to use that channel you need to disable analog comparator which has to be done before enabling PWM channel 1. I am attaching here a simple FC using 3 channel with different PWM output and almost 50% duty cycle. So you test output if you have scope and let me know how you are getting into it.
Or you can try above in c code in the beginning of your program
Although this chip has 4 PWM which are OC0 (PORTB3) PIN4, OC1A (PORTD5) PIN19, OC1B (PORTD4) PIN18 and OC2 (PORTD7) PIN 21, in FCV5 3 channels are implemented. Those are..
Channel 1>> OC0 (PORTB3) PIN4
Channel 2>> OC1A (PORTD5) PIN19
Channel 3>> OC1B (PORTD4) PIN18
Channel 2 and 3 are PWM output or general purpose I/O..that's why they are working fine. But Channel 1 is multiplexed with analog comparator which I guess enable after AVR reset. So I believe to use that channel you need to disable analog comparator which has to be done before enabling PWM channel 1. I am attaching here a simple FC using 3 channel with different PWM output and almost 50% duty cycle. So you test output if you have scope and let me know how you are getting into it.
Code: Select all
acsr = 0x80;
- Attachments
-
- AVR.fcf_avr
- FCV5 demo
- (9 KiB) Downloaded 413 times
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi Enamul,
Thanks for the explanation and the proposal to find out the strange behaviour of Channel 1>> OC0 (PORTB3) PIN4.
I have tried your FC with the following result.
Error message:
File name: E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme\PWM\AVR-3PWM Enamul.c
Title:
Description:
Generated by: Flowcode v5.3.0.0
Date: Wednesday, August 29, 2012 09:43:25
Licence: Professional
Registered to: Gerhard Steuerwald
Licence key: Q9XMDC
http://www.matrixmultimedia.com
Start des Compilers...
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avra.bat atmega32 "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c" "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.lst"
E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme\PWM>"C:\PROGRA~1\FLOWCO~1\v5\Tools\MX_bats\..\bin\avr-gcc.exe" -mmcu=atmega32 -Os -funsigned-char -o "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c" -lm
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:256:6: error: #error "PWM prescale value must be the same in all PWM modules"
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:378:6: error: #error "PWM prescale value must be the same in all PWM modules"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:227,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:604:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:101:5: warning: #warning "PWM Channel Uses Resource Timer 0"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:243,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:604:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:152:6: warning: #warning "PWM Channel Uses Resource Timer 1"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:259,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:604:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:152:6: warning: #warning "PWM Channel Uses Resource Timer 1"
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c: In function 'main':
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:626: error: 'acsr' undeclared (first use in this function)
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:626: error: (Each undeclared identifier is reported only once
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:626: error: for each function it appears in.)
Error returned from [avr-gcc.exe]
Rückgabewert = 1
Flowcode konnte den C-Code des Flussdiagramms nicht kompilieren, da folgende Fehler auftraten:
Wenn Ihr Flussdiagramm C-Code enthält,überprüfen Sie diesen sorgfältig. Falls das Flussdiagramm keinen C-Code enthält oder Sie sich sicher sein können, dass dieser Code fehlerfrei ist, dann wenden Sie sich an den technischen Support.
BEENDET
Then I have taken the same PWM prescale value but for a fix of the other error: " 'acsr' undeclared (first use in this function)" I do not have an idea.
Regards
GSteuerwald
Thanks for the explanation and the proposal to find out the strange behaviour of Channel 1>> OC0 (PORTB3) PIN4.
I have tried your FC with the following result.
Error message:
File name: E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme\PWM\AVR-3PWM Enamul.c
Title:
Description:
Generated by: Flowcode v5.3.0.0
Date: Wednesday, August 29, 2012 09:43:25
Licence: Professional
Registered to: Gerhard Steuerwald
Licence key: Q9XMDC
http://www.matrixmultimedia.com
Start des Compilers...
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avra.bat atmega32 "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c" "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.lst"
E:\STEUERWALD-AVR-CONTROLLER\FLOWCODE-Programmierung\Testprogramme\PWM>"C:\PROGRA~1\FLOWCO~1\v5\Tools\MX_bats\..\bin\avr-gcc.exe" -mmcu=atmega32 -Os -funsigned-char -o "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.elf" "E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c" -lm
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:256:6: error: #error "PWM prescale value must be the same in all PWM modules"
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:378:6: error: #error "PWM prescale value must be the same in all PWM modules"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:227,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:604:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:101:5: warning: #warning "PWM Channel Uses Resource Timer 0"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:243,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:604:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:152:6: warning: #warning "PWM Channel Uses Resource Timer 1"
In file included from C:\Program Files\Flowcode(AVR)\v5\CAL\includes.c:259,
from E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:604:
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:152:6: warning: #warning "PWM Channel Uses Resource Timer 1"
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c: In function 'main':
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:626: error: 'acsr' undeclared (first use in this function)
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:626: error: (Each undeclared identifier is reported only once
E:\ST9851~1\FLOWCO~1\TESTPR~1\PWM\AVR-3PWM Enamul.c:626: error: for each function it appears in.)
Error returned from [avr-gcc.exe]
Rückgabewert = 1
Flowcode konnte den C-Code des Flussdiagramms nicht kompilieren, da folgende Fehler auftraten:
Wenn Ihr Flussdiagramm C-Code enthält,überprüfen Sie diesen sorgfältig. Falls das Flussdiagramm keinen C-Code enthält oder Sie sich sicher sein können, dass dieser Code fehlerfrei ist, dann wenden Sie sich an den technischen Support.
BEENDET
Then I have taken the same PWM prescale value but for a fix of the other error: " 'acsr' undeclared (first use in this function)" I do not have an idea.
Regards
GSteuerwald
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
Is that the compiler msg for the program I have posted? Or it's your program where you have added the c code? If it's your program can you please post your program?
Is that the compiler msg for the program I have posted? Or it's your program where you have added the c code? If it's your program can you please post your program?
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
I have noticed why the error is...This is because in AVR we have to declare register in CAPS...
That's it..I have attached your code without adc...FAN PWM...
Please let me know how you getting into..
I have noticed why the error is...This is because in AVR we have to declare register in CAPS...
Code: Select all
ACSR = 0x80;
Please let me know how you getting into..
- Attachments
-
- Fan PWM.fcf_avr
- (11.21 KiB) Downloaded 334 times
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi again,
Declare register in CAPS is ok, but channel 1 keeps refuseing to work, output signal keeps zero. Ch 2 & 3 are ok as before.
You wrote "But Channel 1 is multiplexed with analog comparator which I guess enable after AVR reset. So I believe to use that channel you need to disable analog comparator which has to be done before enabling PWM channel 1".
My questions: Is it planned to fix this in a future release? Is there a documentation available for PWM test on ATMega?
Regards
GSteuerwald
Declare register in CAPS is ok, but channel 1 keeps refuseing to work, output signal keeps zero. Ch 2 & 3 are ok as before.
You wrote "But Channel 1 is multiplexed with analog comparator which I guess enable after AVR reset. So I believe to use that channel you need to disable analog comparator which has to be done before enabling PWM channel 1".
My questions: Is it planned to fix this in a future release? Is there a documentation available for PWM test on ATMega?
Regards
GSteuerwald
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
It should be fixed in future release..I will look for any document of PWM for AVR. I will post if I get something useful.
It should be fixed in future release..I will look for any document of PWM for AVR. I will post if I get something useful.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi GSteuerwald,
I got here something which not too bad..pretty easy language..
http://robotika.yweb.sk/skola/AVR/visio ... 20v1.0.pdf
Also can have a look here..but different chip..
https://sites.google.com/site/qeewiki/b ... -atmega328
The following link also quite informative..
http://www.societyofrobots.com/member_t ... t/html/228
I got here something which not too bad..pretty easy language..
http://robotika.yweb.sk/skola/AVR/visio ... 20v1.0.pdf
Also can have a look here..but different chip..
https://sites.google.com/site/qeewiki/b ... -atmega328
The following link also quite informative..
http://www.societyofrobots.com/member_t ... t/html/228
-
- Posts: 13
- Joined: Sun Apr 04, 2010 7:35 pm
- Location: Mannheim, Germany
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: V5 for AVR: PWM does not work
Hi,
I have continued investigations on PWM functionality:
1. ATMega 32: I have tested some other (3) chips
Result: Same behaviour as decribed above
- Additional code necessary for error free compilation
#define COM0A0 COM00
#define COM0A1 COM01
#define OCR0A OCR0
- PWM channel 1 (of3) does not work
2. ATMega 8: I have tested 2 chips
Result: Both available PWM channels 1 and 2 work fine.
No additional code needed!
Conclusion:
Only ATMega 32 has to be fixed. Hopefully soon because I need all 3 PWM channels in my application.
Regards GSteuerwald
I have continued investigations on PWM functionality:
1. ATMega 32: I have tested some other (3) chips
Result: Same behaviour as decribed above
- Additional code necessary for error free compilation
#define COM0A0 COM00
#define COM0A1 COM01
#define OCR0A OCR0
- PWM channel 1 (of3) does not work
2. ATMega 8: I have tested 2 chips
Result: Both available PWM channels 1 and 2 work fine.
No additional code needed!
Conclusion:
Only ATMega 32 has to be fixed. Hopefully soon because I need all 3 PWM channels in my application.
Regards GSteuerwald