pwm with 18f8722

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

Moderators: Benj, Mods

Post Reply
saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

pwm with 18f8722

Post by saschech@gmx.de »

Hallo together

Is there a help-file for the pwm macro?
Where i can set the output pin?

regards wolffgang

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 with 18f8722

Post by Benj »

Hello Wolfgang

The PWM is hardware controlled and therefore you cannot assign the pins. You may however be able to swap one or two the PWM pins by changing the configuration settings in the expert mode of PPP.

The PWM pins are marked as CCPx on the Chip diagram window. Eg CCP1 and CCP2 for channels 1 and 2.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo Benj

test_int_8722.c(563): FCD file error (5 > 2)

1 errors detected
Error: preprocessing error

I get this error if i start compiling,but it runs ok in debug mode.

Without:
pwm(0)
eneable(1)

pwm(0)
eneable(2)

pwm(0)
setdutycicle 1,11

pwm(0)
setdutycicle 2,99

the compiling is ok.

I read this over the pins:
The operations of PWM mode described in Section 17.4
“PWM Mode” apply to CCP4 and CCP5 only.

17.4 PWM Mode
In Pulse-Width Modulation (PWM) mode, the CCPx pin
produces up to a 10-bit resolution PWM output. Since
the CCP4 and CCP5 pins are multiplexed with a
PORTG data latch, the appropriate TRISG bit must be
cleared to make the CCP4 or CCP5 pin an output.
Figure 17-4 shows a simplified block diagram of the
CCP module in PWM mode.
For a step-by-step procedure on how to set up a CCP
module for PWM operation, see Section 17.4.3
“Setup for PWM Operation”.
Note: Clearing the CCP4CON or CCP5CON
register will force the RG3 or RG4 output
latch (depending on device configuration)
to the default low level. This is not the
PORTG I/O data latch.

Please can jou help me?

Regards wolfgang

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo Benj

If i want compiling with PIC 18f6722 i have the thame problem.
I must have a fixed fcd-file for both.

Regards wolfgang

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo Benj

Why you giv not a statment?I install my flowcode new and have the same problem.

Regards wolfgang

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 with 18f8722

Post by Benj »

Hi Wolfgang

Currently Flowcode V3 only supports a maximum of 2 PWM channels. The error you are receiving is simply stating that 5 is greater then the 2 currently supported channels. We have done this because the PWM settings go all over the place when using more then two channels across the range of chips. I will look into allowing support of more channels for your device.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo Benj
I work only with ch0 and become this error.

Regards wolfgang

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo Benj

A long time i wait .
You dont can or want help me?
I have the thame problem with ...... sean send me a new fcd file without these problem!!!!

Regards wolfgang

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 with 18f8722

Post by Benj »

Hello

Sorry I must have missed this post when it was made.

The PWM channels are numbered from 1 so the channel addresses that are valid are 1 and 2.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo Benj

I put in the Macro:
A
PWM (0)
enable 1

PWM (0)
set duty cycle 1.55

goto A

and i receive the error 5 >1

Regards wolfgang

WalkOver
Posts: 65
Joined: Fri Nov 23, 2007 11:24 pm
Contact:

Re: pwm with 18f8722

Post by WalkOver »

Try with this file.

You have to it in your FCD folder and replace the original file.

Let me know if your problem is resolved.
Attachments
18F8722.fcd
(10.58 KiB) Downloaded 291 times

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo walkover

Thank you,the *.fcd file works.
This fault is also in 17 other files!

On my bord PWM(0)
eneable 1
work on pin 43 / ecpp1

eneable 2 ??????????
isn`t work onmy board,it work in flocode simulation.........

Thank you again
Regards wolfgang

WalkOver
Posts: 65
Joined: Fri Nov 23, 2007 11:24 pm
Contact:

Re: pwm with 18f8722

Post by WalkOver »

Hello !

You have to replace this line on the wrong fcd files :

Define20=#define MX_PWM_CNT 5

by

Define20=#define MX_PWM_CNT 2

I don't have a 18F8722 but with Proteus ISIS, the simulation works well.

ECCP1 is on RC2 pin 43
ECCP2 is on RC1 pin 35

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: pwm with 18f8722

Post by saschech@gmx.de »

Hallo walkover

After your acknowledgment over the pin`s, i have a look
to my hardware,the bug a "cold soldered point " on pin 35.

Thank you for your great help!

Regards wolfgang

Post Reply