Page 1 of 1

Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Sat Oct 06, 2018 4:48 pm
by Bruno
Hi
I'm using a pic18F24K22 and I'm having trouble selecting the PWM timer:
only timer2 is available. for the whole family K22 there is the same problem while for the K40 family there is the possibility to use also timer4 and timer6.
I read that the same problem was also found with the pic16F18323 and it was solved. Can it also be solved for the 18FxxK22 family?

best regards

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Mon Oct 08, 2018 12:03 pm
by Bruno
Hi Benj
I ask you if you can solve what you wrote in the previous post
thank you

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Tue Oct 09, 2018 10:27 am
by Benj
Hello,

Please give the attached files a go.

The first file needs to live in your "Flowcode 7/FCD/PIC" folder.
18F24K22.fcdx
(35.49 KiB) Downloaded 251 times
The next file needs to live in your "Flowcode 7/CAL/PIC" folder.
PIC_CAL_PWM.c
(33.66 KiB) Downloaded 245 times
If this works ok then I'll add the mod for the whole family and add to the v7 update archive as well as roll it across into v8.

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Tue Oct 09, 2018 12:12 pm
by Bruno
HI Benj
Thank you for your reply.
I did what you said, but the compiler gives the following error:

Target folder: C:\Users\BRUNOS~1\Desktop\TM0
Source name: C:\Users\Bruno Sgammato\Desktop\TM0\Test_PWM_24k22.fcfx
Title:
Description:
Device: PIC.18F.18F24K22
Generated by: Flowcode v7.3.0.6
Date: Tuesday, October 09, 2018 12:58:12
Users: 1
Registered to: B.Sgammato
Licence key: 5061QD
http://www.matrixtsl.com
Avvio del compilatore...
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe --chip=18F24K22 "Test_PWM_24k22.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_PWM.c: FC_CAL_PWM_ChangePeriod_1()
733: MX_TIMERSELECT0bits.C1TSEL = 0;
^ (192) undefined identifier "MX_TIMERSELECT0bits"
^ (196) struct/union required
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_PWM.c: FC_CAL_PWM_ChangePeriod_2()
868: MX_TIMERSELECT0bits.C2TSEL = 1;
^ (192) undefined identifier "MX_TIMERSELECT0bits"
^ (196) struct/union required
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_PWM.c: FC_CAL_PWM_ChangePeriod_3()
882: MX_TIMERSELECT0bits.C3TSEL = 1;
^ (192) undefined identifier "MX_TIMERSELECT0bits"
^ (196) struct/union required
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_PWM.c: FC_CAL_PWM_ChangePeriod_4()
1041: MX_TIMERSELECT1bits.C5TSEL = 2;
^ (192) undefined identifier "MX_TIMERSELECT1bits"
^ (196) struct/union required
(908) exit status = 1
(908) exit status = 1

C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe ha riportato il codice di errore 1

TERMINATO

regards

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Tue Oct 09, 2018 1:04 pm
by Benj
Aha thanks,

Please try this instead.
PIC_CAL_PWM.c
(33.56 KiB) Downloaded 259 times

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Tue Oct 09, 2018 1:46 pm
by Bruno
I tried the new CAL, and all 3 timers work perfectly :D :D

thanks for your help

best regards

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Posted: Tue Oct 09, 2018 3:15 pm
by Benj
Brilliant, thanks for letting me know.

I've now rolled out this to the whole K22 family and posted the files here.
viewtopic.php?f=63&t=19743&p=86234#p86234