Page 1 of 1
pic 18f47k40 timer interrupt problem
Posted: Fri Apr 07, 2017 2:14 am
by TaliG
Hi,
I am working with a pic18F47k40 device and I am getting errors while trying to compile in .hex. (see attached pic)
In simulation everything works fine.
Project compiles fine into .hex and runs ok in hardware if I do not use timer interupts, timers or interrupts in general.
Can this problem be related to PIC32 interrupts problem?
viewtopic.php?f=63&t=18182
Thank you.
Re: pic 18f47k40 timer interrupt problem
Posted: Fri Apr 07, 2017 10:24 am
by Benj
Hello,
Thanks for letting us know.
Can this problem be related to PIC32 interrupts problem?
No this is just a register naming problem in the device definition file. Let me investigate for you and it should be a relatively easy fix.
Re: pic 18f47k40 timer interrupt problem
Posted: Fri Apr 07, 2017 10:56 am
by TaliG
Thank you very much for your prompt response.
I have also noticed some PWM component properties (PWM pin, Remap pin) cannot be configured.
Thanks
Re: pic 18f47k40 timer interrupt problem
Posted: Fri Apr 07, 2017 5:12 pm
by Benj
Hello,
Right here are some updated definition files for the device family which should solve all the timer interrupt related compile errors and hopefully provide some PWM pins.
Re: pic 18f47k40 timer interrupt problem
Posted: Fri Apr 07, 2017 7:51 pm
by TaliG
Amazing!
I will test tomorrow and confirm but I am quite confident it is going to work
Many thanks!
Re: pic 18f47k40 timer interrupt problem
Posted: Mon Apr 10, 2017 7:43 am
by TaliG
Hi,
Timer interrupts tested and working on hardware except timer0.
Interrupt On Change (IOC) produces the same compiler errors like TimerInterupt did.
Also on the options menu only RB4-7 and only on both edges is available to choose from, while in the datasheet Port A, B, C and pinRE3, rising or falling edge are available.
Interrupt on PIN (INTn pin) produces the same compiler errors like TimerInterupt did.
Also in the properties menu there is no option to choose any pin (port A and B can be chosen according to datasheet)
ADC input using EBM003_Thermistor component always defaults to AN0 (RA0) on harware regardless what channel is choosen in component properties.
PWM output does not work on hardware I tried everything

. PWM output on 16f690 hardware works ok.
I have noticed Mplab Code Configurator lets you configure PWM3 on RA0-5 and PORTD, PWM4 on RA0-5 and PORTC.
I have also noticed that it uses the PPS module in the code it produses in order to configure all the pins. (I dont know if that helps)
Any help would be appreciated.
Thanks
Re: pic 18f47k40 timer interrupt problem
Posted: Mon Apr 10, 2017 10:28 am
by Benj
Hello,
Thanks for letting me know.
Timer interrupts tested and working on hardware except timer0.
Hopefully Timer 0 should also be working now.
Interrupt On Change (IOC) produces the same compiler errors like TimerInterupt did.
Interrupt on PIN (INTn pin) produces the same compiler errors like TimerInterupt did.
These should also now be fixed and configurable.
- PIC.zip
- (75.57 KiB) Downloaded 395 times
Investigating the other issues now.
Re: pic 18f47k40 timer interrupt problem
Posted: Mon Apr 10, 2017 11:44 am
by TaliG
Hex compile test with INTon Pin
I could not get timer0int to work
Thank you for your great support

I will investigate the rest when i come back from work.
Re: pic 18f47k40 timer interrupt problem
Posted: Mon Apr 10, 2017 1:10 pm
by Benj
Hello,
I'm not getting those compile errors any more with the latest definitions so hopefully they are fixed, maybe you need to re-open Flowcode?
I have improved the PWM CAL component now so that the alternate remap pin banks are now available for you to use.
The file needs to be copied into your "Flowcode 7/Components" directory before restarting Flowcode.
I'll see if I can find out now why the PWM is not firing up for you, probably due to the timer differences on these devices.
Re: pic 18f47k40 timer interrupt problem
Posted: Mon Apr 10, 2017 11:04 pm
by TaliG
I am very sorry.
My mistake on unpacking and replacing the files
Timer0 tested and works nicely on the hardware
IOC fixed and works on the harware.
INTn Pin fixed and works on hardware.
Very nice job with INTnPin and IOC pin select properties.
About the PWM Im getting this compiler error
- PWM.png
- (27.74 KiB) Downloaded 6029 times
Please have a look at the code mplab code configurator produses for CCP1-2 and PWM3-4
I will try to use the C code block and some or all of the genarated code in the attachment to enable the PWM. I hope it doesnt explode or anything
Anyway
Thanks alot for your support!
Re: pic 18f47k40 timer interrupt problem
Posted: Tue Apr 11, 2017 9:57 am
by Benj
Thanks for letting me know.
Hopefully the last set of updates files here. These should fix the compilation errors for channels 3 and 4 and also allow the PWM to spring into life on all channels and timer options.
- PIC.zip
- (76.08 KiB) Downloaded 378 times
Let me know how you get on.
Re: pic 18f47k40 timer interrupt problem
Posted: Tue Apr 11, 2017 3:36 pm
by TaliG
Thanks Benj!
Compilation errors gone.
Sadly , I could not get a PWM output to work though
Thanks for your help!