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 !
Problem with the PWM on big PIC !
- 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 !
Hello
I will look into this problem for you.
I will look into this problem for you.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Problem with the PWM on big PIC !
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
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
- 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 !
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
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
Would become this
Once you have done this restart Flowcode and your code should now compile correctly.
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
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Problem with the PWM on big PIC !
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
I will test with the other PIC.
Best regards
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
I will test with the other PIC.
Best regards