PWM Channel 3 does not work

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
RABO2320
Posts: 41
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times

PWM Channel 3 does not work

Post 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 213 times
channel3.png
(14.48 KiB) Downloaded 490 times
osc.png
(80.83 KiB) Downloaded 490 times

RABO2320
Posts: 41
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times

Re: PWM Channel 3 does not work

Post by RABO2320 »

One of my friends answer me :roll: :|

User avatar
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 Channel 3 does not work

Post 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?

RABO2320
Posts: 41
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times

Re: PWM Channel 3 does not work

Post by RABO2320 »

Hello Benj
How to do it؟
Because I don't know anything about C Code. :oops:
Please guide me.

User avatar
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 Channel 3 does not work

Post 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.

RABO2320
Posts: 41
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times

Re: PWM Channel 3 does not work

Post 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 179 times

RABO2320
Posts: 41
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times

Re: PWM Channel 3 does not work

Post by RABO2320 »

Hello
Please advise. :roll:

User avatar
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 Channel 3 does not work

Post 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.

Post Reply