PWM Channel 3 does not work

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

Moderator: Benj

RABO2320
Posts: 13
Joined: Sun Mar 01, 2020 1:39 pm
Been thanked: 2 times
Contact:

PWM Channel 3 does not work

Postby RABO2320 » Fri Mar 27, 2020 12:38 pm

Hi
Pwm Channel3 (AVR MEGA8) works in software but does not work on the chip.
Please advise.
PWM.fcfx
(10.51 KiB) Downloaded 11 times


channel3.png
channel3.png (14.48 KiB) Viewed 481 times


osc.png
osc.png (80.83 KiB) Viewed 481 times

RABO2320
Posts: 13
Joined: Sun Mar 01, 2020 1:39 pm
Been thanked: 2 times
Contact:

Re: PWM Channel 3 does not work

Postby RABO2320 » Sun Mar 29, 2020 12:05 pm

One of my friends answer me :roll: :|

User avatar
Benj
Matrix Staff
Posts: 14790
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4752 times
Been thanked: 4358 times
Contact:

Re: PWM Channel 3 does not work

Postby Benj » Mon Mar 30, 2020 9:25 pm

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: 13
Joined: Sun Mar 01, 2020 1:39 pm
Been thanked: 2 times
Contact:

Re: PWM Channel 3 does not work

Postby RABO2320 » Tue Mar 31, 2020 12:27 pm

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: 14790
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4752 times
Been thanked: 4358 times
Contact:

Re: PWM Channel 3 does not work

Postby Benj » Tue Mar 31, 2020 1:31 pm

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: 13
Joined: Sun Mar 01, 2020 1:39 pm
Been thanked: 2 times
Contact:

Re: PWM Channel 3 does not work

Postby RABO2320 » Wed Apr 01, 2020 2:58 pm

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 5 times

RABO2320
Posts: 13
Joined: Sun Mar 01, 2020 1:39 pm
Been thanked: 2 times
Contact:

Re: PWM Channel 3 does not work

Postby RABO2320 » Tue Apr 07, 2020 5:21 pm

Hello
Please advise. :roll:

User avatar
Benj
Matrix Staff
Posts: 14790
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4752 times
Been thanked: 4358 times
Contact:

Re: PWM Channel 3 does not work

Postby Benj » Tue Apr 14, 2020 5:04 pm

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.