Page 1 of 1

PWM Channel 3 does not work

Posted: Fri Mar 27, 2020 12:38 pm
by RABO2320
Hi
Pwm Channel3 (AVR MEGA8) works in software but does not work on the chip.
Please advise.
PWM.fcfx
(10.51 KiB) Downloaded 214 times
channel3.png
(14.48 KiB) Downloaded 490 times
osc.png
(80.83 KiB) Downloaded 490 times

Re: PWM Channel 3 does not work

Posted: Sun Mar 29, 2020 12:05 pm
by RABO2320
One of my friends answer me :roll: :|

Re: PWM Channel 3 does not work

Posted: Mon Mar 30, 2020 9:25 pm
by Benj
Hello,

Sorry for the delay. I'm investigating for you now. I've now had a good check through the code and the device datasheet and it all looks ok.

As a test if you enable timer 2 interrupt does this allow the PWM to function?

Re: PWM Channel 3 does not work

Posted: Tue Mar 31, 2020 12:27 pm
by RABO2320
Hello Benj
How to do it؟
Because I don't know anything about C Code. :oops:
Please guide me.

Re: PWM Channel 3 does not work

Posted: Tue Mar 31, 2020 1:31 pm
by Benj
Hello,

Just add an interrupt icon, set the type to enable timer 2 and configure the prescaler and other properties as desired. Hopefully this should kick start the PWM but let me know how you get on.

Re: PWM Channel 3 does not work

Posted: Wed Apr 01, 2020 2:58 pm
by RABO2320
Hello Benj
The method you provided didn't work.
The software makes an error when compiling.

In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:647,
from C:\Users\RAB\Desktop\check\Z\Flowcode1.c:351:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:179:6: warning: #warning "PWM Channel Uses Resource Timer 1"
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:669,
from C:\Users\RAB\Desktop\check\Z\Flowcode1.c:351:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:179:6: warning: #warning "PWM Channel Uses Resource Timer 1"
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:692,
from C:\Users\RAB\Desktop\check\Z\Flowcode1.c:351:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_PWM.c:238:7: warning: #warning "PWM Channel Uses Resource Timer 2"
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"
C:\Users\RAB\Desktop\check\Z\Flowcode1.c: In function 'main':
C:\Users\RAB\Desktop\check\Z\Flowcode1.c:939: error: 'TCCR2B' undeclared (first use in this function)
C:\Users\RAB\Desktop\check\Z\Flowcode1.c:939: error: (Each undeclared identifier is reported only once
C:\Users\RAB\Desktop\check\Z\Flowcode1.c:939: error: for each function it appears in.)

Error returned from [avr-gcc.exe]

C:\Program Files (x86)\Flowcode\Common\Compilers\avr\batchfiles\avra.bat reported error code 1
PWM 3CH.fcfx
(12 KiB) Downloaded 180 times

Re: PWM Channel 3 does not work

Posted: Tue Apr 07, 2020 5:21 pm
by RABO2320
Hello
Please advise. :roll:

Re: PWM Channel 3 does not work

Posted: Tue Apr 14, 2020 5:04 pm
by Benj
Hello,

Sorry for the delay, I've now pushed updates to the update system to allow the timer2 interrupt to compile correctly. This gives me a clue as to the PWM issue too so I'll see if I can get this resolved too so you dont have to add the interrupt icon.