Pic18FxxK22 family: PMW Timer 2 only available timer

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
User avatar
Bruno
Posts: 67
Joined: Thu Jan 18, 2018 2:11 pm
Been thanked: 21 times
Contact:

Pic18FxxK22 family: PMW Timer 2 only available timer

Post 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

User avatar
Bruno
Posts: 67
Joined: Thu Jan 18, 2018 2:11 pm
Been thanked: 21 times
Contact:

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Post by Bruno »

Hi Benj
I ask you if you can solve what you wrote in the previous post
thank you

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: Pic18FxxK22 family: PMW Timer 2 only available timer

Post 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 237 times
The next file needs to live in your "Flowcode 7/CAL/PIC" folder.
PIC_CAL_PWM.c
(33.66 KiB) Downloaded 230 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.

User avatar
Bruno
Posts: 67
Joined: Thu Jan 18, 2018 2:11 pm
Been thanked: 21 times
Contact:

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Post 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

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: Pic18FxxK22 family: PMW Timer 2 only available timer

Post by Benj »

Aha thanks,

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

User avatar
Bruno
Posts: 67
Joined: Thu Jan 18, 2018 2:11 pm
Been thanked: 21 times
Contact:

Re: Pic18FxxK22 family: PMW Timer 2 only available timer

Post by Bruno »

I tried the new CAL, and all 3 timers work perfectly :D :D

thanks for your help

best regards

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: Pic18FxxK22 family: PMW Timer 2 only available timer

Post 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

Post Reply