Hi everyone. There is a problem with compiling the program with the PWM element. Returns lines:
D:\Projects\TRIMMI~1>"C:\PROGRA~2\Flowcode\Common\COMPIL~1\avr\BATCHF~1\..\bin\avr-gcc.exe" -mmcu=atmega328p -Os -ffunction-sections -fdata-sections -funsigned-char -o "D:\Projects\TRIMMI~1\Flowcode1.elf" "D:\Projects\TRIMMI~1\Flowcode1.c" -lm -Wl,-gc-sections
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:561,
from D:\Projects\TRIMMI~1\Flowcode1.c:249:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:110:5: warning: #warning "PWM Channel Uses Resource Timer 0"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:495:3: warning: #warning "Period control register not available on target device, period will default to 255 + 1"
What is wrong ?
Pwm not work
Moderator: Benj
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: Pwm not work
Hi Serhii,
Please post a copy of your program and details of hardware etc
You can add attachments using the tab just below the message box...
Martin
Please post a copy of your program and details of hardware etc
You can add attachments using the tab just below the message box...
Martin
Re: Pwm not work
Hi Martin. I use chip ATMega 328p (Arduino UNO and Arduino nano). However, as I read in the file CAL_AVR_PWM this chip is not used in it, but only XMEGA and Tiny. Could that be a problem?
- Attachments
-
- Flowcode1.fcfx
- (10.66 KiB) Downloaded 353 times
-
- Flowcode1.c
- (28.37 KiB) Downloaded 308 times
-
- prog.pwm.png
- (279.1 KiB) Downloaded 2968 times
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: Pwm not work
Timer 0 is an 8 bit timer.
Using Timer1 (choose a different channel) allows alteration and compiles ok. It may be a bug or it may be because Timer 0 is used for delay timing purposes.
Martin
Using Timer1 (choose a different channel) allows alteration and compiles ok. It may be a bug or it may be because Timer 0 is used for delay timing purposes.
Martin
- 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: Pwm not work
Hello,
Basically the channel you have selected uses a timer that doesn't support variable periods. Other channels using other timers will work fine.
Nothing wrong just a warning that if you try and change the period using the PWM properties or the ChangePeriod component macro that it won't do anything as the "Period control register not available on target device" and the "period will default to 255 + 1"C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:110:5: warning: #warning "PWM Channel Uses Resource Timer 0"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:495:3: warning: #warning "Period control register not available on target device, period will default to 255 + 1"
What is wrong ?
Basically the channel you have selected uses a timer that doesn't support variable periods. Other channels using other timers will work fine.
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
Re: Pwm not work
Hi Benj. All right, I don't understand why the PWM initially refused to work, may not be the correct parameters set and the warning scared me? Don't know, but now everything works as it should)) Thanks for the help. Have a nice day!
Re: Pwm not work
Hi Martin. All right, may not be the correct parameters set and the warning scared me?)) But now everything works as it should)) Thanks for the help. Have a nice day!