Problem with the PWM on big PIC !

Forum for problems or queries regarding the Flowcode application and compiler usage.

Moderators: Benj, Mods

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

Problem with the PWM on big PIC !

Post by WalkOver »

Hello,
I need a lot of pins for a project, so I chose a big PIC 18F6 *** or 18F8 ***. In this project I need PWM and I have the impression that it doesn't work. To test only the PWM, I made a very simple program implementing only pwm, I get an error when compiling on PIC : 18F6722, 8722, 18F86J65, 8527, 6410, 6527 ( maybe others ). The simulation works well and the program works very well with a PIC 18F2 *** or 18F4 ***.

I have this error :

Starting preprocessor: "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\pp.exe" "\Bureau\Nouveau dossier\Flowcode1.c" -i "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\include" -d _PIC18F6627 -la -c2 -o Flowcode1.pp -v -d _BOOSTC -d _PIC18

\Bureau\Nouveau dossier\Flowcode1.c(216): FCD file error (5 > 2)

1 errors detected
Error: preprocessing error
failure
Return code = 1


I did something wrong or there is really a bug ?

Thank you in advance !

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: Problem with the PWM on big PIC !

Post by Benj »

Hello

I will look into this problem for you.

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

Re: Problem with the PWM on big PIC !

Post by WalkOver »

Oh ! thank you very much ! It's nice. :)
For information, I use the latest Flowcode version (3.4.7.48). To test the PWM I just use the ADC component and I put the value to change the duty cycle of the PWM. Have you the same pb than me ?
I can try to send you the program if needed but there is really nothing special.

Thanks again

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: Problem with the PWM on big PIC !

Post by Benj »

Hello

I have managed to replicate the problem but thanks for the offer of the program, It appears this problem may require a larger fix so for now I can provide you with a workaround that will fix the problem.

If you open the FCD file for your target PICmicro into notepad and then find the following lines of code.

Firstly in the [Device] section of the FCD set the PWM count value to maximum of 2

Code: Select all

PWMCount=2
Next in the [Defines] section of the FCD set the PWM count value to maximum of 2 and then delete all entries that are over 2.

for example

Code: Select all

Define16=#define MX_PWM
Define17=#define MX_PWM_CNT 3
Define18=#define MX_PWM_TRIS1 trisc
Define19=#define MX_PWM_1 2
Define20=#define MX_PWM_TRIS2 trisc
Define21=#define MX_PWM_2 1
Define22=#define MX_PWM_TRIS2a trise
Define23=#define MX_PWM_2a 7
Define24=#define MX_PWM_TRIS3 trisg
Define25=#define MX_PWM_3 0
Would become this

Code: Select all

Define16=#define MX_PWM
Define17=#define MX_PWM_CNT 2
Define18=#define MX_PWM_TRIS1 trisc
Define19=#define MX_PWM_1 2
Define20=#define MX_PWM_TRIS2 trisc
Define21=#define MX_PWM_2 1
Define22=#define MX_PWM_TRIS2a trise
Define23=#define MX_PWM_2a 7
Once you have done this restart Flowcode and your code should now compile correctly.

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

Re: Problem with the PWM on big PIC !

Post by WalkOver »

Thank you very much for the trick and especially for your quick response!

I tested this solution very quickly on a 18F6527 but without success. I've had to do something wrong but I retest changing only one small thing :

Define20=#define MX_PWM_CNT 5

changed to:

Define20=#define MX_PWM_CNT 2

and it works very well during Flowcode and Isis Proteus simulation 8)

I will test with the other PIC.

Best regards

Post Reply