Page 1 of 1

Pwm not work

Posted: Sun Jan 20, 2019 8:39 am
by Serhii
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 ?

Re: Pwm not work

Posted: Sun Jan 20, 2019 9:22 am
by mnf
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

Re: Pwm not work

Posted: Sun Jan 20, 2019 10:39 am
by Serhii
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?

Re: Pwm not work

Posted: Sun Jan 20, 2019 3:46 pm
by mnf
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

Re: Pwm not work

Posted: Mon Jan 21, 2019 12:05 pm
by Benj
Hello,
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 ?
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"

Basically the channel you have selected uses a timer that doesn't support variable periods. Other channels using other timers will work fine.

Re: Pwm not work

Posted: Wed Jan 23, 2019 7:02 am
by Serhii
Ok Benj, I will try it in the device.

Re: Pwm not work

Posted: Thu Jan 24, 2019 7:14 pm
by Serhii
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

Posted: Thu Jan 24, 2019 7:15 pm
by Serhii
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!